From 40799d8ae760e188b9e0770ee94075476bdfeb21 Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Fri, 17 Feb 2023 16:49:40 +0200 Subject: [PATCH] Add debug messages to catch abnormal consumption metric values --- pageserver/src/consumption_metrics.rs | 8 +++++++- proxy/src/metrics.rs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pageserver/src/consumption_metrics.rs b/pageserver/src/consumption_metrics.rs index d1383b33cb..8916d4f1c9 100644 --- a/pageserver/src/consumption_metrics.rs +++ b/pageserver/src/consumption_metrics.rs @@ -25,7 +25,7 @@ const REMOTE_STORAGE_SIZE: &str = "remote_storage_size"; const TIMELINE_LOGICAL_SIZE: &str = "timeline_logical_size"; #[serde_as] -#[derive(Serialize)] +#[derive(Serialize, Debug)] struct Ids { #[serde_as(as = "DisplayFromStr")] tenant_id: TenantId, @@ -287,6 +287,12 @@ pub async fn collect_metrics_iteration( } } else { error!("metrics endpoint refused the sent metrics: {:?}", res); + for metric in chunk_to_send.iter() { + // Report if the metric value is suspiciously large + if metric.value > (1u64 << 40) { + error!("potentially abnormal metric value: {:?}", metric); + } + } } } Err(err) => { diff --git a/proxy/src/metrics.rs b/proxy/src/metrics.rs index 8bbae9638b..3b28346872 100644 --- a/proxy/src/metrics.rs +++ b/proxy/src/metrics.rs @@ -18,7 +18,7 @@ const PROXY_IO_BYTES_PER_CLIENT: &str = "proxy_io_bytes_per_client"; /// so while the project-id is unique across regions the whole pipeline will work correctly /// because we enrich the event with project_id in the control-plane endpoint. /// -#[derive(Eq, Hash, PartialEq, Serialize)] +#[derive(Eq, Hash, PartialEq, Serialize, Debug)] pub struct Ids { pub endpoint_id: String, } @@ -183,6 +183,12 @@ async fn collect_metrics_iteration( } } else { error!("metrics endpoint refused the sent metrics: {:?}", res); + for metric in chunk.iter() { + // Report if the metric value is suspiciously large + if metric.value > (1u64 << 40) { + error!("potentially abnormal metric value: {:?}", metric); + } + } } } Ok(())