pub struct LabeledSampledTimer<L: LabelEnum> { /* private fields */ }Expand description
Label-indexed sampled timer with O(1) lookup.
Implementations§
Source§impl<L: LabelEnum> LabeledSampledTimer<L>
impl<L: LabelEnum> LabeledSampledTimer<L>
Sourcepub fn new(bounds_nanos: &[u64], shard_count: usize, sample_stride: u64) -> Self
pub fn new(bounds_nanos: &[u64], shard_count: usize, sample_stride: u64) -> Self
Create a labeled sampled timer with custom histogram bounds in nanoseconds.
Sourcepub fn with_latency_buckets(shard_count: usize, sample_stride: u64) -> Self
pub fn with_latency_buckets(shard_count: usize, sample_stride: u64) -> Self
Create a labeled sampled timer with default latency buckets in nanoseconds.
Sourcepub fn start(&self, label: L) -> SampledTimerGuard<'_>
pub fn start(&self, label: L) -> SampledTimerGuard<'_>
Start timing one labeled operation.
Sourcepub fn record_elapsed(&self, label: L, elapsed: Duration)
pub fn record_elapsed(&self, label: L, elapsed: Duration)
Record an already-measured duration for the given label if it should be sampled.
Sourcepub fn sample_count(&self, label: L) -> u64
pub fn sample_count(&self, label: L) -> u64
Number of latency samples recorded for a label.
Sourcepub fn sample_sum_nanos(&self, label: L) -> u64
pub fn sample_sum_nanos(&self, label: L) -> u64
Sum of sampled latency values in nanoseconds for a label.
Sourcepub fn avg_sample_nanos(&self, label: L) -> Option<f64>
pub fn avg_sample_nanos(&self, label: L) -> Option<f64>
Average sampled latency in nanoseconds for a label.
Sourcepub fn calls_metric(&self, label: L) -> &Counter
pub fn calls_metric(&self, label: L) -> &Counter
Access the underlying call counter for a label.
Trait Implementations§
Source§impl<L: LabelEnum> DogStatsDExport for LabeledSampledTimer<L>
impl<L: LabelEnum> DogStatsDExport for LabeledSampledTimer<L>
Source§impl<L: LabelEnum> OtlpExport for LabeledSampledTimer<L>
impl<L: LabelEnum> OtlpExport for LabeledSampledTimer<L>
Source§impl<L: LabelEnum> PrometheusExport for LabeledSampledTimer<L>
impl<L: LabelEnum> PrometheusExport for LabeledSampledTimer<L>
Auto Trait Implementations§
impl<L> Freeze for LabeledSampledTimer<L>
impl<L> RefUnwindSafe for LabeledSampledTimer<L>where
L: RefUnwindSafe,
impl<L> Send for LabeledSampledTimer<L>where
L: Send,
impl<L> Sync for LabeledSampledTimer<L>where
L: Sync,
impl<L> Unpin for LabeledSampledTimer<L>where
L: Unpin,
impl<L> UnsafeUnpin for LabeledSampledTimer<L>
impl<L> UnwindSafe for LabeledSampledTimer<L>where
L: UnwindSafe,
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> 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