Add new sentry SDK

This commit is contained in:
Ramon Wenger 2019-02-13 13:36:41 +01:00
parent 8e1a3126ff
commit a3a0874c65
3 changed files with 75 additions and 57 deletions

View File

@ -34,3 +34,4 @@ django-compressor = "*"
django-libsass = "*" django-libsass = "*"
bleach = "*" bleach = "*"
newrelic = "*" newrelic = "*"
sentry-sdk = "==0.7.2"

64
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "46ffac91f713eda7eeb613e76f58fb81f753a78e9c7da6913fc6a734dbdd1b24" "sha256": "61e358e30d3f66b4b69ac4ad424c24401d367fc483aaffeac28d970a418066aa"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -41,18 +41,18 @@
}, },
"boto3": { "boto3": {
"hashes": [ "hashes": [
"sha256:63cd957ba663f5c10ff48ed904575eaa701314f79f18dbc59bd050311cd5f809", "sha256:0bed0db8c10b88b3daa042adaa1fb6c3262caed39d28086e8548015405c71744",
"sha256:d1338582bc58741f54bd6b43488de6097a82ea45cebed0a3fd936981eadbb3a5" "sha256:70e71e0192a68f65754ab9d2a335be3c6856a1e8a15f3bd6263ea12e2f442bc7"
], ],
"index": "pypi", "index": "pypi",
"version": "==1.9.86" "version": "==1.9.93"
}, },
"botocore": { "botocore": {
"hashes": [ "hashes": [
"sha256:24444e7580f0114c3e9fff5d2032c6f0cfbf88691b1be3ba27c6922507a902ec", "sha256:4df39ef9bcd7766e3a71a9e7f976ca6c9e926f451914a9c073aa50e9519436ca",
"sha256:5b01a16f02c3da55068b3aacfa1c37dd8e17141551e1702424b38dd21fa1c792" "sha256:d3cea95919892eac30e2ff8c5a8908022d5a93f917df3cff4ed06a6926dcc0e5"
], ],
"version": "==1.12.86" "version": "==1.12.93"
}, },
"certifi": { "certifi": {
"hashes": [ "hashes": [
@ -363,11 +363,11 @@
}, },
"python-dateutil": { "python-dateutil": {
"hashes": [ "hashes": [
"sha256:063df5763652e21de43de7d9e00ccf239f953a832941e37be541614732cdfc93", "sha256:7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493df2fb",
"sha256:88f9287c0174266bb0d8cedd395cfba9c58e87e5ad86b2ce58859bc11be3cf02" "sha256:c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e"
], ],
"markers": "python_version >= '2.7'", "markers": "python_version >= '2.7'",
"version": "==2.7.5" "version": "==2.8.0"
}, },
"python-dotenv": { "python-dotenv": {
"hashes": [ "hashes": [
@ -420,10 +420,18 @@
}, },
"s3transfer": { "s3transfer": {
"hashes": [ "hashes": [
"sha256:90dc18e028989c609146e241ea153250be451e05ecc0c2832565231dacdf59c1", "sha256:7b9ad3213bff7d357f888e0fab5101b56fa1a0548ee77d121c3a3dbfbef4cb2e",
"sha256:c7a9ec356982d5e9ab2d4b46391a7d6a950e2b04c472419f5fdec70cc0ada72f" "sha256:f23d5cb7d862b104401d9021fc82e5fa0e0cf57b7660a1331425aab0c691d021"
], ],
"version": "==0.1.13" "version": "==0.2.0"
},
"sentry-sdk": {
"hashes": [
"sha256:131e3b9ac11dffd86fe4f1f5d388d3dab372fc9e30d6611d1fc87096a1d67359",
"sha256:e925a2363178c211ad787f507cedda12ee5b0aadf5ac390950140393636a80bb"
],
"index": "pypi",
"version": "==0.7.2"
}, },
"singledispatch": { "singledispatch": {
"hashes": [ "hashes": [
@ -507,11 +515,11 @@
"develop": { "develop": {
"awscli": { "awscli": {
"hashes": [ "hashes": [
"sha256:34f8f0cbfb69d7a2d9a891220fdba0250e832dcf4b7538507848f1508fa571a1", "sha256:11a18d6f42469366920ad96d483a64804f17ea63e21e5f4a66d8492d7031aa14",
"sha256:61891f987c70b4415fcccf6198d272d0f1c278cd53aaa23f4d3f2ba6475d8ccd" "sha256:21ad9141041834dfc135c731d32fdde674642f33d19b21e2ac9c696a8370d717"
], ],
"index": "pypi", "index": "pypi",
"version": "==1.16.96" "version": "==1.16.103"
}, },
"backcall": { "backcall": {
"hashes": [ "hashes": [
@ -522,10 +530,10 @@
}, },
"botocore": { "botocore": {
"hashes": [ "hashes": [
"sha256:24444e7580f0114c3e9fff5d2032c6f0cfbf88691b1be3ba27c6922507a902ec", "sha256:4df39ef9bcd7766e3a71a9e7f976ca6c9e926f451914a9c073aa50e9519436ca",
"sha256:5b01a16f02c3da55068b3aacfa1c37dd8e17141551e1702424b38dd21fa1c792" "sha256:d3cea95919892eac30e2ff8c5a8908022d5a93f917df3cff4ed06a6926dcc0e5"
], ],
"version": "==1.12.86" "version": "==1.12.93"
}, },
"colorama": { "colorama": {
"hashes": [ "hashes": [
@ -624,10 +632,10 @@
}, },
"parso": { "parso": {
"hashes": [ "hashes": [
"sha256:4b8f9ed80c3a4a3191aa3261505d868aa552dd25649cb13a7d73b6b7315edf2d", "sha256:4580328ae3f548b358f4901e38c0578229186835f0fa0846e47369796dd5bcc9",
"sha256:5a120be2e8863993b597f1c0437efca799e90e0793c98ae5d4e34ebd00140e31" "sha256:68406ebd7eafe17f8e40e15a84b56848eccbf27d7c1feb89e93d8fca395706db"
], ],
"version": "==0.3.2" "version": "==0.3.4"
}, },
"pexpect": { "pexpect": {
"hashes": [ "hashes": [
@ -675,11 +683,11 @@
}, },
"python-dateutil": { "python-dateutil": {
"hashes": [ "hashes": [
"sha256:063df5763652e21de43de7d9e00ccf239f953a832941e37be541614732cdfc93", "sha256:7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493df2fb",
"sha256:88f9287c0174266bb0d8cedd395cfba9c58e87e5ad86b2ce58859bc11be3cf02" "sha256:c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e"
], ],
"markers": "python_version >= '2.7'", "markers": "python_version >= '2.7'",
"version": "==2.7.5" "version": "==2.8.0"
}, },
"pyyaml": { "pyyaml": {
"hashes": [ "hashes": [
@ -706,10 +714,10 @@
}, },
"s3transfer": { "s3transfer": {
"hashes": [ "hashes": [
"sha256:90dc18e028989c609146e241ea153250be451e05ecc0c2832565231dacdf59c1", "sha256:7b9ad3213bff7d357f888e0fab5101b56fa1a0548ee77d121c3a3dbfbef4cb2e",
"sha256:c7a9ec356982d5e9ab2d4b46391a7d6a950e2b04c472419f5fdec70cc0ada72f" "sha256:f23d5cb7d862b104401d9021fc82e5fa0e0cf57b7660a1331425aab0c691d021"
], ],
"version": "==0.1.13" "version": "==0.2.0"
}, },
"six": { "six": {
"hashes": [ "hashes": [

View File

@ -75,7 +75,7 @@ INSTALLED_APPS = [
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'raven.contrib.django.raven_compat', # 'raven.contrib.django.raven_compat',
'whitenoise.runserver_nostatic', 'whitenoise.runserver_nostatic',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_filters', 'django_filters',
@ -279,7 +279,7 @@ LOGGING = {
'class': 'django.utils.log.AdminEmailHandler' 'class': 'django.utils.log.AdminEmailHandler'
}, },
'console': { 'console': {
'level': 'INFO', 'level': 'DEBUG',
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'stream': sys.stdout, 'stream': sys.stdout,
'formatter': 'simple_format' 'formatter': 'simple_format'
@ -288,9 +288,14 @@ LOGGING = {
'loggers': { 'loggers': {
'': { '': {
'handlers': ['console'], 'handlers': ['console'],
'level': 'INFO', 'level': 'DEBUG',
'propagate': True, 'propagate': True,
}, },
'skillbox': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': False,
},
'django.security.DisallowedHost': { 'django.security.DisallowedHost': {
'handlers': ['mail_admins'], 'handlers': ['mail_admins'],
'level': 'CRITICAL', 'level': 'CRITICAL',
@ -299,30 +304,34 @@ LOGGING = {
} }
} }
if not DEBUG and os.environ.get('RAVEN_DSN'): if not DEBUG and os.environ.get('SENTRY_DSN'):
# import raven import sentry_sdk
RAVEN_CONFIG = { from sentry_sdk.integrations.django import DjangoIntegration
'dsn': os.environ.get('RAVEN_DSN'),
}
LOGGING['handlers'] = { sentry_sdk.init(
'sentry': { dsn=os.environ.get('SENTRY_DSN'),
'level': 'ERROR', # ERROR, WARNING, INFO integrations=[DjangoIntegration()]
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler', )
'tags': {'custom-tag': 'x'},
},
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'stream': sys.stdout,
'formatter': 'simple_format'
}
}
for k, v in LOGGING['loggers'].items():
LOGGING['loggers'][k]['handlers'] = ['sentry', 'console'] # LOGGING['handlers'] = {
else: # 'sentry': {
RAVEN_CONFIG = {} # 'level': 'ERROR', # ERROR, WARNING, INFO
# 'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
# 'tags': {'custom-tag': 'x'},
# },
# 'console': {
# 'level': 'INFO',
# 'class': 'logging.StreamHandler',
# 'stream': sys.stdout,
# 'formatter': 'simple_format'
# }
# }
#
# for k, v in LOGGING['loggers'].items():
# LOGGING['loggers'][k]['handlers'] = ['sentry', 'console']
# else:
# RAVEN_CONFIG = {}
RAVEN_DSN_JS = os.environ.get('RAVEN_DSN_JS', '') RAVEN_DSN_JS = os.environ.get('RAVEN_DSN_JS', '')
@ -332,10 +341,10 @@ GRAPHENE = {
'SCHEMA': 'api.schema.schema' 'SCHEMA': 'api.schema.schema'
} }
if DEBUG: # if DEBUG:
GRAPHENE['MIDDLEWARE'] = [ # GRAPHENE['MIDDLEWARE'] = [
'graphene_django.debug.DjangoDebugMiddleware', # 'graphene_django.debug.DjangoDebugMiddleware',
] # ]
# http://docs.wagtail.io/en/v2.1/advanced_topics/settings.html?highlight=urls # http://docs.wagtail.io/en/v2.1/advanced_topics/settings.html?highlight=urls
WAGTAIL_SITE_NAME = 'skillbox' WAGTAIL_SITE_NAME = 'skillbox'