Struct metriken::histogram::AtomicHistogram
source · pub struct AtomicHistogram { /* private fields */ }
Expand description
A histogram that uses free-running atomic counters to track the distribution
of values. They are only useful for recording values and producing
[crate::Snapshot
]s of the histogram state which can then be used for
reporting.
The AtomicHistogram
should be preferred when individual events are being
recorded. The RwLockHistogram
should be preferred when bulk-updating the
histogram from pre-aggregated data with a compatible layout.
Implementations§
source§impl AtomicHistogram
impl AtomicHistogram
sourcepub const fn new(grouping_power: u8, max_value_power: u8) -> Self
pub const fn new(grouping_power: u8, max_value_power: u8) -> Self
Create a new ::histogram::AtomicHistogram
with the given parameters.
§Panics
This will panic if the grouping_power
and max_value_power
do not
adhere to the following constraints:
max_value_power
must be in the range 1..=64grouping_power
must be in the range0..=(max_value_power - 1)
sourcepub fn increment(&self, value: u64) -> Result<(), Error>
pub fn increment(&self, value: u64) -> Result<(), Error>
Increments the bucket for a corresponding value.
pub fn config(&self) -> Config
Trait Implementations§
source§impl Metric for AtomicHistogram
impl Metric for AtomicHistogram
source§fn as_any(&self) -> Option<&dyn Any>
fn as_any(&self) -> Option<&dyn Any>
Get the current metric as an
Any
instance. This is meant to allow
custom processing for known metric types.source§fn value(&self) -> Option<Value<'_>>
fn value(&self) -> Option<Value<'_>>
Get the value of the current metric, should it be enabled. Read more
source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Indicate whether this metric has been set up. Read more
Auto Trait Implementations§
impl !Freeze for AtomicHistogram
impl RefUnwindSafe for AtomicHistogram
impl Send for AtomicHistogram
impl Sync for AtomicHistogram
impl Unpin for AtomicHistogram
impl UnwindSafe for AtomicHistogram
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