From 2f421f0fab2133023443b231e44b6c4370e10d89 Mon Sep 17 00:00:00 2001 From: Her Email Date: Tue, 21 Nov 2023 00:49:42 -0500 Subject: [PATCH] add sentry support --- boofilsic/settings.py | 13 +++++++++++++ compose.yml | 2 ++ requirements.txt | 1 + 3 files changed, 16 insertions(+) diff --git a/boofilsic/settings.py b/boofilsic/settings.py index d22e2285..2122e7c1 100644 --- a/boofilsic/settings.py +++ b/boofilsic/settings.py @@ -83,6 +83,7 @@ DISCORD_WEBHOOKS=(dict, {"user-report": None}), # Slack API token, for sending exceptions to Slack, may deprecate in future SLACK_API_TOKEN=(str, ""), + NEODB_SENTRY_DSN=(str, ""), ) # ====== End of user configuration variables ====== @@ -508,3 +509,15 @@ # "PUT", ) DEFAULT_RELAY_SERVER = "https://relay.neodb.net/actor" + +SENTRY_DSN = env("NEODB_SENTRY_DSN") +if SENTRY_DSN: + import sentry_sdk + from sentry_sdk.integrations.django import DjangoIntegration + + sentry_sdk.init( + dsn=SENTRY_DSN, + integrations=[DjangoIntegration()], + release=NEODB_VERSION, + traces_sample_rate=1 if DEBUG else 0.01, + ) diff --git a/compose.yml b/compose.yml index fefe4e29..64027a5d 100644 --- a/compose.yml +++ b/compose.yml @@ -30,6 +30,8 @@ x-shared: NEODB_LOGIN_MASTODON_WHITELIST: NEODB_MASTODON_CLIENT_SCOPE: NEODB_DISABLE_DEFAULT_RELAY: + NEODB_SENTRY_DSN: + TAKAHE_SENTRY_DSN: NEODB_DB_URL: postgres://neodb:aubergine@neodb-db/neodb TAKAHE_DB_URL: postgres://takahe:aubergine@takahe-db/takahe NEODB_REDIS_URL: redis://redis:6379/0 diff --git a/requirements.txt b/requirements.txt index f2aa239e..22d7f595 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,6 +39,7 @@ podcastparser psycopg2-binary requests rq>=1.12.0 +sentry-sdk setproctitle tqdm typesense