pub trait SamplingData {
type TraceId: TraceIdLike;
type Properties<'a>: SpanProperties
where Self: 'a;
// Required methods
fn is_parent_sampled(&self) -> Option<bool>;
fn trace_id(&self) -> &Self::TraceId;
fn with_span_properties<S, T, F>(&self, s: &S, f: F) -> T
where F: Fn(&S, &Self::Properties<'_>) -> T;
}Expand description
A trait for accessing sampling data, combining trace ID and span properties.
This trait provides unified access to both the trace ID and span properties needed for making sampling decisions.
Required Associated Types§
Sourcetype TraceId: TraceIdLike
type TraceId: TraceIdLike
The type that implements TraceIdLike.
Sourcetype Properties<'a>: SpanProperties
where
Self: 'a
type Properties<'a>: SpanProperties where Self: 'a
The type that implements SpanProperties.
Required Methods§
Sourcefn is_parent_sampled(&self) -> Option<bool>
fn is_parent_sampled(&self) -> Option<bool>
Returns whether the parent span was sampled.
Returns:
Some(true)if the parent span was sampledSome(false)if the parent span was not sampledNoneif there is no parent sampling information
Sourcefn with_span_properties<S, T, F>(&self, s: &S, f: F) -> T
fn with_span_properties<S, T, F>(&self, s: &S, f: F) -> T
Returns the span properties via a callback.
This method constructs the span properties and passes them to the provided callback function. The properties are only valid for the duration of the callback.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".