getsentry / raven-python

Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
https://sentry.io
BSD 3-Clause "New" or "Revised" License
1.68k stars 657 forks source link

Sanic integration #1005

Open jrocketfingers opened 7 years ago

jrocketfingers commented 7 years ago

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?

dcramer commented 7 years ago

@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.

jrocketfingers commented 7 years ago

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}})
youcandanch commented 6 years ago

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 commented 6 years ago

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