Skip to main content

HeadSampler

Trait HeadSampler 

Source
pub trait HeadSampler {
    const ENABLED: bool = true;

    // Required method
    fn should_sample<S>(&self, span: &SpanRef<'_, S>) -> bool
       where S: for<'a> LookupSpan<'a>;
}
Expand description

A trait that allows customizing which spans are sampled.

Provided Associated Constants§

Source

const ENABLED: bool = true

Whether sampling is enabled.

This serves as a compile-time optimization to skip sampling logic when not needed.

Required Methods§

Source

fn should_sample<S>(&self, span: &SpanRef<'_, S>) -> bool
where S: for<'a> LookupSpan<'a>,

Determines whether the span and its children should be sampled.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§