mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 00:20:43 -04:00
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.
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user