pub fn build_tracer_layer<S>(
config: &OtelTracingConfig,
) -> Result<(OpenTelemetryLayer<S, Tracer>, SdkTracerProvider), OtelTracingError>where
S: Subscriber + for<'a> LookupSpan<'a>,Available on crate feature
otel-tracing only.Expand description
Build an OTel tracer + tracing-subscriber layer ready for composition.
Sets the resulting SdkTracerProvider as the global tracer
provider (so crate::transport::propagation picks it up). The
returned layer should be added to a tracing_subscriber::Registry.
The provider is also returned so callers can .shutdown() it on
graceful exit (otherwise the batch exporter loses queued spans).
ยงErrors
Returns OtelTracingError::ExporterBuild if the OTLP exporter
cannot be initialised (typically endpoint format / TLS setup issues).