diff --git a/requirements.txt b/requirements.txt index 3334dab9f0401a81b98e04f1219203d4c582e12f..919adae23ad71c7647d0d8e7b530f13154f810c7 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 84909f77777627c8eb0d2d826a777038d2868693..8b25fc25a73d6601022edd633721475869dc8366 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, + )