The Celery integration adds support for the Celery Task Queue System.

Just add CeleryIntegration() to your integrations list:

import sentry_sdk
from sentry_sdk.integrations.celery import CeleryIntegration


    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for performance monitoring.
    # We recommend adjusting this value in production,

Additionally, the Sentry Python SDK will set the transaction on the event to the task name, and it will improve the grouping for global Celery errors such as timeouts.

The integration will automatically report errors from all celery jobs.

Generally, make sure that the call to init is loaded on worker startup, and not only in the module where your tasks are defined. Otherwise, the initialization happens too late and events might end up not being reported.

Standalone Setup

If you're using Celery standalone, there are two ways to set this up:

  • Initializing the SDK in the configuration file loaded with Celery's --config parameter

  • Initializing the SDK by hooking it to either the celeryd_init or worker_init signals

    import sentry_sdk
    from celery import Celery, signals
    app = Celery("myapp")
    def init_sentry(**_kwargs):

Setup With Django

If you're using Celery with Django in a conventional setup, have already initialized the SDK in your settings.py file, and have Celery using the same settings with config_from_object, you don't need to initialize the SDK separately for Celery.


To verify if your SDK is initialized on worker start, you can pass debug=True to see extra output when the SDK is initialized. If the output appears during worker startup and not only after a task has started, then it's working properly.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").