mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 09:54:09 +01:00
Support simple histogram metric
This commit is contained in:
parent
712c86d405
commit
841a800505
@ -3,8 +3,8 @@ use std::io;
|
||||
use std::net::SocketAddr;
|
||||
use tiny_http;
|
||||
|
||||
pub use prometheus::{GaugeVec, HistogramOpts, HistogramTimer, HistogramVec, IntCounter as Counter,
|
||||
IntGauge as Gauge, Opts as MetricOpts};
|
||||
pub use prometheus::{GaugeVec, Histogram, HistogramOpts, HistogramTimer, HistogramVec,
|
||||
IntCounter as Counter, IntGauge as Gauge, Opts as MetricOpts};
|
||||
|
||||
use util::spawn_thread;
|
||||
|
||||
@ -39,6 +39,12 @@ impl Metrics {
|
||||
g
|
||||
}
|
||||
|
||||
pub fn histogram(&self, opts: prometheus::HistogramOpts) -> Histogram {
|
||||
let h = Histogram::with_opts(opts).unwrap();
|
||||
self.reg.register(Box::new(h.clone())).unwrap();
|
||||
h
|
||||
}
|
||||
|
||||
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