From 93f3426b215236f24b9689bee6301c15224f36f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <tomas@imaniti.org>
Date: Thu, 22 Feb 2024 11:19:17 +0100
Subject: [PATCH] sentry integration

---
 majak_uistyleguide/settings/base.py | 18 ++++++++++++++++++
 requirements/prod.in                |  1 +
 requirements/prod.txt               |  8 +++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/majak_uistyleguide/settings/base.py b/majak_uistyleguide/settings/base.py
index 8c363fc..b9b7cb9 100644
--- a/majak_uistyleguide/settings/base.py
+++ b/majak_uistyleguide/settings/base.py
@@ -1,5 +1,9 @@
 from pathlib import Path
+
 import environ
+import sentry_sdk
+
+from sentry_sdk.integrations.django import DjangoIntegration
 
 
 ROOT_DIR = Path(__file__).parents[2]
@@ -80,6 +84,20 @@ TEMPLATES = [
 ]
 
 
+# SENTRY
+# ------------------------------------------------------------------------------
+SENTRY_DSN = env.str("SENTRY_DSN", default="")
+
+if SENTRY_DSN != "":
+    sentry_sdk.init(
+        dsn=SENTRY_DSN,
+        integrations=[
+            DjangoIntegration(),
+        ],
+        send_default_pii=True,
+    )
+
+
 # STATIC
 # ------------------------------------------------------------------------------
 STATIC_URL = "/static/"
diff --git a/requirements/prod.in b/requirements/prod.in
index 8f22dcc..95b6b01 100644
--- a/requirements/prod.in
+++ b/requirements/prod.in
@@ -1 +1,2 @@
 gunicorn
+sentry-sdk
diff --git a/requirements/prod.txt b/requirements/prod.txt
index f4a88f1..79fee39 100644
--- a/requirements/prod.txt
+++ b/requirements/prod.txt
@@ -1,10 +1,16 @@
 #
-# This file is autogenerated by pip-compile with Python 3.10
+# This file is autogenerated by pip-compile with Python 3.11
 # by the following command:
 #
 #    pip-compile prod.in
 #
+certifi==2024.2.2
+    # via sentry-sdk
 gunicorn==21.2.0
     # via -r prod.in
 packaging==23.2
     # via gunicorn
+sentry-sdk==1.40.5
+    # via -r prod.in
+urllib3==2.2.1
+    # via sentry-sdk
-- 
GitLab