Skip to main content

SpanExporterBuilder

Struct SpanExporterBuilder 

Source
pub struct SpanExporterBuilder { /* private fields */ }
Available on crate feature tracing only.
Expand description

Fluent builder for SpanExporter.

Implementations§

Source§

impl SpanExporterBuilder

Source

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 else
  • OTEL_EXPORTER_OTLP_ENDPOINT with /v1/traces appended;
  • OTEL_SERVICE_NAME: the resource’s service.name;
  • OTEL_EXPORTER_OTLP_TRACES_HEADERS, or else OTEL_EXPORTER_OTLP_HEADERS: key=value pairs separated by commas (not percent-decoded).
Source

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.

Source

pub fn service_name(self, name: impl Into<String>) -> Self

The resource’s service.name; default unknown_service.

Source

pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self

A request header, such as an auth token for the collector.

Source

pub fn timeout_secs(self, secs: u64) -> Self

Per-request timeout in seconds; default 10.

Source

pub fn max_retries(self, n: u32) -> Self

Retries after a 5xx, 429 or transport error; default 3.

Source

pub fn max_batch(self, n: usize) -> Self

Spans per request; default 512 (at least 1).

Source

pub fn queue_capacity(self, n: usize) -> Self

Spans the queue holds before it drops; default 2048 (at least 1).

Source

pub const fn flush_interval(self, interval: Duration) -> Self

Longest a span waits before its batch is posted; default 5 s.

Source

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.

Trait Implementations§

Source§

impl Clone for SpanExporterBuilder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpanExporterBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SpanExporterBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.