-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* replace raven with sentry-sdk * use sentry-sdk in celery * use sentry-sdk with flask * unify Flask and Celery initializations for Sentry * extract sentry stuff to own module * it's time for Sentry 0.7.2
- Loading branch information
Omer Lachish
authored
Feb 10, 2019
1 parent
23908ed
commit 71fb144
Showing
4 changed files
with
32 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sentry_sdk | ||
from sentry_sdk.integrations.flask import FlaskIntegration | ||
from sentry_sdk.integrations.celery import CeleryIntegration | ||
from redash import settings, __version__ | ||
|
||
|
||
NON_REPORTED_EXCEPTIONS = ['QueryExecutionError'] | ||
|
||
|
||
def before_send(event, hint): | ||
if 'exc_info' in hint: | ||
exc_type, exc_value, tb = hint['exc_info'] | ||
if any([(e in str(type(exc_value))) for e in NON_REPORTED_EXCEPTIONS]): | ||
return None | ||
|
||
return event | ||
|
||
|
||
def init(): | ||
if settings.SENTRY_DSN: | ||
sentry_sdk.init( | ||
dsn=settings.SENTRY_DSN, | ||
release=__version__, | ||
before_send=before_send, | ||
integrations=[FlaskIntegration(), CeleryIntegration()] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters