mirror of https://github.com/peter4431/rq.git
Add convenience directive to easily configure Sentry with RQ.
parent
cdc3a6c7a9
commit
502bf59399
@ -0,0 +1,15 @@
|
|||||||
|
def register_sentry(client, worker):
|
||||||
|
"""Given a Raven client and an RQ worker, registers exception handlers
|
||||||
|
with the worker so exceptions are logged to Sentry.
|
||||||
|
"""
|
||||||
|
def send_to_sentry(job, *exc_info):
|
||||||
|
client.captureException(
|
||||||
|
exc_info=exc_info,
|
||||||
|
extra={
|
||||||
|
'job_id': job.id,
|
||||||
|
'func': job.func,
|
||||||
|
'args': job.args,
|
||||||
|
'kwargs': job.kwargs,
|
||||||
|
})
|
||||||
|
|
||||||
|
worker.push_exc_handler(send_to_sentry)
|
Loading…
Reference in New Issue