Eliza Weisman 7bc225a5e9
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 <eliza@buoyant.io>
2020-06-24 12:47:33 -07:00
..
2020-01-06 11:16:15 -05:00
2019-12-20 17:03:34 -08:00
2020-04-27 12:38:00 -07:00
2020-04-27 12:38:00 -07:00