Skip to content

Commit

Permalink
Merge pull request #131 from OpenDataServices/120-sentry
Browse files Browse the repository at this point in the history
sentry: Add to Python
  • Loading branch information
odscjames committed May 5, 2021
2 parents d54bbf0 + b09a9cd commit 65d3aa5
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 88 deletions.
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ django-redis==4.12.*
# For production
gunicorn
whitenoise
sentry-sdk
66 changes: 19 additions & 47 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
attrs==20.3.0
# via jsonschema
cached-property==1.5.2
# via
# libcove
# libcoveweb
# via libcove
certifi==2020.12.5
# via
# requests
Expand All @@ -32,8 +30,6 @@ defusedxml==0.6.0
# via odfpy
django-bootstrap3==14.2.0
# via libcoveweb
django-debug-toolbar==3.2
# via libcoveweb
django-environ==0.4.5
# via
# -r requirements.in
Expand All @@ -46,39 +42,29 @@ django==2.2.19
# via
# -r requirements.in
# django-bootstrap3
# django-debug-toolbar
# django-redis
# django-rq
# libcoveweb
et-xmlfile==1.0.1
# via openpyxl
flattentool==0.15.3
# via libcove
# via
# libcove
# libcoveweb
gunicorn==20.0.4
# via -r requirements.in
idna==2.10
# via requests
importlib-metadata==1.7.0
# via
# django-bootstrap3
# jsonschema
jdcal==1.4.1
# via openpyxl
json-merge-patch==0.2
# via
# libcove
# libcoveweb
# via libcove
jsonref==0.2
# via
# flattentool
# libcove
# libcoveweb
jsonschema==3.2.0
# via
# libcove
# libcoveweb
lepl==5.1.3
# via rfc6266
# via libcove
libcove==0.20.2
# via
# -r requirements.in
Expand All @@ -88,15 +74,11 @@ lxml==4.6.2
odfpy==1.4.1
# via flattentool
openpyxl==2.6.4
# via
# flattentool
# libcoveweb
# via flattentool
pip-tools==5.5.0
# via -r requirements.in
pyrsistent==0.17.3
# via jsonschema
python-dateutil==2.8.1
# via libcoveweb
pytz==2021.1
# via
# django
Expand All @@ -111,43 +93,33 @@ requests==2.25.1
# libcove
# libcoveweb
rfc3987==1.3.8
# via
# libcove
# libcoveweb
rfc6266==0.0.4
# via libcoveweb
# via libcove
rq==1.7.0
# via django-rq
schema==0.7.4
# via flattentool
sentry-sdk==0.20.3
# via libcoveweb
six==1.15.0
# via
# jsonschema
# python-dateutil
# -r requirements.in
# libcoveweb
six==1.15.0
# via jsonschema
sqlparse==0.4.1
# via
# django
# django-debug-toolbar
# via django
strict-rfc3339==0.7
# via
# libcove
# libcoveweb
# via libcove
uc-rfc6266-parser==0.1.0
# via libcoveweb
urllib3==1.26.3
# via
# requests
# sentry-sdk
werkzeug==1.0.1
# via uc-rfc6266-parser
whitenoise==5.2.0
# via -r requirements.in
xmltodict==0.12.0
# via
# flattentool
# libcoveweb
zipp==1.2.0
# via
# importlib-metadata
# libcoveweb
# via flattentool

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
60 changes: 19 additions & 41 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ attrs==20.3.0
black==20.8b1
# via -r requirements_dev.in
cached-property==1.5.2
# via
# libcove
# libcoveweb
# via libcove
certifi==2020.12.5
# via
# requests
Expand Down Expand Up @@ -43,8 +41,6 @@ defusedxml==0.6.0
# via odfpy
django-bootstrap3==14.2.0
# via libcoveweb
django-debug-toolbar==3.2
# via libcoveweb
django-environ==0.4.5
# via
# -r requirements.in
Expand All @@ -57,7 +53,6 @@ django==2.2.19
# via
# -r requirements.in
# django-bootstrap3
# django-debug-toolbar
# django-redis
# django-rq
# libcoveweb
Expand All @@ -68,28 +63,23 @@ et-xmlfile==1.0.1
flake8==3.8.4
# via -r requirements_dev.in
flattentool==0.15.3
# via libcove
# via
# libcove
# libcoveweb
gunicorn==20.0.4
# via -r requirements.in
idna==2.10
# via requests
jdcal==1.4.1
# via openpyxl
json-merge-patch==0.2
# via
# libcove
# libcoveweb
# via libcove
jsonref==0.2
# via
# flattentool
# libcove
# libcoveweb
jsonschema==3.2.0
# via
# libcove
# libcoveweb
lepl==5.1.3
# via rfc6266
# via libcove
libcove==0.20.2
# via
# -r requirements.in
Expand All @@ -103,9 +93,7 @@ mypy-extensions==0.4.3
odfpy==1.4.1
# via flattentool
openpyxl==2.6.4
# via
# flattentool
# libcoveweb
# via flattentool
pathspec==0.8.1
# via black
pip-tools==5.5.0
Expand All @@ -116,8 +104,6 @@ pyflakes==2.2.0
# via flake8
pyrsistent==0.17.3
# via jsonschema
python-dateutil==2.8.1
# via libcoveweb
pytz==2021.1
# via
# django
Expand All @@ -135,50 +121,42 @@ requests==2.25.1
# libcove
# libcoveweb
rfc3987==1.3.8
# via
# libcove
# libcoveweb
rfc6266==0.0.4
# via libcoveweb
# via libcove
rq==1.7.0
# via django-rq
schema==0.7.4
# via flattentool
selenium==3.141.0
# via -r requirements_dev.in
sentry-sdk==0.20.3
# via libcoveweb
six==1.15.0
# via
# jsonschema
# python-dateutil
# -r requirements.in
# libcoveweb
six==1.15.0
# via jsonschema
sqlparse==0.4.1
# via
# django
# django-debug-toolbar
# via django
strict-rfc3339==0.7
# via
# libcove
# libcoveweb
# via libcove
toml==0.10.2
# via black
typed-ast==1.4.2
# via black
typing-extensions==3.7.4.3
# via black
uc-rfc6266-parser==0.1.0
# via libcoveweb
urllib3==1.26.3
# via
# requests
# selenium
# sentry-sdk
werkzeug==1.0.1
# via uc-rfc6266-parser
whitenoise==5.2.0
# via -r requirements.in
xmltodict==0.12.0
# via
# flattentool
# libcoveweb
zipp==1.2.0
# via libcoveweb
# via flattentool

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
24 changes: 24 additions & 0 deletions standards_lab/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import environ
import warnings

import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

from django.utils.crypto import get_random_string


Expand All @@ -36,8 +39,29 @@
DEBUG=(bool, True),
SECRET_KEY=(str, secret_key),
STATIC_ROOT=(str, os.path.join(BASE_DIR, "staticfiles")),
SENTRY_DSN=(str, None),
)

# SECURITY WARNING: keep the secret key used in production secret!
SENTRY_DSN = env("SENTRY_DSN")

if SENTRY_DSN:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
# If you wish to associate users to errors (assuming you are using
# django.contrib.auth) you may enable sending PII data.
send_default_pii=False,
# By default the SDK will try to use the SENTRY_RELEASE
# environment variable, or infer a git commit
# SHA as release, however you may want to set
# something more human-readable.
# release="myapp@1.0.0",
)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
Expand Down

0 comments on commit 65d3aa5

Please sign in to comment.