pub struct LayerBuilder { /* private fields */ }Expand description
Tracing subscriber layer API.
Tracing subscriber layer API.
Tracing subscriber layer API.
Builder for Layer.
Implementations§
Source§impl LayerBuilder
impl LayerBuilder
Sourcepub fn endpoint(self, endpoint: Url) -> Self
pub fn endpoint(self, endpoint: Url) -> Self
Sets the OTLP/gRPC endpoint, for example http://127.0.0.1:4317.
Sourcepub fn token(self, token: SecretString) -> Self
pub fn token(self, token: SecretString) -> Self
Sets the bearer token sent to the observability server.
Sourcepub fn source(self, source: SourceId) -> Self
pub fn source(self, source: SourceId) -> Self
Sets the source identity attached to every exported batch.
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Sets the maximum records per export request.
Sourcepub fn flush_interval(self, flush_interval: Duration) -> Self
pub fn flush_interval(self, flush_interval: Duration) -> Self
Sets the periodic flush interval.
Sourcepub fn flush_timeout(self, flush_timeout: Duration) -> Self
pub fn flush_timeout(self, flush_timeout: Duration) -> Self
Sets the timeout for each export or replay attempt, including requested flushes.
Sourcepub fn queue_dir(self, queue_dir: PathBuf) -> Self
pub fn queue_dir(self, queue_dir: PathBuf) -> Self
Sets the directory used for offline protobuf log batches.
Sourcepub fn sample_rate(self, sample_rate: f64) -> Self
pub fn sample_rate(self, sample_rate: f64) -> Self
Sets a deterministic sample rate in the inclusive range 0.0..=1.0.
Sourcepub fn compression(self, encoding: CompressionEncoding) -> Self
pub fn compression(self, encoding: CompressionEncoding) -> Self
Compresses exported gRPC messages with gzip or zstd.
Requests are uncompressed by default for compatibility with older receivers.
Sourcepub fn tls_config(self, config: ClientTlsConfig) -> Self
pub fn tls_config(self, config: ClientTlsConfig) -> Self
Sets HTTPS transport options, including custom CA roots and mutual TLS.
HTTPS endpoints use system trust roots by default. A custom configuration can add a private CA, override the expected domain, or supply a client identity.
Sourcepub fn build(self) -> Result<Layer, LayerError>
pub fn build(self) -> Result<Layer, LayerError>
Builds the layer and spawns its background exporter on the current Tokio runtime.
§Errors
Returns LayerError::MissingEndpoint, LayerError::MissingToken,
LayerError::MissingSource, or LayerError::MissingQueueDir if the
corresponding builder field was not set.
Trait Implementations§
Source§impl Clone for LayerBuilder
impl Clone for LayerBuilder
Source§impl Debug for LayerBuilder
impl Debug for LayerBuilder
Auto Trait Implementations§
impl Freeze for LayerBuilder
impl RefUnwindSafe for LayerBuilder
impl Send for LayerBuilder
impl Sync for LayerBuilder
impl Unpin for LayerBuilder
impl UnsafeUnpin for LayerBuilder
impl UnwindSafe for LayerBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request