You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prevent panics when used with per-layer filters (#86)
## Motivation
Currently, if the `tracing-opentelemetry` `Layer` has a per-layer filter
(in these examples, ones that allow only `>=DEBUG`) the following two
cases behave differently:
```
let root = tracing::trace_span!("root");
tracing::debug_span!(parent: &root, "child");
```
```
let root = tracing::trace_span!("root");
oot.in_scope(|| tracing::debug_span!("child"));
```
The former panics, and the latter successfully creates a single-span
trace. Note that this ONLY happens if there is another layer interested
in the `TRACE` level (otherwise, the tracing current-level-filter
fast-path filters the root spans out at their callsites).
This may seem rare, but it becomes more common when the per-layer filter
is a
[reload](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/reload/index.html)
filter, which means the parent and child spans can be differently
filtered if the filter is reloaded between their creation (example:
https://github.com/MaterializeInc/materialize/issues/15223)
## Solution
Handle this case gracefully. I also did the same in `on_follows_from`
0 commit comments