Struct metrics_prometheus::storage::Mutable
source · pub struct Mutable { /* private fields */ }
Expand description
metrics::registry::Storage
backed by a prometheus::Registry
and
allowing to change a help
description of the registered prometheus
metrics in runtime.
This metrics::registry::Storage
is capable of registering metrics in its
prometheus::Registry
on the fly. By default, the
prometheus::default_registry()
is used.
Errors
This mutable Storage
returns metric::Fallible
in its
metrics::registry::Storage
interface, because it cannot panic, as is
called inside metrics::Registry
and, so, may poison its inner locks.
That’s why possible errors are passed through, up to the
metrics::Recorder
using this Storage
, and should be resolved there.
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
.
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 register_external<M>(&self, metric: M) -> Result<()>
pub fn register_external<M>(&self, metric: M) -> Result<()>
Registers the provided prometheus
metric
in the underlying
prometheus::Registry
in the way making it usable via this
metrics::registry::Storage
(and, so, metrics
crate interfaces).
Accepts only the following prometheus
metrics:
prometheus::IntCounter
,prometheus::IntCounterVec
prometheus::Gauge
,prometheus::GaugeVec
prometheus::Histogram
,prometheus::HistogramVec
Errors
If the underlying prometheus::Registry
fails to register the
provided metric
.
Trait Implementations§
source§impl Get<Arc<RwLock<HashMap<String, Describable<Option<Either<GenericCounter<AtomicU64>, MetricVec<CounterVecBuilder<AtomicU64>>>>>>>>> for Storage
impl Get<Arc<RwLock<HashMap<String, Describable<Option<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<Arc<RwLock<HashMap<String, Describable<Option<Either<GenericGauge<AtomicF64>, MetricVec<GaugeVecBuilder<AtomicF64>>>>>>>>> for Storage
impl Get<Arc<RwLock<HashMap<String, Describable<Option<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<Arc<RwLock<HashMap<String, Describable<Option<Either<Histogram, MetricVec<HistogramVecBuilder>>>>>>>> for Storage
impl Get<Arc<RwLock<HashMap<String, Describable<Option<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.