Struct relay_sampling::evaluation::SamplingEvaluator
source · pub struct SamplingEvaluator<'a> { /* private fields */ }
Expand description
State machine for dynamic sampling.
Implementations§
source§impl<'a> SamplingEvaluator<'a>
impl<'a> SamplingEvaluator<'a>
sourcepub fn new_with_reservoir(
now: DateTime<Utc>,
reservoir: &'a ReservoirEvaluator<'a>,
) -> Self
pub fn new_with_reservoir( now: DateTime<Utc>, reservoir: &'a ReservoirEvaluator<'a>, ) -> Self
Constructs an evaluator with reservoir sampling.
sourcepub fn match_rules<'b, I, G>(
self,
seed: Uuid,
instance: &G,
rules: I,
) -> ControlFlow<SamplingMatch, Self>
pub fn match_rules<'b, I, G>( self, seed: Uuid, instance: &G, rules: I, ) -> ControlFlow<SamplingMatch, Self>
Attempts to find a match for sampling rules using ControlFlow
.
This function returns a ControlFlow
to provide control over the matching process.
-
ControlFlow::Continue
: Indicates that matching is incomplete, and more rules can be evaluated.- This state occurs either if no active rules match the provided data, or if the matched rules are factors requiring a final sampling value.
- The returned evaluator contains the state of the matched rules and the accumulated sampling factor.
- If this value is returned and there are no more rules to evaluate, it should be interpreted as “no match.”
-
ControlFlow::Break
: Indicates that one or more rules have successfully matched.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SamplingEvaluator<'a>
impl<'a> !RefUnwindSafe for SamplingEvaluator<'a>
impl<'a> Send for SamplingEvaluator<'a>
impl<'a> Sync for SamplingEvaluator<'a>
impl<'a> Unpin for SamplingEvaluator<'a>
impl<'a> !UnwindSafe for SamplingEvaluator<'a>
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