Enum opentelemetry::sdk::trace::Sampler
source · pub enum Sampler {
AlwaysOn,
AlwaysOff,
ParentBased(Box<Sampler>),
TraceIdRatioBased(f64),
}
Expand description
Sampling options
Variants§
AlwaysOn
Always sample the trace
AlwaysOff
Never sample the trace
ParentBased(Box<Sampler>)
Respects the parent span’s sampling decision or delegates a delegate sampler for root spans.
TraceIdRatioBased(f64)
Sample a given fraction of traces. Fractions >= 1 will always sample. If the parent span is sampled, then it’s child spans will automatically be sampled. Fractions < 0 are treated as zero, but spans may still be sampled if their parent is.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Sampler
impl<'de> Deserialize<'de> for Sampler
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Sampler
impl PartialEq for Sampler
source§impl ShouldSample for Sampler
impl ShouldSample for Sampler
source§fn should_sample(
&self,
parent_context: Option<&Context>,
trace_id: TraceId,
name: &str,
span_kind: &SpanKind,
attributes: &[KeyValue],
links: &[Link],
instrumentation_library: &InstrumentationLibrary
) -> SamplingResult
fn should_sample( &self, parent_context: Option<&Context>, trace_id: TraceId, name: &str, span_kind: &SpanKind, attributes: &[KeyValue], links: &[Link], instrumentation_library: &InstrumentationLibrary ) -> SamplingResult
Returns the
SamplingDecision
for a Span
to be created.impl StructuralPartialEq for Sampler
Auto Trait Implementations§
impl RefUnwindSafe for Sampler
impl Send for Sampler
impl Sync for Sampler
impl Unpin for Sampler
impl UnwindSafe for Sampler
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
Mutably borrows from an owned value. Read more