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_env(self) -> 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§
sourcefn with_endpoint<T: Into<String>>(self, endpoint: T) -> Self
fn with_endpoint<T: Into<String>>(self, endpoint: T) -> Self
Set the address of the OTLP collector. If not set, the default address is used.
sourcefn with_protocol(self, protocol: Protocol) -> Self
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.
sourcefn with_timeout(self, timeout: Duration) -> Self
fn with_timeout(self, timeout: Duration) -> Self
Set the timeout to the collector.
sourcefn with_env(self) -> Self
fn with_env(self) -> Self
Set the trace provider configuration from the given environment variables.
If the value in environment variables is illegal, will fall back to use default value.
sourcefn with_export_config(self, export_config: ExportConfig) -> Self
fn with_export_config(self, export_config: ExportConfig) -> Self
Set export config. This will override all previous configuration.