Install sentry

This commit is contained in:
Jake Howard 2022-08-27 12:49:46 +01:00
parent 48c5aa0e56
commit 2b0779b26a
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 27 additions and 4 deletions

View file

@ -19,3 +19,4 @@ wagtail-metadata
humanize humanize
drf-yasg drf-yasg
django-plausible django-plausible
sentry-sdk

View file

@ -9,7 +9,7 @@ asgiref==3.5.2 # via django
async-timeout==4.0.2 # via redis async-timeout==4.0.2 # via redis
beautifulsoup4==4.9.3 # via -r requirements/base.in, wagtail beautifulsoup4==4.9.3 # via -r requirements/base.in, wagtail
brotli==1.0.9 # via whitenoise brotli==1.0.9 # via whitenoise
certifi==2022.6.15 # via requests certifi==2022.6.15 # via requests, sentry-sdk
charset-normalizer==2.1.0 # via requests charset-normalizer==2.1.0 # via requests
click==8.1.3 # via rq click==8.1.3 # via rq
coreapi==2.3.3 # via drf-yasg coreapi==2.3.3 # via drf-yasg
@ -53,13 +53,14 @@ requests==2.28.1 # via -r requirements/base.in, coreapi, wagtail, wagta
rq==1.10.1 # via django-rq rq==1.10.1 # via django-rq
ruamel-yaml==0.17.21 # via drf-yasg ruamel-yaml==0.17.21 # via drf-yasg
ruamel-yaml-clib==0.2.6 # via ruamel-yaml ruamel-yaml-clib==0.2.6 # via ruamel-yaml
sentry-sdk==1.9.5 # via -r requirements/base.in
six==1.16.0 # via html5lib, l18n six==1.16.0 # via html5lib, l18n
soupsieve==2.3.2.post1 # via beautifulsoup4 soupsieve==2.3.2.post1 # via beautifulsoup4
sqlparse==0.4.2 # via django sqlparse==0.4.2 # via django
tablib[xls,xlsx]==3.2.1 # via wagtail tablib[xls,xlsx]==3.2.1 # via wagtail
telepath==0.2 # via wagtail telepath==0.2 # via wagtail
uritemplate==4.1.1 # via coreapi, drf-yasg uritemplate==4.1.1 # via coreapi, drf-yasg
urllib3==1.26.11 # via requests urllib3==1.26.11 # via requests, sentry-sdk
wagtail==3.0.1 # via -r requirements/base.in, wagtail-draftail-snippet, wagtail-metadata wagtail==3.0.1 # via -r requirements/base.in, wagtail-draftail-snippet, wagtail-metadata
wagtail-draftail-snippet==0.4.1 # via -r requirements/base.in wagtail-draftail-snippet==0.4.1 # via -r requirements/base.in
wagtail-generic-chooser==0.4.1 # via -r requirements/base.in wagtail-generic-chooser==0.4.1 # via -r requirements/base.in

View file

@ -12,7 +12,7 @@ beautifulsoup4==4.9.3 # via -r requirements/base.txt, wagtail
black==22.6.0 # via -r requirements/dev.in black==22.6.0 # via -r requirements/dev.in
brotli==1.0.9 # via -r requirements/base.txt, whitenoise brotli==1.0.9 # via -r requirements/base.txt, whitenoise
build==0.8.0 # via pip-tools build==0.8.0 # via pip-tools
certifi==2022.6.15 # via -r requirements/base.txt, requests certifi==2022.6.15 # via -r requirements/base.txt, requests, sentry-sdk
charset-normalizer==2.1.0 # via -r requirements/base.txt, requests charset-normalizer==2.1.0 # via -r requirements/base.txt, requests
click==8.1.3 # via -r requirements/base.txt, black, curlylint, pip-tools, rq click==8.1.3 # via -r requirements/base.txt, black, curlylint, pip-tools, rq
coreapi==2.3.3 # via -r requirements/base.txt, drf-yasg coreapi==2.3.3 # via -r requirements/base.txt, drf-yasg
@ -77,6 +77,7 @@ requests==2.28.1 # via -r requirements/base.txt, coreapi, wagtail, wagt
rq==1.10.1 # via -r requirements/base.txt, django-rq rq==1.10.1 # via -r requirements/base.txt, django-rq
ruamel-yaml==0.17.21 # via -r requirements/base.txt, drf-yasg ruamel-yaml==0.17.21 # via -r requirements/base.txt, drf-yasg
ruamel-yaml-clib==0.2.6 # via -r requirements/base.txt, ruamel-yaml ruamel-yaml-clib==0.2.6 # via -r requirements/base.txt, ruamel-yaml
sentry-sdk==1.9.5 # via -r requirements/base.txt
six==1.16.0 # via -r requirements/base.txt, html5lib, l18n, python-dateutil six==1.16.0 # via -r requirements/base.txt, html5lib, l18n, python-dateutil
soupsieve==2.3.2.post1 # via -r requirements/base.txt, beautifulsoup4 soupsieve==2.3.2.post1 # via -r requirements/base.txt, beautifulsoup4
sqlparse==0.4.2 # via -r requirements/base.txt, django, django-debug-toolbar sqlparse==0.4.2 # via -r requirements/base.txt, django, django-debug-toolbar
@ -88,7 +89,7 @@ types-requests==2.28.5 # via -r requirements/dev.in
types-urllib3==1.26.17 # via types-requests types-urllib3==1.26.17 # via types-requests
typing-extensions==4.3.0 # via mypy typing-extensions==4.3.0 # via mypy
uritemplate==4.1.1 # via -r requirements/base.txt, coreapi, drf-yasg uritemplate==4.1.1 # via -r requirements/base.txt, coreapi, drf-yasg
urllib3==1.26.11 # via -r requirements/base.txt, requests urllib3==1.26.11 # via -r requirements/base.txt, requests, sentry-sdk
wagtail==3.0.1 # via -r requirements/base.txt, wagtail-draftail-snippet, wagtail-factories, wagtail-metadata wagtail==3.0.1 # via -r requirements/base.txt, wagtail-draftail-snippet, wagtail-factories, wagtail-metadata
wagtail-draftail-snippet==0.4.1 # via -r requirements/base.txt wagtail-draftail-snippet==0.4.1 # via -r requirements/base.txt
wagtail-factories==3.1.0 # via -r requirements/dev.in wagtail-factories==3.1.0 # via -r requirements/dev.in

View file

@ -11,6 +11,8 @@ env = environ.Env(
UNSPLASH_CLIENT_ID=(str, ""), UNSPLASH_CLIENT_ID=(str, ""),
SPOTIFY_PROXY_HOST=(str, ""), SPOTIFY_PROXY_HOST=(str, ""),
SEO_INDEX=(bool, False), SEO_INDEX=(bool, False),
SENTRY_DSN=(str, ""),
SENTRY_ENVIRONMENT=(str, ""),
) )
# Read local secrets # Read local secrets
@ -286,3 +288,21 @@ SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
if not DEBUG: if not DEBUG:
SECURE_HSTS_SECONDS = 86400 # 1 day SECURE_HSTS_SECONDS = 86400 # 1 day
if sentry_dsn := env("SENTRY_DSN"):
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations.rq import RqIntegration
from sentry_sdk.utils import get_default_release
sentry_kwargs = {
"dsn": sentry_dsn,
"integrations": [DjangoIntegration(), RqIntegration(), RedisIntegration()],
"release": get_default_release(),
}
if sentry_environment := env("SENTRY_ENVIRONMENT"):
sentry_kwargs.update({"environment": sentry_environment})
sentry_sdk.init(**sentry_kwargs)