diff --git a/crates/katana/src/main.rs b/crates/katana/src/main.rs index 1a3f5b396f..f864061de8 100644 --- a/crates/katana/src/main.rs +++ b/crates/katana/src/main.rs @@ -67,7 +67,7 @@ async fn main() -> Result<(), Box> { } if let Some(listen_addr) = config.metrics { - let prometheus_handle = prometheus_exporter::install_recorder()?; + let prometheus_handle = prometheus_exporter::install_recorder("katana")?; info!(target: "katana::cli", addr = %listen_addr, "Starting metrics endpoint"); prometheus_exporter::serve( diff --git a/crates/metrics/src/prometheus_exporter.rs b/crates/metrics/src/prometheus_exporter.rs index 92ea2d23c7..82206da51e 100644 --- a/crates/metrics/src/prometheus_exporter.rs +++ b/crates/metrics/src/prometheus_exporter.rs @@ -14,13 +14,13 @@ pub(crate) trait Hook: Fn() + Send + Sync {} impl Hook for T {} /// Installs Prometheus as the metrics recorder. -pub fn install_recorder() -> anyhow::Result { +pub fn install_recorder(prefix: &str) -> anyhow::Result { let recorder = PrometheusBuilder::new().build_recorder(); let handle = recorder.handle(); // Build metrics stack Stack::new(recorder) - .push(PrefixLayer::new("katana")) + .push(PrefixLayer::new(prefix)) .install() .map_err(|e| anyhow::anyhow!("Couldn't set metrics recorder: {}", e))?; diff --git a/crates/torii/server/src/cli.rs b/crates/torii/server/src/cli.rs index 0e606a1aa3..04e99ac062 100644 --- a/crates/torii/server/src/cli.rs +++ b/crates/torii/server/src/cli.rs @@ -170,7 +170,7 @@ async fn main() -> anyhow::Result<()> { info!(target: "torii::cli", "Serving Graphql playground: {}\n", format!("http://{}/graphql", args.addr)); if let Some(listen_addr) = args.metrics { - let prometheus_handle = prometheus_exporter::install_recorder()?; + let prometheus_handle = prometheus_exporter::install_recorder("torii")?; info!(target: "torii::cli", addr = %listen_addr, "Starting metrics endpoint"); prometheus_exporter::serve(