pub struct OtlpExporterBuilder { /* private fields */ }Expand description
Fluent builder for OtlpExporter.
Implementations§
Source§impl OtlpExporterBuilder
impl OtlpExporterBuilder
Sourcepub fn endpoint(self, url: impl Into<String>) -> Self
pub fn endpoint(self, url: impl Into<String>) -> Self
Set the collector endpoint URL. The default is
DEFAULT_ENDPOINT, a Collector on this host. Use http://:
this transport has no TLS.
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
Set a custom request header. Call repeatedly for multiple headers (auth tokens, dataset identifiers, etc.).
Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set the per-request timeout in seconds. Default is 10 s.
Sourcepub const fn max_retries(self, n: u32) -> Self
pub const fn max_retries(self, n: u32) -> Self
Maximum number of retry attempts after a 5xx / 429 response or transport error. Default is 3 (so up to 4 total attempts).
Set to 0 to disable retries.
Sourcepub const fn backoff_base(self, base: Duration) -> Self
pub const fn backoff_base(self, base: Duration) -> Self
Base for the exponential backoff between retries.
delay = base * 2^attempt, capped at 30 s and modulated by
full jitter. Default base is 200 ms, which gives a
[0, 200 ms] / [0, 400 ms] / [0, 800 ms] schedule under
the default 3 retries.
Sourcepub fn circuit(self, cb: Arc<CircuitBreaker>) -> Self
pub fn circuit(self, cb: Arc<CircuitBreaker>) -> Self
Attach a circuit breaker. When set, every export consults the
breaker before touching the network; a tripped breaker
rejects immediately with OtlpError::CircuitOpen.
Cloning the returned exporter shares the same breaker state
across clones (the field is Arc<CircuitBreaker>).
Sourcepub fn build(self) -> OtlpExporter
pub fn build(self) -> OtlpExporter
Finalise the builder.