1use tracing_subscriber::registry::{LookupSpan, SpanRef};
4
5#[cfg(feature = "sampler-probabilistic")]
6pub mod probabilistic;
7
8pub trait HeadSampler {
10 const ENABLED: bool = true;
15
16 fn should_sample<S>(&self, span: &SpanRef<S>) -> bool
18 where
19 S: for<'a> LookupSpan<'a>;
20}
21
22#[derive(Debug, Clone, Copy)]
24pub struct AlwaysSample;
25
26impl HeadSampler for AlwaysSample {
27 const ENABLED: bool = false;
28
29 #[inline]
30 fn should_sample<S>(&self, _span: &SpanRef<S>) -> bool
31 where
32 S: for<'a> LookupSpan<'a>,
33 {
34 true
35 }
36}