1665: Python env sentry integration (#1669)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
This commit is contained in:
@@ -6,3 +6,4 @@ requests==2.20.0
|
|||||||
redis
|
redis
|
||||||
hiredis
|
hiredis
|
||||||
gevent
|
gevent
|
||||||
|
sentry-sdk[flask]
|
||||||
|
|||||||
@@ -7,9 +7,22 @@ import sys
|
|||||||
from flask import Flask, request, abort, g
|
from flask import Flask, request, abort, g
|
||||||
from gevent.pywsgi import WSGIServer
|
from gevent.pywsgi import WSGIServer
|
||||||
import bjoern
|
import bjoern
|
||||||
|
import sentry_sdk
|
||||||
|
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||||
|
|
||||||
|
|
||||||
IS_PY2 = (sys.version_info.major == 2)
|
IS_PY2 = (sys.version_info.major == 2)
|
||||||
|
SENTRY_DSN = os.environ.get('SENTRY_DSN', None)
|
||||||
|
SENTRY_RELEASE = os.environ.get('SENTRY_RELEASE', None)
|
||||||
|
|
||||||
|
if SENTRY_DSN:
|
||||||
|
params = {
|
||||||
|
'dsn': SENTRY_DSN,
|
||||||
|
'integrations': [FlaskIntegration()]
|
||||||
|
}
|
||||||
|
if SENTRY_RELEASE:
|
||||||
|
params['release'] = SENTRY_RELEASE
|
||||||
|
sentry_sdk.init(**params)
|
||||||
|
|
||||||
|
|
||||||
def import_src(path):
|
def import_src(path):
|
||||||
|
|||||||
Reference in New Issue
Block a user