Skip to content

Conversation

@FCasal-LI
Copy link

  • Sentry integration

@FCasal-LI FCasal-LI self-assigned this Oct 15, 2025
@FCasal-LI FCasal-LI changed the title feat: add sentry configuration Configure Sentry Oct 15, 2025
Copy link
Contributor

@stefanotroncaro stefanotroncaro left a 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:
Copy link
Contributor

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?

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,
)
Copy link
Contributor

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

Comment on lines +34 to +36
dsn=settings.SENTRY_DSN,
environment=settings.RUN_ENV,
send_default_pii=True,
Copy link
Contributor

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_rate
  • profiles_sample_rate
  • before_send_transaction
  • before_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? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants