Struct metrics_prometheus::storage::Immutable
source · pub struct Immutable { /* private fields */ }
Expand description
Snapshot of a mutable::Storage
, that is not capable of registering
metrics in a prometheus::Registry
on the fly, but still allowing to
change their help
description on the fly, once they were registered in
the mutable::Storage
before snapshot.
In comparison with a metrics::Registry
, this immutable Storage
provides much less overhead of accessing an already registered metric (just
a simple HashMap
lookup), however, is not capable of registering new
metrics on the fly.
Implementations§
source§impl Storage
impl Storage
sourcepub fn describe<M>(&self, name: &str, description: String)
pub fn describe<M>(&self, name: &str, description: String)
Changes the help
description of the prometheus
M
etric
identified by its name
. No-op if this immutable Storage
doesn’t
contain it.
Accepts only the following prometheus
M
etrics:
prometheus::IntCounter
,prometheus::IntCounterVec
prometheus::Gauge
,prometheus::GaugeVec
prometheus::Histogram
,prometheus::HistogramVec
Intended to be used in metrics::Recorder::describe_counter()
,
metrics::Recorder::describe_gauge()
and
metrics::Recorder::describe_histogram()
implementations.
sourcepub fn get_metric<M>(&self, key: &Key) -> Option<Result<Metric<M>, Error>>
pub fn get_metric<M>(&self, key: &Key) -> Option<Result<Metric<M>, Error>>
Returns a prometheus
M
etric stored in this immutable Storage
and identified by the provided metrics::Key
.
Accepts only the following prometheus
metrics:
Intended to be used in metrics::Recorder::register_counter()
,
metrics::Recorder::register_gauge()
and
metrics::Recorder::register_histogram()
implementations.
§Errors
If the identified prometheus
M
etric doesn’t comply with the
labeling of the provided metrics::Key
.
Trait Implementations§
source§impl Get<HashMap<String, Describable<Either<GenericCounter<AtomicU64>, MetricVec<CounterVecBuilder<AtomicU64>>>>>> for Storage
impl Get<HashMap<String, Describable<Either<GenericCounter<AtomicU64>, MetricVec<CounterVecBuilder<AtomicU64>>>>>> for Storage
source§fn collection(&self) -> &Collection<PrometheusIntCounter>
fn collection(&self) -> &Collection<PrometheusIntCounter>
Collection
of metric::Bundle
s stored in this storage.source§impl Get<HashMap<String, Describable<Either<GenericGauge<AtomicF64>, MetricVec<GaugeVecBuilder<AtomicF64>>>>>> for Storage
impl Get<HashMap<String, Describable<Either<GenericGauge<AtomicF64>, MetricVec<GaugeVecBuilder<AtomicF64>>>>>> for Storage
source§fn collection(&self) -> &Collection<PrometheusGauge>
fn collection(&self) -> &Collection<PrometheusGauge>
Collection
of metric::Bundle
s stored in this storage.source§impl Get<HashMap<String, Describable<Either<Histogram, MetricVec<HistogramVecBuilder>>>>> for Storage
impl Get<HashMap<String, Describable<Either<Histogram, MetricVec<HistogramVecBuilder>>>>> for Storage
source§fn collection(&self) -> &Collection<PrometheusHistogram>
fn collection(&self) -> &Collection<PrometheusHistogram>
Collection
of metric::Bundle
s stored in this storage.