pub trait WithTonicConfig {
// Required methods
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;
}
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§
sourcefn with_metadata(self, metadata: MetadataMap) -> Self
fn with_metadata(self, metadata: MetadataMap) -> Self
Set custom metadata entries to send to the collector.
sourcefn with_compression(self, compression: Compression) -> Self
fn with_compression(self, compression: Compression) -> Self
Set the compression algorithm to use when communicating with the collector.
sourcefn with_channel(self, channel: Channel) -> Self
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.
sourcefn with_interceptor<I>(self, interceptor: I) -> Self
fn with_interceptor<I>(self, interceptor: I) -> Self
Use a custom interceptor
to modify each outbound request.
this can be used to modify the grpc metadata, for example
to inject auth tokens.
Object Safety§
This trait is not object safe.