Skip to content

Commit

Permalink
tracing: use structured location fields for spawned tasks (tokio-rs#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 authored and suikammd committed Oct 7, 2021
1 parent 2f10c55 commit c8e973e
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 c8e973e

Please sign in to comment.