Struct metrics_prometheus::storage::mutable::Storage
source · pub struct Storage { /* 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)where
M: Bundled,
<M as Bundled>::Bundle: Clone,
Self: Get<Collection<<M as Bundled>::Bundle>>,
pub fn describe<M>(&self, name: &str, description: String)where M: Bundled, <M as Bundled>::Bundle: Clone, Self: Get<Collection<<M as Bundled>::Bundle>>,
Changes the help description of the prometheus Metric
identified by its name.
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 register_external<M>(&self, metric: M) -> Result<()>where
M: Bundled + Collector,
<M as Bundled>::Bundle: Collector + Clone + 'static,
Self: Get<Collection<<M as Bundled>::Bundle>>,
pub fn register_external<M>(&self, metric: M) -> Result<()>where M: Bundled + Collector, <M as Bundled>::Bundle: Collector + Clone + 'static, Self: Get<Collection<<M as Bundled>::Bundle>>,
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::IntCounterVecprometheus::Gauge,prometheus::GaugeVecprometheus::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>>>>>, RandomState>>>> for Storage
impl Get<Arc<RwLock<HashMap<String, Describable<Option<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<Arc<RwLock<HashMap<String, Describable<Option<Either<GenericGauge<AtomicF64>, MetricVec<GaugeVecBuilder<AtomicF64>>>>>, RandomState>>>> for Storage
impl Get<Arc<RwLock<HashMap<String, Describable<Option<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<Arc<RwLock<HashMap<String, Describable<Option<Either<Histogram, MetricVec<HistogramVecBuilder>>>>, RandomState>>>> for Storage
impl Get<Arc<RwLock<HashMap<String, Describable<Option<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.