opentelemetry_otlp

Trait WithTonicConfig

Source
pub trait WithTonicConfig {
    // Required methods
    fn with_tls_config(self, tls_config: ClientTlsConfig) -> Self;
    fn with_metadata(self, metadata: MetadataMap) -> Self;
    fn with_compression(self, compression: Compression) -> Self;
    fn with_channel(self, channel: Channel) -> Self;
    fn with_interceptor<I>(self, interceptor: I) -> Self
       where I: Interceptor + Clone + Send + Sync + 'static;
}
Available on crate feature grpc-tonic only.
Expand description

Expose methods to override TonicConfig.

This trait will be implemented for every struct that implemented HasTonicConfig trait.

§Examples

use crate::opentelemetry_otlp::{WithExportConfig, WithTonicConfig};
let exporter_builder = opentelemetry_otlp::SpanExporter::builder()
    .with_tonic()
    .with_compression(opentelemetry_otlp::Compression::Gzip);

Required Methods§

Source

fn with_tls_config(self, tls_config: ClientTlsConfig) -> Self

Available on crate feature tls only.

Set the TLS settings for the collector endpoint.

Source

fn with_metadata(self, metadata: MetadataMap) -> Self

Set custom metadata entries to send to the collector.

Source

fn with_compression(self, compression: Compression) -> Self

Set the compression algorithm to use when communicating with the collector.

Source

fn with_channel(self, channel: Channel) -> Self

Use channel as tonic’s transport channel. this will override tls config and should only be used when working with non-HTTP transports.

Users MUST make sure the ExportConfig::timeout is the same as the channel’s timeout.

Source

fn with_interceptor<I>(self, interceptor: I) -> Self
where I: Interceptor + Clone + Send + Sync + 'static,

Use a custom interceptor to modify each outbound request. this can be used to modify the grpc metadata, for example to inject auth tokens.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§