From c81ede29bc9a6cc29094f5a5f170ac0051d672eb Mon Sep 17 00:00:00 2001 From: Joris Bayer Date: Wed, 29 Jan 2025 08:42:55 +0100 Subject: [PATCH] instr(config): Log error on suspicious quota (#4476) Log an error during project config sanitation when a total and indexed category count toward the same quota. --- relay-dynamic-config/src/project.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/relay-dynamic-config/src/project.rs b/relay-dynamic-config/src/project.rs index 7ad080a3d14..fce962ed743 100644 --- a/relay-dynamic-config/src/project.rs +++ b/relay-dynamic-config/src/project.rs @@ -103,6 +103,21 @@ impl ProjectConfig { for flag in GRADUATED_FEATURE_FLAGS { self.features.0.insert(*flag); } + + // Check if indexed and non-indexed are double-counting towards the same ID. + // This is probably not intended behavior. + for quota in &self.quotas { + for category in "a.categories { + if let Some(indexed) = category.index_category() { + if quota.categories.contains(&indexed) { + relay_log::error!( + id = ?quota.id, + "Categories {category} and {indexed} share the same quota ID. This will double-count items.", + ); + } + } + } + } } }