udp: add prometheus support

This commit is contained in:
Joakim Frostegård 2023-02-26 11:57:00 +01:00
parent e4b7c8451d
commit 5276a919da
6 changed files with 122 additions and 22 deletions

View file

@ -141,6 +141,21 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
let state = state.clone();
let config = config.clone();
#[cfg(feature = "prometheus")]
if config.statistics.run_prometheus_endpoint {
use metrics_exporter_prometheus::PrometheusBuilder;
PrometheusBuilder::new()
.with_http_listener(config.statistics.prometheus_endpoint_address)
.install()
.with_context(|| {
format!(
"Install prometheus endpoint on {}",
config.statistics.prometheus_endpoint_address
)
})?;
}
Builder::new()
.name("statistics".into())
.spawn(move || {