pub struct SamplingRule { /* private fields */ }Expand description
Represents a sampling rule with criteria for matching spans
Implementations§
Source§impl SamplingRule
impl SamplingRule
Sourcepub fn from_configs(configs: Vec<SamplingRuleConfig>) -> Vec<Self>
pub fn from_configs(configs: Vec<SamplingRuleConfig>) -> Vec<Self>
Converts a vector of SamplingRuleConfig into SamplingRule objects Centralizes the conversion logic
Sourcepub fn new(
sample_rate: f64,
service: Option<String>,
name: Option<String>,
resource: Option<String>,
tags: Option<HashMap<String, String>>,
provenance: Option<String>,
) -> Self
pub fn new( sample_rate: f64, service: Option<String>, name: Option<String>, resource: Option<String>, tags: Option<HashMap<String, String>>, provenance: Option<String>, ) -> Self
Creates a new sampling rule
Sourcepub fn sample(&self, trace_id: &impl TraceIdLike) -> bool
pub fn sample(&self, trace_id: &impl TraceIdLike) -> bool
Samples a trace ID using this rule’s sample rate
Trait Implementations§
Source§impl Clone for SamplingRule
impl Clone for SamplingRule
Source§fn clone(&self) -> SamplingRule
fn clone(&self) -> SamplingRule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SamplingRule
impl RefUnwindSafe for SamplingRule
impl Send for SamplingRule
impl Sync for SamplingRule
impl Unpin for SamplingRule
impl UnsafeUnpin for SamplingRule
impl UnwindSafe for SamplingRule
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