raven-python icon indicating copy to clipboard operation
raven-python copied to clipboard

Sanic integration

Open jrocketfingers opened this issue 7 years ago • 4 comments

I assume there are no plans whatsoever to integrate with Sanic, so I'll be handling it manually, but I'll be more than interested in writing an integration myself.

For additional context, Sanic is an asyncio based framework that's made to go fast™, with an API cloning that of Flask.

I'll begin work on this starting next week, but in the meantime, does any useful advice spring to mind?

jrocketfingers avatar May 22 '17 11:05 jrocketfingers

@jrocketfingers should be mostly easy as you only need to hook into a common point for catching errors. Outside of that, the Flask integration is probably the best to imitate.

dcramer avatar May 22 '17 15:05 dcramer

I haven't been able to get to work on this.

For the random internet citizen: in the meantime, you can log to Sentry with something along the lines of:

# whever-you-initialized-your-app.py
@app.exception(Exception)
def log_to_sentry(request, exception):
    request.app.raven.captureException({'extra': {'request': request}})

jrocketfingers avatar Jun 04 '17 14:06 jrocketfingers

Starting this over here: https://github.com/newsela/raven-python/tree/sanic-client

I don't think it'll be particularly tricky, probably will have it wrapped up this weekend.

youcandanch avatar Feb 17 '18 17:02 youcandanch

@jrocketfingers that PR's ready to go, minus one test I can't reproduce failures on locally.

youcandanch avatar Mar 02 '18 18:03 youcandanch