udp: improve peer client statistics

This commit is contained in:
Joakim Frostegård 2023-06-08 01:06:19 +02:00
parent 1ddac59fee
commit da25d60a5d
7 changed files with 159 additions and 75 deletions

View file

@ -4,6 +4,7 @@ pub mod workers;
use std::collections::BTreeMap;
use std::thread::Builder;
use std::time::Duration;
use anyhow::Context;
use crossbeam_channel::{bounded, unbounded};
@ -143,8 +144,13 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
#[cfg(feature = "prometheus")]
if config.statistics.run_prometheus_endpoint {
use metrics_exporter_prometheus::PrometheusBuilder;
use metrics_util::MetricKindMask;
PrometheusBuilder::new()
.idle_timeout(
MetricKindMask::ALL,
Some(Duration::from_secs(config.statistics.interval * 2)),
)
.with_http_listener(config.statistics.prometheus_endpoint_address)
.install()
.with_context(|| {