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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more