pub struct OtlpConfig {
pub endpoint: String,
pub protocol: OtlpProtocol,
pub sample_ratio: f64,
pub service_name: String,
pub service_version: String,
pub service_instance_id: String,
pub timeout: Time,
pub heartbeat_interval: Option<Time>,
}Expand description
Resolved OTLP configuration.
OtlpConfig::from_env builds this configuration. Ok(None) from that
constructor means that OTLP is disabled and that this crate builds no
exporter.
Fields§
§endpoint: String§protocol: OtlpProtocol§sample_ratio: f64Head sampling ratio in [0.0, 1.0]. A parent-based sampler wraps this
ratio, so child spans keep an upstream sampling decision.
service_name: String§service_version: String§service_instance_id: String§timeout: Time§heartbeat_interval: Option<Time>Implementations§
Source§impl OtlpConfig
impl OtlpConfig
Sourcepub fn from_env(
get: impl Fn(&str) -> Option<String>,
service_instance_id: &str,
service_version: &str,
default_service_name: &str,
) -> Result<Option<Self>, TelemetryError>
pub fn from_env( get: impl Fn(&str) -> Option<String>, service_instance_id: &str, service_version: &str, default_service_name: &str, ) -> Result<Option<Self>, TelemetryError>
Resolve OTLP config from the environment.
get is the environment lookup. The caller injects it, so this
function is pure and easy to test. service_instance_id is the service
instance id, for example the broker node id. service_version is the
crate version. default_service_name is the fallback name for when
OTEL_SERVICE_NAME is not set.
Returns Ok(None) when OTLP is disabled. OTLP is disabled when nothing
turned it on, or when OTEL_SDK_DISABLED turned it off.
§Errors
Returns an error when a custom Krabka duration is malformed.
Trait Implementations§
Source§impl Clone for OtlpConfig
impl Clone for OtlpConfig
Source§fn clone(&self) -> OtlpConfig
fn clone(&self) -> OtlpConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OtlpConfig
impl RefUnwindSafe for OtlpConfig
impl Send for OtlpConfig
impl Sync for OtlpConfig
impl Unpin for OtlpConfig
impl UnsafeUnpin for OtlpConfig
impl UnwindSafe for OtlpConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].