pub struct SampledStat { /* private fields */ }Expand description
A SampledStat records a single scalar value measured over one or more
samples. Each sample is recorded over a configurable window. The window can
be defined by number of events or elapsed time (or both, if both are given
the window is complete when either the event count or elapsed time
criterion is met).
All the samples are combined to produce the measurement. When a window is complete the oldest sample is cleared and recycled to begin recording the next sample.
The mutable sample ring + cursor are guarded by a single Mutex mirroring
Java’s sensor synchronized. This lock is taken per-fetch / per-partition,
never per-record on the hot path (CLAUDE.md §13/§27).
Implementations§
Source§impl SampledStat
impl SampledStat
Sourcepub fn new(initial_value: f64, kind: Box<dyn SampledStatKind>) -> Self
pub fn new(initial_value: f64, kind: Box<dyn SampledStatKind>) -> Self
Create a SampledStat with the given initial value and per-subclass
behaviour.
Trait Implementations§
Source§impl Measurable for SampledStat
impl Measurable for SampledStat
Auto Trait Implementations§
impl !Freeze for SampledStat
impl !RefUnwindSafe for SampledStat
impl Send for SampledStat
impl Sync for SampledStat
impl Unpin for SampledStat
impl UnsafeUnpin for SampledStat
impl !UnwindSafe for SampledStat
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