add sentry support

This commit is contained in:
Her Email 2023-11-21 00:49:42 -05:00 committed by Henri Dickson
parent 7a6a8a432b
commit 2e52ecf293
3 changed files with 16 additions and 0 deletions

View file

@ -83,6 +83,7 @@ env = environ.FileAwareEnv(
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 @@ CORS_ALLOW_METHODS = (
# "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,
)

View file

@ -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

View file

@ -39,6 +39,7 @@ podcastparser
psycopg2-binary
requests
rq>=1.12.0
sentry-sdk
setproctitle
tqdm
typesense