pub type LabelGuardedUintGaugeVec<const N: usize> = LabelGuardedMetricVec<VecBuilderOfGauge<AtomicU64>, N>;
Aliased Type§
struct LabelGuardedUintGaugeVec<const N: usize> {
inner: MetricVec<impl MetricVecBuilder<M = GenericGauge<AtomicU64>>>,
info: Arc<Mutex<RawMutex, LabelGuardedMetricsInfo<N>>>,
labels: [&'static str; N],
}
Fields§
§inner: MetricVec<impl MetricVecBuilder<M = GenericGauge<AtomicU64>>>
§info: Arc<Mutex<RawMutex, LabelGuardedMetricsInfo<N>>>
§labels: [&'static str; N]
Implementations
Source§impl<T: MetricVecBuilder, const N: usize> LabelGuardedMetricVec<T, N>
impl<T: MetricVecBuilder, const N: usize> LabelGuardedMetricVec<T, N>
pub fn new(inner: MetricVec<T>, labels: &[&'static str; N]) -> Self
Sourcepub fn with_guarded_label_values(
&self,
labels: &[&str; N],
) -> LabelGuardedMetric<T::M, N>
pub fn with_guarded_label_values( &self, labels: &[&str; N], ) -> LabelGuardedMetric<T::M, N>
This is similar to the with_label_values
of the raw metrics vec.
We need to pay special attention that, unless for some special purpose,
we should not drop the returned LabelGuardedMetric
immediately after
using it, such as metrics.with_guarded_label_values(...).inc();
,
because after dropped the label will be regarded as not used any more,
and the internal raw metrics will be removed and reset.
Instead, we should store the returned LabelGuardedMetric
in a scope with longer
lifetime so that the labels can be regarded as being used in its whole life scope.
This is also the recommended way to use the raw metrics vec.
pub fn with_test_label(&self) -> LabelGuardedMetric<T::M, N>
Source§impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = GenericCounter<AtomicU64>>, N>
impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = GenericCounter<AtomicU64>>, N>
pub fn test_int_counter_vec() -> Self
Source§impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = GenericGauge<AtomicF64>>, N>
impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = GenericGauge<AtomicF64>>, N>
pub fn test_gauge_vec() -> Self
Source§impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = GenericGauge<AtomicI64>>, N>
impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = GenericGauge<AtomicI64>>, N>
pub fn test_int_gauge_vec() -> Self
Source§impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = Histogram>, N>
impl<const N: usize> LabelGuardedMetricVec<impl MetricVecBuilder<M = Histogram>, N>
pub fn test_histogram_vec() -> Self
Trait Implementations
Source§impl<T: Clone + MetricVecBuilder, const N: usize> Clone for LabelGuardedMetricVec<T, N>
impl<T: Clone + MetricVecBuilder, const N: usize> Clone for LabelGuardedMetricVec<T, N>
Source§fn clone(&self) -> LabelGuardedMetricVec<T, N>
fn clone(&self) -> LabelGuardedMetricVec<T, N>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more