From 07ab1a180cae35ff9cc0e8a870574b3249345b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Wed, 21 Feb 2024 11:23:19 +0100 Subject: [PATCH] Sentry setup --- requirements.txt | 2 ++ settings.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/requirements.txt b/requirements.txt index 3334dab..919adae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,3 +25,5 @@ rollbar==0.14.7 requests-oauthlib==1.3.0 unidecode==1.3.6 + +sentry-sdk[django]==1.40.5 diff --git a/settings.py b/settings.py index 84909f7..8b25fc2 100644 --- a/settings.py +++ b/settings.py @@ -5,6 +5,11 @@ import sys import json import os +import sentry_sdk +from sentry_sdk.integrations.celery import CeleryIntegration +from sentry_sdk.integrations.django import DjangoIntegration +from sentry_sdk.integrations.logging import LoggingIntegration + TESTING = 'test' in sys.argv # go through environment variables and override them @@ -311,3 +316,16 @@ OCTOPUS_API_TOKEN = get_from_env('OCTOPUS_API_TOKEN', '') if DEBUG: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +# Sentry setup +SENTRY_DSN = get_from_env('SENTRY_DSN', '') +if SENTRY_DSN: + sentry_sdk.init( + dsn=SENTRY_DSN, + integrations=[ + DjangoIntegration(), + CeleryIntegration(), + LoggingIntegration(level=logging.INFO, event_level=logging.WARNING), + ], + send_default_pii=True, + ) -- GitLab