From 7c4f85db83331d745676370f84de265ef84e8676 Mon Sep 17 00:00:00 2001 From: Joel Nordell <94570446+joel-u410@users.noreply.github.com> Date: Thu, 11 Apr 2024 06:24:02 -0500 Subject: [PATCH] metrics: Do not include block height as a label in metrics. (#196) See https://github.com/Zondax/namadexer/issues/195 for more info. --- src/database.rs | 5 +---- src/indexer/mod.rs | 10 +--------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/database.rs b/src/database.rs index 725bb07..dc37c01 100644 --- a/src/database.rs +++ b/src/database.rs @@ -466,10 +466,7 @@ impl Database { status = e.to_string(); } - let labels = [ - ("save_block", block.header.height.value().to_string()), - ("status", status), - ]; + let labels = [("status", status)]; histogram!(DB_SAVE_BLOCK_DURATION, dur.as_secs_f64() * 1000.0, &labels); diff --git a/src/indexer/mod.rs b/src/indexer/mod.rs index 14b1c85..8d76a16 100644 --- a/src/indexer/mod.rs +++ b/src/indexer/mod.rs @@ -49,16 +49,8 @@ async fn get_block(block_height: u32, chain_name: &str, client: &HttpClient) -> match response { Ok(resp) => { info!("Got block {}", block_height); - let labels = [( - "indexer_get_block: ", - resp.block.header.height.value().to_string(), - )]; - metrics::histogram!( - crate::INDEXER_GET_BLOCK_DURATION, - dur.as_secs_f64(), - &labels - ); + metrics::histogram!(crate::INDEXER_GET_BLOCK_DURATION, dur.as_secs_f64()); // update the gauge indicating last block height retrieved. metrics::gauge!(