Changeset View
Changeset View
Standalone View
Standalone View
swh/core/sentry.py
Show All 16 Lines | |||||
def init_sentry( | def init_sentry( | ||||
sentry_dsn, *, debug=None, integrations=[], | sentry_dsn, *, debug=None, integrations=[], | ||||
extra_kwargs={}): | extra_kwargs={}): | ||||
if debug is None: | if debug is None: | ||||
debug = bool(os.environ.get('SWH_SENTRY_DEBUG')) | debug = bool(os.environ.get('SWH_SENTRY_DEBUG')) | ||||
sentry_dsn = sentry_dsn or os.environ.get('SWH_SENTRY_DSN') | sentry_dsn = sentry_dsn or os.environ.get('SWH_SENTRY_DSN') | ||||
environment = os.environ.get('SWH_SENTRY_ENVIRONMENT') | |||||
if sentry_dsn: | if sentry_dsn: | ||||
import sentry_sdk | import sentry_sdk | ||||
sentry_sdk.init( | sentry_sdk.init( | ||||
release=get_sentry_release(), | release=get_sentry_release(), | ||||
environment=environment, | |||||
dsn=sentry_dsn, | dsn=sentry_dsn, | ||||
integrations=integrations, | integrations=integrations, | ||||
debug=debug, | debug=debug, | ||||
**extra_kwargs, | **extra_kwargs, | ||||
) | ) |