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
Coroutine-safe Spans #12589
Coroutine-safe Spans #12589
Conversation
asyncio_mod = get_asyncio_module(show_progress=show_progress) | ||
semaphore = asyncio.Semaphore(workers) | ||
|
||
@dispatcher.async_span_with_parent_id(parent_id=parent_span_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically, anything span that spawns many jobs should use this decorator right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes with async
that's right. The outer function to this should be decorated and we can extract the parent_id
.
In fact, to be safe, we should use run_jobs()
whenever we want to instrument the "simultaneous" execution of async tasks.
* add async task stack * just use asyncio.current_task * wip * delay asyncio Lock assignment in dispatcher * fix async unit tests
Description
spans
async.gather()
we should now use ourasync_utils
as that is decorated withdispatcher.span
and its nested (semaphore bounded) worker function is also decorated with the correctparent_id
.asyncio.Lock()
not being lazily constructed and thus breaks for jobs that don't have an async event loop.Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration