summaryrefslogtreecommitdiff
path: root/rq/contrib/sentry.py
blob: efb55b2f6be70c2051ccb3b9b9c5e563747e80d2 (plain)
1
2
3
4
5
6
7
8
def register_sentry(sentry_dsn, **opts):
    """Given a Raven client and an RQ worker, registers exception handlers
    with the worker so exceptions are logged to Sentry.
    """
    import sentry_sdk
    from sentry_sdk.integrations.rq import RqIntegration

    sentry_sdk.init(sentry_dsn, integrations=[RqIntegration()], **opts)