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.
However, still allows to change metrics help description on the fly,
once they are registered in a 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 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>>
pub fn get_metric<M>(&self, key: &Key) -> Option<Result<Metric<M>, Error>>
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>>>>>> 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::Bundles 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::Bundles 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::Bundles stored in this storage.