← All platforms

Celery error tracking

The request finished. The job didn’t. The Sentry Celery integration sends task failures to Telebugs on your server, even when nobody is watching the worker.

~/hoofnotes  pip install sentry-sdk
~/hoofnotes  nvim hoofnotes/celery.py
from celery import signals
import sentry_sdk
@signals.celeryd_init.connect
def init_error_tracking(**kwargs):
sentry_sdk.init(
# Copy the complete DSN, key and path included.
dsn="YOUR_TELEBUGS_DSN",
)
~/hoofnotes  celery -A hoofnotes worker

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep sentry-sdk and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

Does a retry count as an error?

Celery’s expected retry signal is not the same as an unexpected task exception. The SDK understands that distinction, so a planned retry needn’t become noise.

Can the web app send errors here too?

Yes. Your Django or Flask app and its workers can report to the same Telebugs server. Each process needs its SDK connection.