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§
Source§impl<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
.