Add Metrics::gauge_vec() method
This commit is contained in:
parent
5a580e1a27
commit
3d77353d78
|
@ -3,7 +3,7 @@ use std::io;
|
|||
use std::net::SocketAddr;
|
||||
use tiny_http;
|
||||
|
||||
pub use prometheus::{HistogramOpts, HistogramTimer, HistogramVec, IntCounter as Counter,
|
||||
pub use prometheus::{GaugeVec, HistogramOpts, HistogramTimer, HistogramVec, IntCounter as Counter,
|
||||
IntGauge as Gauge, Opts as MetricOpts};
|
||||
|
||||
use util::spawn_thread;
|
||||
|
@ -33,6 +33,12 @@ impl Metrics {
|
|||
g
|
||||
}
|
||||
|
||||
pub fn gauge_vec(&self, opts: prometheus::Opts, labels: &[&str]) -> GaugeVec {
|
||||
let g = GaugeVec::new(opts, labels).unwrap();
|
||||
self.reg.register(Box::new(g.clone())).unwrap();
|
||||
g
|
||||
}
|
||||
|
||||
pub fn histogram_vec(&self, opts: prometheus::HistogramOpts, labels: &[&str]) -> HistogramVec {
|
||||
let h = HistogramVec::new(opts, labels).unwrap();
|
||||
self.reg.register(Box::new(h.clone())).unwrap();
|
||||
|
|
Loading…
Reference in New Issue
Block a user