From 8d2a29f2864cbff5faeeb73ae8e06fbb3bed08b8 Mon Sep 17 00:00:00 2001 From: Paul Tiedtke Date: Fri, 16 Apr 2021 20:34:33 +0200 Subject: [PATCH] misc: add support for sentry logging --- docker-compose.yml | 6 ++++++ env.example | 12 ++++++++++++ jicofo/rootfs/defaults/logging.properties | 5 +++++ jicofo/rootfs/etc/cont-init.d/10-config | 7 +++---- jigasi.yml | 3 +++ jigasi/rootfs/defaults/logging.properties | 5 +++++ jigasi/rootfs/etc/cont-init.d/10-config | 8 ++++---- jvb/rootfs/defaults/logging.properties | 7 +++++-- jvb/rootfs/etc/cont-init.d/10-config | 6 ++---- 9 files changed, 45 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 04266b9..6ff9d75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -210,6 +210,9 @@ services: - JVB_BREWERY_MUC - MAX_BRIDGE_PARTICIPANTS - OCTO_BRIDGE_SELECTION_STRATEGY + - SENTRY_DSN="${JICOFO_SENTRY_DSN}" + - SENTRY_ENVIRONMENT + - SENTRY_RELEASE - TZ - XMPP_DOMAIN - XMPP_AUTH_DOMAIN @@ -253,6 +256,9 @@ services: - JVB_OCTO_PUBLIC_ADDRESS - JVB_OCTO_BIND_PORT - JVB_OCTO_REGION + - SENTRY_DSN="${JVB_SENTRY_DSN}" + - SENTRY_ENVIRONMENT + - SENTRY_RELEASE - TZ depends_on: - prosody diff --git a/env.example b/env.example index f90e3e3..b17f9f4 100644 --- a/env.example +++ b/env.example @@ -376,3 +376,15 @@ RESTART_POLICY=unless-stopped # Authenticate using external service or just focus external auth window if there is one already. # TOKEN_AUTH_URL=https://auth.meet.example.com/{room} + +# Sentry Error Tracking +# Sentry Data Source Name (Endpoint for Sentry project) +#JVB_SENTRY_DSN=https://public:private@host:port/1 +#JICOFO_SENTRY_DSN=https://public:private@host:port/1 +#JIGASI_SENTRY_DSN=https://public:private@host:port/1 + +# Optional environment info to filter events +#SENTRY_ENVIRONMENT=production + +# Optional release info to filter events +#SENTRY_RELEASE=1.0.0 diff --git a/jicofo/rootfs/defaults/logging.properties b/jicofo/rootfs/defaults/logging.properties index f8fd21a..33d1229 100644 --- a/jicofo/rootfs/defaults/logging.properties +++ b/jicofo/rootfs/defaults/logging.properties @@ -1,4 +1,8 @@ +{{ if .Env.SENTRY_DSN }} +handlers=java.util.logging.ConsoleHandler,io.sentry.jul.SentryHandler +{{ else }} handlers= java.util.logging.ConsoleHandler +{{ end }} java.util.logging.ConsoleHandler.level = ALL java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter @@ -10,6 +14,7 @@ net.sf.level=SEVERE net.java.sip.communicator.plugin.reconnectplugin.level=FINE org.ice4j.level=SEVERE org.jitsi.impl.neomedia.level=SEVERE +io.sentry.jul.SentryHandler.level=WARNING # Do not worry about missing strings net.java.sip.communicator.service.resources.AbstractResourcesService.level=SEVERE diff --git a/jicofo/rootfs/etc/cont-init.d/10-config b/jicofo/rootfs/etc/cont-init.d/10-config index 80b9e77..ed4c876 100644 --- a/jicofo/rootfs/etc/cont-init.d/10-config +++ b/jicofo/rootfs/etc/cont-init.d/10-config @@ -1,5 +1,7 @@ #!/usr/bin/with-contenv bash +export SENTRY_RELEASE="${SENTRY_RELEASE:-$(apt-cache policy jicofo | sed -n '/Installed/p' | sed -e 's/[^:]*: //')}" + if [[ -z $JICOFO_AUTH_PASSWORD ]]; then echo 'FATAL ERROR: Jicofo auth password must be set' exit 1 @@ -11,10 +13,7 @@ if [[ "$JICOFO_AUTH_PASSWORD" == "$OLD_JICOFO_AUTH_PASSWORD" ]]; then exit 1 fi +tpl /defaults/logging.properties > /config/logging.properties tpl /defaults/jicofo.conf > /config/jicofo.conf -if [[ ! -f /config/logging.properties ]]; then - cp /defaults/logging.properties /config -fi - chown -R jicofo:jitsi /config diff --git a/jigasi.yml b/jigasi.yml index ed7c5b4..b85231f 100644 --- a/jigasi.yml +++ b/jigasi.yml @@ -43,6 +43,9 @@ services: - GC_CLIENT_EMAIL - GC_CLIENT_ID - GC_CLIENT_CERT_URL + - SENTRY_DSN="${JIGASI_SENTRY_DSN}" + - SENTRY_ENVIRONMENT + - SENTRY_RELEASE - TZ depends_on: - prosody diff --git a/jigasi/rootfs/defaults/logging.properties b/jigasi/rootfs/defaults/logging.properties index 188619a..d20d090 100644 --- a/jigasi/rootfs/defaults/logging.properties +++ b/jigasi/rootfs/defaults/logging.properties @@ -1,4 +1,8 @@ +{{ if .Env.SENTRY_DSN }} +handlers=java.util.logging.ConsoleHandler,io.sentry.jul.SentryHandler +{{ else }} handlers= java.util.logging.ConsoleHandler +{{ end }} java.util.logging.ConsoleHandler.level = ALL java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter @@ -10,6 +14,7 @@ net.sf.level=SEVERE net.java.sip.communicator.plugin.reconnectplugin.level=FINE org.ice4j.level=SEVERE org.jitsi.impl.neomedia.level=SEVERE +io.sentry.jul.SentryHandler.level=WARNING # Do not worry about missing strings net.java.sip.communicator.service.resources.AbstractResourcesService.level=SEVERE diff --git a/jigasi/rootfs/etc/cont-init.d/10-config b/jigasi/rootfs/etc/cont-init.d/10-config index a19df09..fcadba6 100644 --- a/jigasi/rootfs/etc/cont-init.d/10-config +++ b/jigasi/rootfs/etc/cont-init.d/10-config @@ -1,5 +1,7 @@ #!/usr/bin/with-contenv bash +export SENTRY_RELEASE="${SENTRY_RELEASE:-$(apt-cache policy jigasi | sed -n '/Installed/p' | sed -e 's/[^:]*: //')}" + if [[ -z $JIGASI_XMPP_PASSWORD ]]; then echo 'FATAL ERROR: Jigasi auth password must be set' exit 1 @@ -11,15 +13,13 @@ if [[ "$JIGASI_XMPP_PASSWORD" == "$OLD_JIGASI_XMPP_PASSWORD" ]]; then exit 1 fi +tpl /defaults/logging.properties > /config/logging.properties tpl /defaults/sip-communicator.properties > /config/sip-communicator.properties + if [[ -f /config/custom-sip-communicator.properties ]]; then cat /config/custom-sip-communicator.properties >> /config/sip-communicator.properties fi -if [[ ! -f /config/logging.properties ]]; then - cp /defaults/logging.properties /config -fi - mkdir -pm777 /tmp/transcripts chown jigasi:jitsi /tmp/transcripts diff --git a/jvb/rootfs/defaults/logging.properties b/jvb/rootfs/defaults/logging.properties index 11f5667..29da73d 100644 --- a/jvb/rootfs/defaults/logging.properties +++ b/jvb/rootfs/defaults/logging.properties @@ -1,4 +1,8 @@ +{{ if .Env.SENTRY_DSN }} +handlers=java.util.logging.ConsoleHandler,io.sentry.jul.SentryHandler +{{ else }} handlers= java.util.logging.ConsoleHandler +{{ end }} java.util.logging.ConsoleHandler.level = ALL java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter @@ -6,9 +10,8 @@ java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLo net.java.sip.communicator.util.ScLogFormatter.programname=JVB .level=INFO - org.jitsi.videobridge.xmpp.ComponentImpl.level=FINE +io.sentry.jul.SentryHandler.level=WARNING # All of the INFO level logs from MediaStreamImpl are unnecessary in the context of jitsi-videobridge. org.jitsi.impl.neomedia.MediaStreamImpl.level=WARNING - diff --git a/jvb/rootfs/etc/cont-init.d/10-config b/jvb/rootfs/etc/cont-init.d/10-config index 597e533..e3053bb 100644 --- a/jvb/rootfs/etc/cont-init.d/10-config +++ b/jvb/rootfs/etc/cont-init.d/10-config @@ -1,6 +1,7 @@ #!/usr/bin/with-contenv bash export LOCAL_ADDRESS=$(ip addr show dev "$(ip route|awk '/^default/ { print $5 }')" | grep -oP '(?<=inet\s)\d+(\.\d+){3}') +export SENTRY_RELEASE="${SENTRY_RELEASE:-$(apt-cache policy jitsi-videobridge2 | sed -n '/Installed/p' | sed -e 's/[^:]*: //')}" if [[ -z $JVB_AUTH_PASSWORD ]]; then echo 'FATAL ERROR: JVB auth password must be set' @@ -18,10 +19,7 @@ if [[ -f /config/custom-sip-communicator.properties ]]; then cat /config/custom-sip-communicator.properties >> /config/sip-communicator.properties fi +tpl /defaults/logging.properties > /config/logging.properties tpl /defaults/jvb.conf > /config/jvb.conf -if [[ ! -f /config/logging.properties ]]; then - cp /defaults/logging.properties /config -fi - chown -R jvb:jitsi /config