Document how to use Raven in a Celery worker
See original GitHub issueThere’s no documentation of how to configure Raven in a Celery worker.
Hints of such documentation were removed in commit 6c5afbf. That commit message says “Remove raven.contrib.celery.CeleryClient” but it does other odd unexplained stuff:
- adds a
CeleryClient
inraven.contrib.django.celery
- removes documentation showing how to use
register_signal
, but doesn’t remove that function (and I guess it is still the intended way to capture Celery task failures…?) - removes a class
CeleryMixin
but adds a docstring referencing it, showing creation of aCeleryClient
class like the one being removed.
Issue Analytics
- State:
- Created 10 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Celery — Raven 5.32.0 documentation
Celery is a distributed task queue system for Python built on AMQP principles. For Celery built-in support by Raven is provided but it...
Read more >Using raven with celery in django - sentry - Stack Overflow
The celery client in raven uses a routing key on the task: class CeleryMixin(object): def ... http://docs.celeryproject.org/en/latest/userguide/routing.html.
Read more >[Answered]-sentry, raven and django celery-django
I have set up a standalone server configured a django application to log using django 1.3's logging dictionary conf as per the raven...
Read more >Workers Guide — Celery 5.2.7 documentation
You can get a list of queues that a worker consumes from by using the active_queues control command: $ celery -A proj inspect...
Read more >Celery - Sentry Documentation
The Celery integration adds support for the Celery Task Queue System . ... Additionally, the Sentry Python SDK will set the transaction on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For the sake of being helpful, I’ll point out that as of Celery 3.1, the Django integration looks like this:
http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
They suggest a celery.py module, which seems like the perfect place for this. Here’s what we have right now, which could be totally off:
I hope this helps someone!
I tried this last config and, although my celery worker was outputting that errors were being send to sentry, nothing arrived on the sentry side.
Then I set the
CELERYD_HIJACK_ROOT_LOGGER = False
and'disable_existing_loggers': True,
in the logging configuration and all the messages arrived, but they arrived duplicated. So I deactivated the registration of raven for failed celery tasks thus, in the end, only tweaking the mentioned two settings, and everything seams to be logged fine.Of course, the problem of this approach is that you take logging from the hands of celery back to yours but, as far as I see, this shouldn’t be any problem right?