Skip to content
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

Refactored common sentry setup #30

Merged
merged 1 commit into from
Aug 23, 2024
Merged

Refactored common sentry setup #30

merged 1 commit into from
Aug 23, 2024

Conversation

nikolas
Copy link
Member

@nikolas nikolas commented Aug 23, 2024

Many of our applications are not actually connected to sentry, for example:
https://github.com/ccnmtl/footprints/blob/master/footprints/settings_production.py#L5

The ctlsettings common() method requires the sentry_dsn param to be set, which isn't in this case, and isn't available until local_settings is imported.

Some applications are set up for sentry where they init sentry within the application: https://github.com/ccnmtl/mediathread/blob/master/mediathread/settings_production.py#L49

With this update to ctlsettings, applications can call the common code to initialize sentry using a pattern like this:

from ctlsettings.production import init_sentry

""" after local_settings import """

if hasattr(settings, 'SENTRY_DSN'):
    init_sentry(SENTRY_DSN)

Many of our applications are not actually connected to sentry, for
example:
https://github.com/ccnmtl/footprints/blob/master/footprints/settings_production.py#L5

The ctlsettings common() method requires the `sentry_dsn` param to be
set, which isn't in this case, and isn't available until local_settings
is imported.

Some applications are set up for sentry where they init sentry within the application:
https://github.com/ccnmtl/mediathread/blob/master/mediathread/settings_production.py#L49

With this update to ctlsettings, applications can call the common code
to initialize sentry using a pattern like this:
```
from ctlsettings.production import init_sentry

""" after local_settings import """

if hasattr(settings, 'SENTRY_DSN'):
    init_sentry(SENTRY_DSN)
```
@ndittren ndittren merged commit a5ad3fb into main Aug 23, 2024
2 checks passed
@ndittren ndittren deleted the init-sentry branch October 22, 2024 19:48
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.

2 participants