Skip to content

Commit

Permalink
fix: metrics unbounded memory (huggingface#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierDehaene authored Sep 17, 2024
1 parent eaac474 commit 2fb4fdc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions router/src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,9 +1634,12 @@ pub async fn run(
}
});

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

// CORS layer
let allow_origin = allow_origin.unwrap_or(AllowOrigin::any());
Expand Down

0 comments on commit 2fb4fdc

Please sign in to comment.