pub struct TraceSampler { /* private fields */ }Expand description
追踪采样器
Implementations§
Source§impl TraceSampler
impl TraceSampler
Sourcepub fn new(strategy: SamplingStrategy) -> Self
pub fn new(strategy: SamplingStrategy) -> Self
创建新的采样器
Sourcepub fn always_off() -> Self
pub fn always_off() -> Self
创建从不采样的采样器
Sourcepub fn probability(rate: f64) -> Self
pub fn probability(rate: f64) -> Self
创建概率采样器
Sourcepub fn trace_id_ratio(ratio: f64) -> Self
pub fn trace_id_ratio(ratio: f64) -> Self
创建基于 trace ID 的采样器
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
添加采样属性
Sourcepub fn should_sample(
&self,
trace_id: &TraceId,
name: &str,
parent_sampled: Option<bool>,
) -> (SamplingDecision, HashMap<String, String>)
pub fn should_sample( &self, trace_id: &TraceId, name: &str, parent_sampled: Option<bool>, ) -> (SamplingDecision, HashMap<String, String>)
做出采样决策
Trait Implementations§
Source§impl Clone for TraceSampler
impl Clone for TraceSampler
Source§fn clone(&self) -> TraceSampler
fn clone(&self) -> TraceSampler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TraceSampler
impl Debug for TraceSampler
Auto Trait Implementations§
impl Freeze for TraceSampler
impl !RefUnwindSafe for TraceSampler
impl Send for TraceSampler
impl Sync for TraceSampler
impl Unpin for TraceSampler
impl !UnwindSafe for TraceSampler
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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