From 86ddaf2f70ffa3eee542bc04cbee4c15869a797a Mon Sep 17 00:00:00 2001 From: Yurii Koba Date: Mon, 25 Nov 2024 13:19:59 +0200 Subject: [PATCH 1/2] correct mistake in the var name --- database/src/metrics.rs | 2 +- database/src/postgres/rpc_server.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/database/src/metrics.rs b/database/src/metrics.rs index ea0adfa2..9b0cbef2 100644 --- a/database/src/metrics.rs +++ b/database/src/metrics.rs @@ -38,7 +38,7 @@ lazy_static! { &["method_name", "table_name"] ) .unwrap(); - pub(crate) static ref ACCOUTS_DATABASE_READ_QUERIES: IntCounterVec = register_int_counter_vec( + pub(crate) static ref ACCOUNTS_DATABASE_READ_QUERIES: IntCounterVec = register_int_counter_vec( "account_database_read_queries_counter", "Total number of accounts database reads queries by method_name and table_name", &["account_id", "shard_id", "method_name", "table_name"] diff --git a/database/src/postgres/rpc_server.rs b/database/src/postgres/rpc_server.rs index f6b06bcb..5f0bb6b6 100644 --- a/database/src/postgres/rpc_server.rs +++ b/database/src/postgres/rpc_server.rs @@ -69,7 +69,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -158,7 +158,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -223,7 +223,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -288,7 +288,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -329,7 +329,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_account", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -374,7 +374,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_contract", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -420,7 +420,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_access_key", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), @@ -468,7 +468,7 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_access_key", ]) .inc(); - crate::metrics::ACCOUTS_DATABASE_READ_QUERIES + crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES .with_label_values(&[ account_id.as_ref(), &shard_id_pool.shard_id.to_string(), From 8a8d0f2ecfd6d385abb00614f95dda53748c0709 Mon Sep 17 00:00:00 2001 From: Yurii Koba Date: Tue, 26 Nov 2024 17:27:24 +0200 Subject: [PATCH 2/2] remove heavy metrics (#379) --- database/src/metrics.rs | 6 --- database/src/postgres/rpc_server.rs | 64 ----------------------------- 2 files changed, 70 deletions(-) diff --git a/database/src/metrics.rs b/database/src/metrics.rs index 9b0cbef2..7ba79cb9 100644 --- a/database/src/metrics.rs +++ b/database/src/metrics.rs @@ -38,10 +38,4 @@ lazy_static! { &["method_name", "table_name"] ) .unwrap(); - pub(crate) static ref ACCOUNTS_DATABASE_READ_QUERIES: IntCounterVec = register_int_counter_vec( - "account_database_read_queries_counter", - "Total number of accounts database reads queries by method_name and table_name", - &["account_id", "shard_id", "method_name", "table_name"] - ) - .unwrap(); } diff --git a/database/src/postgres/rpc_server.rs b/database/src/postgres/rpc_server.rs index 5f0bb6b6..ffe593b5 100644 --- a/database/src/postgres/rpc_server.rs +++ b/database/src/postgres/rpc_server.rs @@ -69,14 +69,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_data", - ]) - .inc(); let page_state = if let Some(page_state_token) = page_token { borsh::from_slice::(&hex::decode(page_state_token)?)? } else { @@ -158,14 +150,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_data", - ]) - .inc(); let mut items = std::collections::HashMap::new(); let mut stream = sqlx::query_as::<_, (String, Vec)>( " @@ -223,14 +207,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_data", - ]) - .inc(); let mut items = std::collections::HashMap::new(); let mut stream = sqlx::query_as::<_, (String, Vec)>( " @@ -288,14 +264,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_data", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_data", - ]) - .inc(); let (data_value,): (Vec,) = sqlx::query_as( " SELECT data_value @@ -329,14 +297,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_account", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_account", - ]) - .inc(); let (block_height, block_hash, data_value): (bigdecimal::BigDecimal, String, Vec) = sqlx::query_as( " @@ -374,14 +334,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_contract", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_contract", - ]) - .inc(); let (block_height, block_hash, contract_code): (bigdecimal::BigDecimal, String, Vec) = sqlx::query_as( " @@ -420,14 +372,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_access_key", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_access_key", - ]) - .inc(); let key_data = borsh::to_vec(&public_key)?; let (block_height, block_hash, data_value): (bigdecimal::BigDecimal, String, Vec) = sqlx::query_as( @@ -468,14 +412,6 @@ impl crate::ReaderDbManager for crate::PostgresDBManager { "state_changes_access_key", ]) .inc(); - crate::metrics::ACCOUNTS_DATABASE_READ_QUERIES - .with_label_values(&[ - account_id.as_ref(), - &shard_id_pool.shard_id.to_string(), - method_name, - "state_changes_access_key", - ]) - .inc(); let mut access_keys = vec![]; let mut stream = sqlx::query_as::<_, (String, Vec, bigdecimal::BigDecimal)>( "