Skip to main content

init_otlp_pipeline_with_endpoint

Function init_otlp_pipeline_with_endpoint 

Source
pub fn init_otlp_pipeline_with_endpoint(
    service_name: Option<&str>,
    endpoint: &str,
) -> Result<SdkMeterProvider, Box<dyn Error>>
👎Deprecated since 0.16.0:

use Telemetry::builder().with_traces(false).with_logs(false).with_otlp_protocol(OtlpProtocol::Grpc).build(): it adds service.instance.id, OTEL_SDK_DISABLED, TLS, proxies and lost-export counts; the book’s Telemetry page has the migration

Available on crate feature otel only.
Expand description

init_otlp_pipeline with the collector endpoint given explicitly instead of read from OTEL_EXPORTER_OTLP_ENDPOINT.

For a process that configures its exporter from its own settings rather than the environment — and for tests, where writing the environment is unsafe in edition 2024 because another thread may be reading it.

OTEL_EXPORTER_OTLP_HEADERS and OTEL_EXPORTER_OTLP_TIMEOUT still apply. OTEL_EXPORTER_OTLP_PROTOCOL does not — the transport is gRPC and cannot be changed; see init_otlp_pipeline. An earlier revision of this comment listed protocol among the variables that still apply, which was wrong and would have sent a reader to an HTTP port expecting it to work.

§Errors

As init_otlp_pipeline.