Struct prometheus_utils::IntCounterWithLabels
source · [−]pub struct IntCounterWithLabels<L: Labels> { /* private fields */ }
Expand description
A Prometheus integer counter metric, with labels described by the type L
.
The type L
must implement the Labels
trait; see the documentation for that trait
for an overview of Prometheus metric labels.
Implementations
sourceimpl<L: Labels> IntCounterWithLabels<L>
impl<L: Labels> IntCounterWithLabels<L>
sourcepub fn register_new(name: &str, help: &str) -> IntCounterWithLabels<L>
pub fn register_new(name: &str, help: &str) -> IntCounterWithLabels<L>
Construct and immediately register a new IntCounterWithLabels
instance.
sourcepub fn inc(&self, labels: &L)
pub fn inc(&self, labels: &L)
Increment the metric by 1
, using the provided labels
for the event.
sourcepub fn add(&self, v: u64, labels: &L)
pub fn add(&self, v: u64, labels: &L)
Increment the metric by v
, using the provided labels
for the event.
sourcepub fn deferred_inc<'a>(&'a self, labels: L) -> DeferredAddWithLabels<'a, L>
pub fn deferred_inc<'a>(&'a self, labels: L) -> DeferredAddWithLabels<'a, L>
Creates a guard value that will increment the metric by 1
, using the provided labels
,
once dropped.
Prior to dropping, the labels can be altered using DeferredAddWithLabels::with_labels
.
sourcepub fn deferred_add<'a>(
&'a self,
v: u64,
labels: L
) -> DeferredAddWithLabels<'a, L>
pub fn deferred_add<'a>(
&'a self,
v: u64,
labels: L
) -> DeferredAddWithLabels<'a, L>
Creates a guard value that will increment the metric by v
, using the provided labels
,
once dropped.
Prior to dropping, the labels can be altered using DeferredAddWithLabels::with_labels
.
Auto Trait Implementations
impl<L> !RefUnwindSafe for IntCounterWithLabels<L>
impl<L> Send for IntCounterWithLabels<L> where
L: Send,
impl<L> Sync for IntCounterWithLabels<L> where
L: Sync,
impl<L> Unpin for IntCounterWithLabels<L> where
L: Unpin,
impl<L> !UnwindSafe for IntCounterWithLabels<L>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more