Add lighthouse_metrics gather fn

This commit is contained in:
Paul Hauner
2019-08-12 18:19:50 +10:00
parent d7c546844c
commit 7165598b7f
2 changed files with 13 additions and 7 deletions

View File

@@ -2,6 +2,10 @@ use prometheus::{HistogramOpts, HistogramTimer, Opts};
pub use prometheus::{Histogram, IntCounter, IntGauge, Result};
pub fn gather() -> Vec<prometheus::proto::MetricFamily> {
prometheus::gather()
}
pub fn try_create_int_counter(name: &str, help: &str) -> Result<IntCounter> {
let opts = Opts::new(name, help);
let counter = IntCounter::with_opts(opts)?;