mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00

## Motivation Currently, the default formatter implementations in `tracing-subscriber`'s `fmt` module do not handle explicitly set parent spans for events, such as ```rust let span = tracing::info_span!("some_interesting_span"); tracing::info!(parent: &span, "something is happening!"); ``` Instead, when formatting the span context of an event, the context is _always_ generated from the current span, even when the event has an overridden parent. This is not correct. ## Solution This branch changes the default context formatters to use the explicit parent ID, if it is present. Otherwise, the contexual parent is used, as it was previously. I've also added tests ensuring that this works correctly, and removed some workarounds for the previous incorrect behavior from the examples. Fixes #766 Signed-off-by: Eliza Weisman <eliza@buoyant.io>