Skip to content

Commit

Permalink
instr(config): Log error on suspicious quota (#4476)
Browse files Browse the repository at this point in the history
Log an error during project config sanitation when a total and indexed
category count toward the same quota.
  • Loading branch information
jjbayer authored Jan 29, 2025
1 parent 46c8fb3 commit c81ede2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions relay-dynamic-config/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 &quota.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.",
);
}
}
}
}
}
}

Expand Down

0 comments on commit c81ede2

Please sign in to comment.