mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
tracing: fix spawn_blocking
location fields (#5573)
In a previous PR (#4128), the `spawn.location` field on task spans was structured into 3 separate fields for the `file`, `line`, and `col`. There is a separately created span for blocking tasks which was missed. This caused tasks created with `spawn_blocking` to appear in `tokio-console` without a location, but with an additional "free form" field containing the formatted source code location. This change modifies this span to use the same format. The span creation needs to be separate from the other task spans because it records the function name. This information is useful in the `spawn_blocking` case, but can be "catastrophically long" in the `async fn` case and was removed in #3074.
This commit is contained in:
parent
a7bb054414
commit
35dd635630
@ -371,7 +371,9 @@ impl Spawner {
|
||||
task.name = %name.unwrap_or_default(),
|
||||
task.id = id.as_u64(),
|
||||
"fn" = %std::any::type_name::<F>(),
|
||||
spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()),
|
||||
loc.file = location.file(),
|
||||
loc.line = location.line(),
|
||||
loc.col = location.column(),
|
||||
);
|
||||
fut.instrument(span)
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user