Support vectorized counter metric
This commit is contained in:
parent
2cf765ba5c
commit
ec844fe876
|
@ -4,7 +4,8 @@ use std::net::SocketAddr;
|
|||
use tiny_http;
|
||||
|
||||
pub use prometheus::{GaugeVec, Histogram, HistogramOpts, HistogramTimer, HistogramVec,
|
||||
IntCounter as Counter, IntGauge as Gauge, Opts as MetricOpts};
|
||||
IntCounter as Counter, IntCounterVec as CounterVec, IntGauge as Gauge,
|
||||
Opts as MetricOpts};
|
||||
|
||||
use util::spawn_thread;
|
||||
|
||||
|
@ -27,6 +28,12 @@ impl Metrics {
|
|||
c
|
||||
}
|
||||
|
||||
pub fn counter_vec(&self, opts: prometheus::Opts, labels: &[&str]) -> CounterVec {
|
||||
let c = CounterVec::new(opts, labels).unwrap();
|
||||
self.reg.register(Box::new(c.clone())).unwrap();
|
||||
c
|
||||
}
|
||||
|
||||
pub fn gauge(&self, opts: prometheus::Opts) -> Gauge {
|
||||
let g = Gauge::with_opts(opts).unwrap();
|
||||
self.reg.register(Box::new(g.clone())).unwrap();
|
||||
|
|
Loading…
Reference in New Issue
Block a user