scoutapp / scout_apm_python

ScoutAPM Python Agent. Supports Django, Flask, and many other frameworks.
https://scoutapm.com
MIT License
67 stars 21 forks source link

Instrument Django Channels #372

Open adamchainz opened 4 years ago

adamchainz commented 4 years ago

This issue mostly discussed some bugs relating to async channels behaviour: #46 . It also noted we could instrument Channels better.

We already instrument normal Django views run under Channels because the full Django middleware stack runs. We'd better just look at instrumenting other types of consumers - notably websockets and async http consumers.

adamchainz commented 4 years ago

@svvitale you were interested in testing a Channels integration. This is the tracking issue.

We've discussed this internally a bit more and tracing a websocket for its entire lifetime probably won't make sense. Traces will be very long and feature a lot of idle time. We'd like to trace only around user interaction but since an await could be doing pretty much anything, it's not possible in the general case to do this.

The integration I started in #412 has some provision to trace standard methods in Channels like WebsocketConsumer.websocket_receive. However these would only trace events from the user side. It's not clear if this would be useful. What would you expect to have traced on Channels @svvitale?

adamchainz commented 4 years ago

@svvitale has confirmed on Slack that we currently don't track normal Django views that are served through Channels' AsgiHandler. We should investigate that.

adamchainz commented 4 years ago

I've just tested with my demo channels app, and requests from AsgiHandler are working there (Django 3.0, Channels 2.4.0).