Skip to main content

try_build_otel_layer

Function try_build_otel_layer 

Source
pub fn try_build_otel_layer() -> Option<OpenTelemetryLayer<Registry, Tracer>>
Expand description

Attempt to build an OpenTelemetry tracing layer, returning None on error.

Reads JAEGER_ENDPOINT (e.g. http://localhost:4318) or OTEL_EXPORTER_OTLP_ENDPOINT. When neither is set, or when the exporter fails to build, this function returns None so startup is never blocked by observability infrastructure.

NOTE: This function must be called after the Tokio runtime has been started because the batch exporter uses rt-tokio.

ยงPanics

This function never panics.