Configure Sentry#30
Open
FCasal-LI wants to merge 3 commits into
Open
Conversation
FCasal-LI
commented
Oct 15, 2025
- Sentry integration
stefanotroncaro
requested changes
Oct 15, 2025
Contributor
stefanotroncaro
left a comment
There was a problem hiding this comment.
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: |
Contributor
There was a problem hiding this comment.
I'm not sure we want sentry when running locally. Can you consult @DanTcheche or @jsarrolt on that?
Suggested change
| if settings.SENTRY_DSN: | |
| if settings.RUN_ENV != "local" and settings.SENTRY_DSN: |
Comment on lines
31
to
+37
|
|
||
| if settings.SENTRY_DSN: | ||
| sentry_sdk.init( | ||
| dsn=settings.SENTRY_DSN, | ||
| environment=settings.RUN_ENV, | ||
| send_default_pii=True, | ||
| ) |
Contributor
There was a problem hiding this comment.
I would move sentry initialization to the middleware section, to be initialized after the app instance has been created
Comment on lines
+34
to
+36
| dsn=settings.SENTRY_DSN, | ||
| environment=settings.RUN_ENV, | ||
| send_default_pii=True, |
Contributor
There was a problem hiding this comment.
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? 😄
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.