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 async fn match_rules<'b, I, G>(
self,
seed: Uuid,
instance: &G,
rules: I,
) -> ControlFlow<SamplingMatch, Self>
pub async 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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request