1665: Python env sentry integration (#1669)

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
This commit is contained in:
Alexey Firsov
2020-08-04 09:46:12 +05:30
committed by GitHub
co-authored by Vishal
parent b208528d3d
commit 587b166a4e
2 changed files with 15 additions and 1 deletions
+1
View File
@@ -6,3 +6,4 @@ requests==2.20.0
redis
hiredis
gevent
sentry-sdk[flask]
+14 -1
View File
@@ -7,9 +7,22 @@ import sys
from flask import Flask, request, abort, g
from gevent.pywsgi import WSGIServer
import bjoern
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
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):
@@ -71,7 +84,7 @@ class FuncApp(Flask):
moduleName = parts[0]
funcName = parts[1]
self.logger.debug('moduleName = "{}" funcName = "{}"'.format(moduleName, funcName))
# check whether the destination is a directory or a file
if os.path.isdir(filepath):
# add package directory path into module search path