Enum metrics_util::Handle [−][src]
pub enum Handle { Counter(Arc<AtomicU64>), Gauge(Arc<AtomicU64>), Histogram(Arc<AtomicBucket<f64>>), }
Basic metric handle.
Provides fast, thread-safe access and storage for the three supported metric types: counters, gauges, and histograms.
Variants
A counter.
A gauge.
Histogram(Arc<AtomicBucket<f64>>)
A histogram.
Implementations
impl Handle
[src]
impl Handle
[src]pub fn counter() -> Handle
[src]
Creates a counter handle.
The counter is initialized to 0.
pub fn gauge() -> Handle
[src]
Creates a gauge handle.
The gauge is initialized to 0.
pub fn histogram() -> Handle
[src]
Creates a histogram handle.
The histogram handle is initialized to empty.
pub fn increment_counter(&self, value: u64)
[src]
Increments this handle as a counter.
Panics if this handle is not a counter.
pub fn update_gauge(&self, value: GaugeValue)
[src]
Updates this handle as a gauge.
Panics if this handle is not a gauge.
pub fn record_histogram(&self, value: f64)
[src]
Records to this handle as a histogram.
Panics if this handle is not a histogram.
pub fn read_counter(&self) -> u64
[src]
Reads this handle as a counter.
Panics if this handle is not a counter.
pub fn read_gauge(&self) -> f64
[src]
Reads this handle as a gauge.
Panics if this handle is not a gauge.
pub fn read_histogram(&self) -> Vec<f64>
[src]
Reads this handle as a histogram.
Panics if this handle is not a histogram.
pub fn read_histogram_is_empty(&self) -> bool
[src]
Reads this handle as a histogram, and whether or not it’s empty.
Panics if this handle is not a histogram.
pub fn read_histogram_with_clear<F>(&self, f: F) where
F: FnMut(&[f64]),
[src]
F: FnMut(&[f64]),
Reads this handle as a histogram incrementally into a closure, and clears the histogram.
The closure f
passed in is invoked multiple times with slices of values present in the
histogram currently. Once all values have been read, the histogram is cleared of all values.
Panics if this handle is not a histogram.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Handle
impl !RefUnwindSafe for Handle
impl !UnwindSafe for Handle
impl !UnwindSafe for Handle