Skip to content

Commit f413e1e

Browse files
committed
chore: Comment on filtering in global subscriber
In the opentelemetry-otlp example, add a comment explaining how filtering should prevent reentrancy into the globally installed tracing layer from the opentelemetry stack where any dependencies might themselves use tracing.
1 parent 03e8c9a commit f413e1e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/opentelemetry-otlp.rs

+7
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ fn init_tracing_subscriber() -> OtelGuard {
116116
let tracer = tracer_provider.tracer("tracing-otel-subscriber");
117117

118118
tracing_subscriber::registry()
119+
// The global level filter prevents the exporter network stack
120+
// from reentering the globally installed OpenTelemetryLayer with
121+
// its own spans while exporting, as the libraries should not use
122+
// tracing levels below DEBUG. If the OpenTelemetry layer needs to
123+
// trace spans and events with higher verbosity levels, consider using
124+
// per-layer filtering to target the telemetry layer specifically,
125+
// e.g. by target matching.
119126
.with(tracing_subscriber::filter::LevelFilter::from_level(
120127
Level::INFO,
121128
))

0 commit comments

Comments
 (0)