-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subscriber: handle explicit event parents properly in formatters (#767)
## 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 <[email protected]>
- Loading branch information
Showing
5 changed files
with
126 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters