Skip to content

Commit

Permalink
tracing: use structured location fields for spawned tasks (#4128)
Browse files Browse the repository at this point in the history
This change enables `tokio-console` to parse the location information
for a spawned task into a structured object rather than simply displaying
this info as a field on the task.

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
  • Loading branch information
zaharidichev committed Sep 22, 2021
1 parent cdc46a9 commit b9b59e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tokio/src/util/trace.rs
Expand Up @@ -14,7 +14,9 @@ cfg_trace! {
"runtime.spawn",
%kind,
task.name = %name.unwrap_or_default(),
spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()),
loc.file = location.file(),
loc.line = location.line(),
loc.col = location.column(),
);
#[cfg(not(tokio_track_caller))]
let span = tracing::trace_span!(
Expand Down

0 comments on commit b9b59e4

Please sign in to comment.