-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
meta: Task Builder stabilization #4114
Comments
I might be missing something, but I don't see yet how to access the When using std::thread::Builder, one can access the name via join_handle.thread().name(), but I don't see any equivalent in tokio's JoinHandle. use case: This would be useful for me in order to log task name when acquiring a |
Currently, the name is only accessible via the tracing traces that Tokio emits when you enable the unstable tracing feature. |
yes, the name is dropped here and I find that unfortunate. And even if I don't see why The alternative for an app wanting to keep track of named tasks is to do it themselves at each call to spawn(), eg with a struct that contains a name and a JoinHandle. This is a viable workaround, but is much less convenient eg to access within the spawned thread, and if I were moving code that already uses Maybe this should be opened as a new issue? Anyway it seems (to me) like something that should be addressed before the Builder feature is stabilized. |
The reason it's gated behind the tracing feature is that the feature was added for that specific purpose. Still, I agree that it would be reasonable to expand this and stabilize it for other use-cases. |
This is to track the currently unstable
tokio::task::Builder
API. To use it, you must pass--cfg tokio_unstable
torustc
.RFC: https://hackmd.io/Vm0UXvrNTg6HleGlD8C8sg
PR: #3881
Roadmap
Open questions
tracing
span?tracing
is at 1.0, we could allow passingBuilder::span
directly.tracing
, we could use some imaginaryBuilder::tag(name, value)
that usesSpan::record
internally.The text was updated successfully, but these errors were encountered: