filter out connection errors for sentry
This commit is contained in:
parent
57de6cbafc
commit
cb3732cb2b
|
@ -24,6 +24,7 @@ from sentry_sdk.integrations.logging import LoggingIntegration
|
||||||
|
|
||||||
from passbook import __version__
|
from passbook import __version__
|
||||||
from passbook.lib.config import CONFIG
|
from passbook.lib.config import CONFIG
|
||||||
|
from passbook.lib.sentry import before_send
|
||||||
|
|
||||||
VERSION = __version__
|
VERSION = __version__
|
||||||
|
|
||||||
|
@ -222,8 +223,7 @@ CELERY_BEAT_SCHEDULE = {
|
||||||
|
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
sentry_init(
|
sentry_init(
|
||||||
dsn=("https://55b5dd780bc14f4c96bba69b7a9abbcc:449af483bd0745"
|
dsn="https://55b5dd780bc14f4c96bba69b7a9abbcc@sentry.services.beryju.org/8",
|
||||||
"0d83be640d834e5458@sentry.services.beryju.org/8"),
|
|
||||||
integrations=[
|
integrations=[
|
||||||
DjangoIntegration(),
|
DjangoIntegration(),
|
||||||
CeleryIntegration(),
|
CeleryIntegration(),
|
||||||
|
@ -233,6 +233,8 @@ if not DEBUG:
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
send_default_pii=True,
|
send_default_pii=True,
|
||||||
|
before_send=before_send,
|
||||||
|
release='p2@%s' % __version__
|
||||||
)
|
)
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
"""passbook sentry integration"""
|
||||||
|
|
||||||
|
|
||||||
|
def before_send(event, hint):
|
||||||
|
"""Check if error is database error, and ignore if so"""
|
||||||
|
from django.core.exceptions import OperationalError
|
||||||
|
from django_redis.exceptions import ConnectionInterrupted
|
||||||
|
|
||||||
|
ignored_classes = [
|
||||||
|
OperationalError,
|
||||||
|
ConnectionInterrupted,
|
||||||
|
]
|
||||||
|
if 'exc_info' in hint:
|
||||||
|
_exc_type, exc_value, _ = hint['exc_info']
|
||||||
|
if isinstance(exc_value, ignored_classes):
|
||||||
|
return None
|
||||||
|
return event
|
Reference in New Issue