rq/docs/patterns/sentry.md

1.6 KiB

title layout
RQ: Sending exceptions to Sentry patterns

Sending exceptions to Sentry

Sentry is a popular exception gathering service that RQ supports integrating with since version 0.3.1, through its custom exception handlers.

RQ includes a convenience function that registers your existing Sentry client to send all exceptions to.

An example:

{% highlight python %} from raven import Client from raven.transport.http import HTTPTransport from rq.contrib.sentry import register_sentry

client = Client('<YOUR_DSN>', transport=HTTPTransport) register_sentry(client, worker) {% endhighlight %}

Where worker is your RQ worker instance. After that, call worker.work(...) to start the worker. All exceptions that occur are reported to Sentry automatically.

Note:

Error delivery to Sentry is known to be unreliable with RQ when using async transports (the default is). So you are encouraged to use the HTTPTransport or RequestsHTTPTransport when creating your client. See the code sample above, or the Raven documentation.

For more info, see the Raven docs.

Read more on RQ's custom exception handling capabilities.