mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 09:49:48 -04:00
Tweak Sentry config to work in development
This makes a couple of changes:
- Most importantly, it wraps the setup code in a conditional so that
developers don't need to have a DSN set to start the app locally.
- Secondly, it removes the redundant call to "set_level". Originally
I thought the integration was sending info/warning events, but this
isn't the case [1] and even if it was, "set_level" affects the level
of custom events [2], not the level they are dispatched at.
[1]: 4c09f3203d/sentry_sdk/integrations/logging.py (L56)
[2]: https://docs.sentry.io/platforms/python/guides/logging/usage/set-level/
This commit is contained in:
@@ -8,16 +8,16 @@ from sentry_sdk.integrations import logging
|
|||||||
|
|
||||||
from app import create_app
|
from app import create_app
|
||||||
|
|
||||||
sentry_sdk.init(
|
if 'SENTRY_DSN' in os.environ:
|
||||||
dsn=os.environ['SENTRY_DSN'],
|
sentry_sdk.init(
|
||||||
integrations=[FlaskIntegration(), RedisIntegration()],
|
dsn=os.environ['SENTRY_DSN'],
|
||||||
environment=os.environ['NOTIFY_ENVIRONMENT'],
|
integrations=[FlaskIntegration(), RedisIntegration()],
|
||||||
attach_stacktrace=True,
|
environment=os.environ['NOTIFY_ENVIRONMENT'],
|
||||||
traces_sample_rate=0.00005 # avoid exceeding rate limits in Production
|
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
|
logging.ignore_logger('notifications_python_client.*') # ignore logs about 404s, etc.
|
||||||
logging.ignore_logger('notifications_python_client.*') # ignore logs about 404s, etc.
|
|
||||||
|
|
||||||
application = Flask('app')
|
application = Flask('app')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user