From b4e27903dc756a3d37b5ad004afde02a425fdfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Fri, 2 Feb 2024 14:46:42 +0100 Subject: [PATCH] udp: actually register global metrics handler --- crates/udp/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/udp/src/lib.rs b/crates/udp/src/lib.rs index 7d59639..639e2a9 100644 --- a/crates/udp/src/lib.rs +++ b/crates/udp/src/lib.rs @@ -193,6 +193,11 @@ pub fn run(config: Config) -> ::anyhow::Result<()> { .build() .context("build prometheus recorder and exporter")?; + let recorder_handle = recorder.handle(); + + ::metrics::set_global_recorder(recorder) + .context("set global metrics recorder")?; + ::tokio::spawn(async move { let mut interval = ::tokio::time::interval(Duration::from_secs(5)); @@ -201,7 +206,7 @@ pub fn run(config: Config) -> ::anyhow::Result<()> { // Periodically render metrics to make sure // idles are cleaned up - recorder.handle().render(); + recorder_handle.render(); } });