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;
}
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§
Sourcefn with_tls_config(self, tls_config: ClientTlsConfig) -> Self
Available on crate feature tls
only.
fn with_tls_config(self, tls_config: ClientTlsConfig) -> Self
tls
only.Set the TLS settings for the collector endpoint.
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.
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.