From 367dc7b4bc0f717763b4c9472d0a60d9be743557 Mon Sep 17 00:00:00 2001 From: Cameron Hyde Date: Tue, 8 Oct 2024 08:32:51 +1000 Subject: [PATCH 1/2] Add sentry log handler --- requirements.txt | 1 + webapp/webapp/settings/prod.py | 12 +++++++++++- webapp/webapp/urls.py | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 712ae716..0cd61d78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,3 +20,4 @@ lxml Pillow requests==2.* requests_mock==1.* +sentry-sdk==2.* diff --git a/webapp/webapp/settings/prod.py b/webapp/webapp/settings/prod.py index a0eecac8..bee1d9f4 100644 --- a/webapp/webapp/settings/prod.py +++ b/webapp/webapp/settings/prod.py @@ -1,6 +1,7 @@ """Settings for production.""" import os +import sentry_sdk from .base import * from . import validate @@ -60,4 +61,13 @@ LOGGING = config.configure_logging(LOG_ROOT) # Use manifest to manage static file versions for cache busting: -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' +STATICFILES_STORAGE = ( + 'django.contrib.staticfiles.storage' + '.ManifestStaticFilesStorage') + +sentry_sdk.init( + dsn="https://426e64399bbafe4210c4fa647c7a2f5b@sentry.galaxyproject.org/20", + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate=1.0, +) diff --git a/webapp/webapp/urls.py b/webapp/webapp/urls.py index 3407f3c2..9a206609 100644 --- a/webapp/webapp/urls.py +++ b/webapp/webapp/urls.py @@ -29,6 +29,7 @@ path('news/', include('news.urls')), path('events/', include('events.urls')), path('people/', include('people.urls')), + path('test-error-handlers/', lambda x: 1 / 0), ] if settings.DEBUG: From 5307b6d8c529d827e7593abf2fef08e69b5b5fc9 Mon Sep 17 00:00:00 2001 From: Cameron Hyde Date: Tue, 8 Oct 2024 08:39:08 +1000 Subject: [PATCH 2/2] Remove test error url --- webapp/webapp/urls.py | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/webapp/urls.py b/webapp/webapp/urls.py index 9a206609..3407f3c2 100644 --- a/webapp/webapp/urls.py +++ b/webapp/webapp/urls.py @@ -29,7 +29,6 @@ path('news/', include('news.urls')), path('events/', include('events.urls')), path('people/', include('people.urls')), - path('test-error-handlers/', lambda x: 1 / 0), ] if settings.DEBUG: