opentelemetry_otlp

Trait WithExportConfig

Source
pub trait WithExportConfig {
    // Required methods
    fn with_endpoint<T: Into<String>>(self, endpoint: T) -> Self;
    fn with_protocol(self, protocol: Protocol) -> Self;
    fn with_timeout(self, timeout: Duration) -> Self;
    fn with_export_config(self, export_config: ExportConfig) -> Self;
}
Expand description

Expose methods to override ExportConfig.

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

§Examples

use crate::opentelemetry_otlp::WithExportConfig;
let exporter_builder = opentelemetry_otlp::SpanExporter::builder()
    .with_tonic()
    .with_endpoint("http://localhost:7201");

Required Methods§

Source

fn with_endpoint<T: Into<String>>(self, endpoint: T) -> Self

Set the address of the OTLP collector. If not set or set to empty string, the default address is used.

Source

fn with_protocol(self, protocol: Protocol) -> Self

Set the protocol to use when communicating with the collector.

Note that protocols that are not supported by exporters will be ignored. The exporter will use default protocol in this case.

§Note

All exporters in this crate only support one protocol, thus choosing the protocol is an no-op at the moment.

Source

fn with_timeout(self, timeout: Duration) -> Self

Set the timeout to the collector.

Source

fn with_export_config(self, export_config: ExportConfig) -> Self

Set export config. This will override all previous configuration.

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§