Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for async views and ORM usage. #1819

Open
matthiask opened this issue Aug 1, 2023 · 1 comment
Open

Add test for async views and ORM usage. #1819

matthiask opened this issue Aug 1, 2023 · 1 comment

Comments

@matthiask
Copy link
Member

No description provided.

@matthiask
Copy link
Member Author

I have started digging into tracking SQL statements for a bit and I'm unsure how to proceed.

ORM queries are started inside a thread pool executor when using an ASGI server. I have no idea how we could go from the DB cursor to the view which originally caused or started the request.

Operating systems don't generally store data about where threads come from, async tasks do not generally have an accessible parent or task group. Instrumentation is currently enabled per thread, but that also doesn't work when the activation happens in a different thread (or does it? maybe the sync_to_async(..., thread_sensitive=True) thing helps us and we can just assume we're in the correct thread? But then we still don't know to which view we belong?)

(Things are complicated even more because views can kick off tasks which will produce ORM queries after the response has been returned to the client...)

salomvary added a commit to salomvary/django-debug-toolbar that referenced this issue Sep 19, 2023
salomvary added a commit to salomvary/django-debug-toolbar that referenced this issue Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ⛔️ Blocked
Development

No branches or pull requests

1 participant