mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-15 01:23:25 -05:00
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.
21 lines
510 B
Python
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)
|