Files
notifications-admin/application.py
Ben Thorner 5ae8acb8aa Trial running Sentry in Admin
This will capture and send various events to Sentry:

- Any unhandled exceptions.
- Any logger.error calls.
- Some request traces.

The latter are severely limited to avoid going over the free tier
limits for Sentry, and to avoid excess effort on our end.
2021-12-31 10:57:05 +00:00

21 lines
510 B
Python

import os
import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration
from app import create_app
sentry_sdk.init(
dsn=os.environ['SENTRY_DSN'],
integrations=[FlaskIntegration()],
environment=os.environ['NOTIFY_ENVIRONMENT'],
attach_stacktrace=True,
traces_sample_rate=0.00005 # avoid exceeding rate limits in Production
)
sentry_sdk.set_level('error') # only record error logs or exceptions
application = Flask('app')
create_app(application)