Skip to content

Commit dbeb3ab

Browse files
fix: metrics unbounded memory (#409)
1 parent 29f728e commit dbeb3ab

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

router/src/http/server.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,9 +1634,12 @@ pub async fn run(
16341634
}
16351635
});
16361636

1637-
let prom_handle = prom_builder
1638-
.install_recorder()
1639-
.context("failed to install metrics recorder")?;
1637+
// See: https://github.com/metrics-rs/metrics/issues/467#issuecomment-2022755151
1638+
let (recorder, _) = prom_builder
1639+
.build()
1640+
.context("failed to build prometheus recorder")?;
1641+
let prom_handle = recorder.handle();
1642+
metrics::set_global_recorder(recorder).context("Failed to set global recorder")?;
16401643

16411644
// CORS layer
16421645
let allow_origin = allow_origin.unwrap_or(AllowOrigin::any());

0 commit comments

Comments
 (0)