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

Sentry Integration w/ Django Channels

Open DeadSuperHero opened this issue 6 years ago • 4 comments

Opening this ticket at the request of @ashwoods ; below is a forwarded message worth investigating in this SDK.

I have a question about Sentry integration with Django, because my app is built with Django channels which allows Django app to handle Websockets.

I have followed your Django integration guide here https://docs.sentry.io/clients/python/integrations/django/

My Django app is built with Django Channels therefore it is not a standard WSGI app :

  • it runs an interface server, an ASGI server called Daphne instead of a WSGI server
  • workers are launched separately to process the requests more details about this setup here https://channels.readthedocs.io/en/stable/deploying.html

Do you have any guidelines to integrate Sentry with this set up ? (for example, how to monitor exceptions raised by the asgi interface server ?)

DeadSuperHero avatar Oct 30 '17 20:10 DeadSuperHero

Currently, the easiest way to have sentry report messages from consumers is to wrap them with the client.capture_exceptions decorator as in this gist example. Will be updating the django client to enable tags, having complete interfaces will be a bit more tricky.

ashwoods avatar Nov 08 '17 15:11 ashwoods

Any updates on the issue?

I am using separate servers for asgi and wsgi. All uncaught exceptions of wsgi server are tracked by sentry and it is not able to track asgi server errors.

ChillarAnand avatar May 17 '18 12:05 ChillarAnand

daphne no longer uses a separate worker process as of 2.0 (which may change how this issue is tackled)

beaugunderson avatar May 17 '18 17:05 beaugunderson

There's an ASGI integration available now: https://github.com/encode/sentry-asgi

tomchristie avatar Nov 08 '18 09:11 tomchristie