Skip to content

Commit

Permalink
Initialize sentry on celery startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
breyten committed Jun 20, 2024
1 parent 592dceb commit c999c4b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ocd_backend/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from celery import Celery
import os

from ocd_backend.settings import CELERY_CONFIG
import sentry_sdk
from celery import Celery, signals

from ocd_backend.settings import CELERY_CONFIG, SENTRY_DSN

celery_app = Celery('ocd_backend', include=[
'ocd_backend.pipeline',
Expand Down Expand Up @@ -35,3 +38,11 @@
])

celery_app.conf.update(**CELERY_CONFIG)

#@signals.worker_init.connect
@signals.celeryd_init.connect
def init_sentry(**_kwargs):
sentry_sdk.init(
dsn=os.getenv('SENTRY_DSN'),
traces_sample_rate=1.0
) # same as above

0 comments on commit c999c4b

Please sign in to comment.