-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
gather information from async functions #1430
Comments
The toolbar currently does not support async and the collection of statistics is tightly coupled to a request. If you do end up diving into how to modify the toolbar to collect this information, we'd appreciate any conclusions or findings of yours. |
Is there any decorator function we can add around these functions and collect data required by debug-toolbar? @collect_debug_toolbar_data
def get_data():
# pure django
async def async_get_data():
return await sync_to_async(get_data, thread_sensitive=False)()
async def parallel_get_data():
return await asyncio.gather(async_get_data(), async_get_data(), async_get_data())
data = asyncio.run(parallel_get_data()) |
Currently the only API for collecting the data is done via the middleware and the methods on the panels themselves. |
maybe it's possible to wrap/runtime patch def sync_to_async(func=None, thread_sensitive=True):
if func is None:
return lambda f: SyncToAsync(f, thread_sensitive=thread_sensitive)
return SyncToAsync(func, thread_sensitive=thread_sensitive) the |
Until async views are supported can the toolbar at least be kept from erroring out on aync views? |
@michaelurban that's a good idea. Or at least log some type of message. Would you be able to write up a PR to introduce that feature? |
@tim-schilling Sorry, I don't have the time. I'm working 80+ hour weeks for the foreseeable future. |
If some queries are executed in async mode, these queries are missing in the panel. How can we collect these?
note1: I am using
django-debug-toolbar
viadjango-graphiql-debug-toolbar
note2: all queries are inside function wrapped by
sync_to_async
The same issue exists when graphql
ThreadExecutor
is used. read more about graphql executors graphql-314The text was updated successfully, but these errors were encountered: