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)where
M: Bundled,
<M as Bundled>::Bundle: Bundle,
Self: Get<Collection<<M as Bundled>::Bundle>>,
pub fn describe<M>(&self, name: &str, description: String)where M: Bundled, <M as Bundled>::Bundle: Bundle, Self: Get<Collection<<M as Bundled>::Bundle>>,
Changes the help description of the prometheus Metric
identified by its name. No-op if this immutable Storage doesn’t
contain it.
Accepts only the following prometheus Metrics:
prometheus::IntCounter,prometheus::IntCounterVecprometheus::Gauge,prometheus::GaugeVecprometheus::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>>where
M: Bundled,
<M as Bundled>::Bundle: Bundle<Single = M>,
Self: Get<Collection<<M as Bundled>::Bundle>>,
pub fn get_metric<M>(&self, key: &Key) -> Option<Result<Metric<M>, Error>>where M: Bundled, <M as Bundled>::Bundle: Bundle<Single = M>, Self: Get<Collection<<M as Bundled>::Bundle>>,
Returns a prometheus Metric 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 Metric 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>>>>, RandomState>> for Storage
impl Get<HashMap<String, Describable<Either<GenericCounter<AtomicU64>, MetricVec<CounterVecBuilder<AtomicU64>>>>, RandomState>> for Storage
source§fn collection(&self) -> &Collection<PrometheusIntCounter>
fn collection(&self) -> &Collection<PrometheusIntCounter>
Collection of metric::Bundles stored in this storage.source§impl Get<HashMap<String, Describable<Either<GenericGauge<AtomicF64>, MetricVec<GaugeVecBuilder<AtomicF64>>>>, RandomState>> for Storage
impl Get<HashMap<String, Describable<Either<GenericGauge<AtomicF64>, MetricVec<GaugeVecBuilder<AtomicF64>>>>, RandomState>> for Storage
source§fn collection(&self) -> &Collection<PrometheusGauge>
fn collection(&self) -> &Collection<PrometheusGauge>
Collection of metric::Bundles stored in this storage.source§impl Get<HashMap<String, Describable<Either<Histogram, MetricVec<HistogramVecBuilder>>>, RandomState>> for Storage
impl Get<HashMap<String, Describable<Either<Histogram, MetricVec<HistogramVecBuilder>>>, RandomState>> for Storage
source§fn collection(&self) -> &Collection<PrometheusHistogram>
fn collection(&self) -> &Collection<PrometheusHistogram>
Collection of metric::Bundles stored in this storage.