-
Notifications
You must be signed in to change notification settings - Fork 0
Configure Sentry #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Configure Sentry #30
Conversation
FCasal-LI
commented
Oct 15, 2025
- Sentry integration
stefanotroncaro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I left a few comments on things I'd like to see addressed or confirmed before we merge
| setup_logging(json_logs=settings.LOG_JSON_FORMAT, log_level=settings.LOG_LEVEL) | ||
| access_logger = structlog.stdlib.get_logger("api.access") | ||
|
|
||
| if settings.SENTRY_DSN: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we want sentry when running locally. Can you consult @DanTcheche or @jsarrolt on that?
| if settings.SENTRY_DSN: | |
| if settings.RUN_ENV != "local" and settings.SENTRY_DSN: |
|
|
||
| if settings.SENTRY_DSN: | ||
| sentry_sdk.init( | ||
| dsn=settings.SENTRY_DSN, | ||
| environment=settings.RUN_ENV, | ||
| send_default_pii=True, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move sentry initialization to the middleware section, to be initialized after the app instance has been created
| dsn=settings.SENTRY_DSN, | ||
| environment=settings.RUN_ENV, | ||
| send_default_pii=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some other settings I've seen used in projects are:
traces_sample_rateprofiles_sample_ratebefore_send_transactionbefore_send
For example, the before send settings can help filter out endpoints that we don't need sentry for, like the health endpoint.
Could you look into this? 😄