[−][src]Struct prometrics::metrics::Gauge
Gauge
is a metric that represents a single numerical value that can arbitrarily go up and down.
Cloned gauges share the same value.
Methods
impl Gauge
[src]
pub fn new(name: &str) -> Result<Self>
[src]
Makes a new Gauge
instance.
Note that it is recommended to create this via GaugeBuilder
.
pub fn metric_name(&self) -> &MetricName
[src]
Returns the name of this gauge.
pub fn help(&self) -> Option<&str>
[src]
Returns the help of this gauge.
pub fn labels(&self) -> &Labels
[src]
Returns the labels of this gauge.
pub fn labels_mut(&mut self) -> LabelsMut
[src]
Returns the mutable labels of this gauge.
pub fn timestamp(&self) -> &Timestamp
[src]
Returns the timestamp of this gauge.
pub fn timestamp_mut(&self) -> TimestampMut
[src]
Returns the mutable timestamp of this gauge.
pub fn value(&self) -> f64
[src]
Returns the value of this gauge.
pub fn increment(&self)
[src]
Increments this gauge.
pub fn add(&self, count: f64)
[src]
Adds count
to this gauge.
pub fn decrement(&self)
[src]
Decrements this gauge.
pub fn subtract(&self, count: f64)
[src]
Subtracts count
from this gauge.
pub fn set(&self, value: f64)
[src]
Sets this gauge to value
.
pub fn set_to_current_time(&self)
[src]
Sets this gauge to the current unixtime in seconds.
pub fn track_inprogress<F, T>(&self, f: F) -> T where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
Tracks in-progress processings in some piece of code/function.
Examples
use prometrics::metrics::GaugeBuilder; let mut gauge0 = GaugeBuilder::new("foo").finish().unwrap(); let gauge1 = gauge0.clone(); assert_eq!(gauge0.value(), 0.0); gauge0.track_inprogress(|| { assert_eq!(gauge1.value(), 1.0); }); assert_eq!(gauge0.value(), 0.0);
pub fn time<F, T>(&self, f: F) -> T where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
Measures the exeuction time of f
and sets this gauge to its duration in seconds.
pub fn collector(&self) -> GaugeCollector
[src]
Returns a collector for this gauge.
Trait Implementations
impl Clone for Gauge
[src]
impl Debug for Gauge
[src]
impl Display for Gauge
[src]
impl From<Gauge> for Metric
[src]
Auto Trait Implementations
impl RefUnwindSafe for Gauge
impl Send for Gauge
impl Sync for Gauge
impl Unpin for Gauge
impl UnwindSafe for Gauge
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,