Feature Request
Crates
tracing-subscriber
Motivation
I'm using tracing as sort of a fancy log at the moment, using events but not really using spans. I'd like to see the Tokio task ID on events, where applicable, which can help correlate between events.
Proposal
Would you be open to an implementation similar to the current thread IDs (as added in #818)? When formatting the message, we could call tokio::task::try_id. This would be disabled by default, of course.
Since this function is defined in tokio and gated by feature rt, I think we'd need to add tokio with rt as an optional dependency to tracing-subscriber.
Alternatives
Maybe I'm supposed to use spans to solve this problem in a different way. I think spans make more sense when you have infrastructure set up to consume them and present them in a useful way, but I might be wrong about that.
I don't see a way to get a Tokio task's name, but if that's ever exposed then that would be another thing to include, similar to thread name.
An alternative approach would be to allow whatever sets up the formatter to pass in extra fields or pass in a function that returns the task ID/name.
Feature Request
Crates
tracing-subscriberMotivation
I'm using
tracingas sort of a fancylogat the moment, using events but not really using spans. I'd like to see the Tokio task ID on events, where applicable, which can help correlate between events.Proposal
Would you be open to an implementation similar to the current thread IDs (as added in #818)? When formatting the message, we could call
tokio::task::try_id. This would be disabled by default, of course.Since this function is defined in
tokioand gated by featurert, I think we'd need to addtokiowithrtas an optional dependency totracing-subscriber.Alternatives
Maybe I'm supposed to use spans to solve this problem in a different way. I think spans make more sense when you have infrastructure set up to consume them and present them in a useful way, but I might be wrong about that.
I don't see a way to get a Tokio task's name, but if that's ever exposed then that would be another thing to include, similar to thread name.
An alternative approach would be to allow whatever sets up the formatter to pass in extra fields or pass in a function that returns the task ID/name.