pub struct SpanExporterBuilder { /* private fields */ }tracing only.Expand description
Fluent builder for SpanExporter.
Implementations§
Source§impl SpanExporterBuilder
impl SpanExporterBuilder
Sourcepub fn from_lookup(lookup: impl Fn(&str) -> Option<String>) -> Option<Self>
pub fn from_lookup(lookup: impl Fn(&str) -> Option<String>) -> Option<Self>
A builder from OpenTelemetry environment variables, read
through lookup; None when no endpoint is named or
OTEL_SDK_DISABLED is true. Empty values count as unset.
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: the full URL, or elseOTEL_EXPORTER_OTLP_ENDPOINTwith/v1/tracesappended;OTEL_SERVICE_NAME: the resource’sservice.name;OTEL_EXPORTER_OTLP_TRACES_HEADERS, or elseOTEL_EXPORTER_OTLP_HEADERS:key=valuepairs separated by commas (not percent-decoded).
Sourcepub fn endpoint(self, url: impl Into<String>) -> Self
pub fn endpoint(self, url: impl Into<String>) -> Self
The collector’s traces URL; default DEFAULT_TRACES_ENDPOINT.
Use http://: this transport has no TLS.
Sourcepub fn service_name(self, name: impl Into<String>) -> Self
pub fn service_name(self, name: impl Into<String>) -> Self
The resource’s service.name; default unknown_service.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
A request header, such as an auth token for the collector.
Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Per-request timeout in seconds; default 10.
Sourcepub fn max_retries(self, n: u32) -> Self
pub fn max_retries(self, n: u32) -> Self
Retries after a 5xx, 429 or transport error; default 3.
Sourcepub fn queue_capacity(self, n: usize) -> Self
pub fn queue_capacity(self, n: usize) -> Self
Spans the queue holds before it drops; default 2048 (at least 1).
Sourcepub const fn flush_interval(self, interval: Duration) -> Self
pub const fn flush_interval(self, interval: Duration) -> Self
Longest a span waits before its batch is posted; default 5 s.
Sourcepub fn build(self) -> OtlpResult<SpanExporter>
pub fn build(self) -> OtlpResult<SpanExporter>
Validate the settings and start the export thread.
§Errors
OtlpError::InvalidEndpoint for an endpoint that is not an
http:// URL, OtlpError::InvalidHeader for an unsafe
header, OtlpError::Transport if the thread cannot start.