From ee5b8140629bb6e2b365e1ec68b303736a9a8999 Mon Sep 17 00:00:00 2001 From: Harald Nezbeda Date: Fri, 3 Nov 2023 09:06:42 +0100 Subject: [PATCH] Add sentry sdk --- requirements.txt | 1 + snypy/snypy/settings.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index e710a50..93b38aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,4 @@ django-gravatar2>=1.4.4,<1.5 django-linear-migrations>=2.8.0,<2.13 pytest-django>=4.5.2,<4.6 pytest-cov>=4.1.0,<4.2 +sentry-sdk>=1.34.0,<1.35 diff --git a/snypy/snypy/settings.py b/snypy/snypy/settings.py index 0cf8a62..7d897ba 100644 --- a/snypy/snypy/settings.py +++ b/snypy/snypy/settings.py @@ -1,6 +1,6 @@ import os import environ - +import sentry_sdk env = environ.Env( # set casting, default value @@ -22,8 +22,6 @@ ALLOWED_HOSTS = env.list("ALLOWED_HOSTS") CSRF_TRUSTED_ORIGINS = env.list("CSRF_TRUSTED_ORIGINS") -# Application definition - INSTALLED_APPS = [ # core "django.contrib.admin", @@ -170,3 +168,11 @@ "REDOC_DIST": "SIDECAR", "COMPONENT_SPLIT_REQUEST": True, } + +# Sentry +if env("SENTRY_ENABLED", default=False): + sentry_sdk.init( + dsn=env("SENTRY_DSN"), + traces_sample_rate=1.0, + profiles_sample_rate=1.0, + )