Trait opentelemetry_otlp::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 export configuration.

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

§Examples

use crate::opentelemetry_otlp::WithExportConfig;
let exporter_builder = opentelemetry_otlp::new_exporter()
    .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 ignore. The exporter will use default protocol in this case.

§Note

All exporters in this crate are 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.

Object Safety§

This trait is not object safe.

Implementors§