Skip to main content

span_layer_with_provider

Function span_layer_with_provider 

Source
pub fn span_layer_with_provider<S>(
    otlp_config: OtlpConfig,
) -> Result<(OpenTelemetryLayer<S, SdkTracer>, SdkTracerProvider)>
where for<'span> S: Subscriber + LookupSpan<'span>,
Expand description

Creates an OTLP span layer and returns its provider for explicit flush and shutdown.

Unlike span_layer, this does not install the provider globally. Call SdkTracerProvider::force_flush to export completed spans and SdkTracerProvider::shutdown after dropping active spans and the subscriber. File export uses the SDK batch worker and does not require a Tokio runtime. Network transports retain their usual runtime requirements.