-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Instrument Tokio Wakers #37
Comments
I did a rough prototype pass of this a fairly long while ago (which, I think, is probably outdated and won't work with the latest Tokio). One thing I did is add spans to the various resources' |
Yes, by instrumenting wakers and also resources (#39), we should be able to correlate these relationships and show them in the Console. |
The other way around could also work. Since a "subscriber" already needs to produce a unique span ID, it'd be useful to be able to reuse that than to have a second unique counter. The "other way" would be to save the span ID into Tokio's It does seem like a bit of annoying propagating of an extra argument through all the internal Tokio task creation code, but conditionally (so plenty of |
## Motivation In support of tokio-rs/console#37, we want to understand when a specific task's waker has been interacted with, such as when it is awoken, or if it's forgotten (not cloned), etc. ## Solution When the tracing feature is enabled, a super trait of Future (InstrumentedFuture) is implemented for Instrumented<F> that allows grabbing the task's ID (well, its span ID), and stores that in the raw task trailer. The waker vtable then emits events and includes that ID.
Done in tokio-rs/tokio#3836, opened #42 for next step. |
We want to detect a few things with regards to the Wakers related to a Task:
wake
topoll
poll
returnsPending
but theWaker
wasn't cloned.wake
was called from a different thread, or same thread.wake
is called from withinpoll
So, we'll need to instrument Tokio's wakers: emitting events for
wake
,wake_by_ref
,clone
, anddrop
. A couple notes about implementing:The text was updated successfully, but these errors were encountered: