udp: actually register global metrics handler

This commit is contained in:
Joakim Frostegård 2024-02-02 14:46:42 +01:00
parent f2d063d6a6
commit b4e27903dc

View file

@ -193,6 +193,11 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
.build() .build()
.context("build prometheus recorder and exporter")?; .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 { ::tokio::spawn(async move {
let mut interval = ::tokio::time::interval(Duration::from_secs(5)); 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 // Periodically render metrics to make sure
// idles are cleaned up // idles are cleaned up
recorder.handle().render(); recorder_handle.render();
} }
}); });