2

I'd like to integrate Sentry with Huey task queue's workers / consumers.

I've seen an issue in both Sentry and Huey's GitHub issues, but I found no definite answer about how to integrate them.

I've read that one way to integrate them is via logging, however I'm storing my API key in the database and loading it from Python code, not from a hard-coded ini file (as is recommended).

Here is how I load Sentry in my main (Pyramid) app:

app = config.make_wsgi_app()

if get_siteconfig(dbsession)['sentry_key_backend']:
    try:
        from raven import Client
        from raven.middleware import Sentry
        client = Client(get_siteconfig(dbsession)['sentry_key_backend'])
        app = Sentry(app, client=client)
    except Exception:
        print('SENTRY init error')

Wheres my huey_worker.py is just a bunch of import statement and database setup lines, without an actual app or a function which I could wrap in a try - except block.

What is the recommended way to integrate Sentry in this case?

hyperknot
  • 13,454
  • 24
  • 98
  • 153

0 Answers0