[$30 BOUNTY] Fix HighMemoryUsage alert ratio expression + add validation#25
Open
lee-muriithi-kingori wants to merge 1 commit into
Open
Conversation
- Fixed self-dividing expression: process_resident_memory_bytes / process_resident_memory_bytes - Changed to: process_resident_memory_bytes / machine_memory_bytes - Added validate_alert_expression() to catch self-dividing PromQL patterns - Added validate_all_alert_rules() for bulk validation - Added --validate-alerts CLI flag for standalone validation - Validation now runs before any rule upload (blocks on errors) Closes weilixiong#1
|
"Really great work on implementing the validate_alert_expression() logic here. Catching the self-dividing patterns (metric / metric) via regex is a much more robust approach than simply manual review. Have you considered also expanding the validation to catch cases where the denominator might be a constant that evaluates to zero? I’ve been playing with similar telemetry mitigation logic in my own projects, and adding a check for const == 0 edge cases could really harden the whole suite against false alerts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixed the
HighMemoryUsagePrometheus alert that was using a self-dividing expression (process_resident_memory_bytes / process_resident_memory_bytes), which always evaluates to 1 for any non-zero value.Changes
Fixed the alert expression:
process_resident_memory_bytes / process_resident_memory_bytes > 0.9(always true)process_resident_memory_bytes / machine_memory_bytes > 0.9(meaningful ratio)Added alert expression validation:
validate_alert_expression()- catches self-dividing patterns using regexvalidate_all_alert_rules()- bulk validation of all rules--validate-alertsCLI flag for standalone validationValidation catches:
metric / metricValidation
Bounty Claim
/claim #1