mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -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]: https://github.com/getsentry/sentry-python/blob/4c09f3203d6d19789c6fa729a2e46557ad4ea913/sentry_sdk/integrations/logging.py#L56 [2]: https://docs.sentry.io/platforms/python/guides/logging/usage/set-level/
This commit is contained in:
+9
-9
@@ -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