feat: Add hasLabelsForEveryAggregation validator - #109
Open
pw-mdb wants to merge 1 commit into
Open
Conversation
Owner
|
Hi! Thanks for the contribution 🎉 The validation idea makes sense, so I'd be happy to add it 👍 Could you please:
|
FUSAKLA
self-requested a review
February 28, 2025 14:44
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.
This adds a
hasLabelsForEveryAggregationvalidator, which verifies that every aggregation in an alert expression has a set of labels. The new validator has aexcludeRuleLabelsoption, which ignores labels inlabelsif they are specified in the alert rule's labels.This is useful for partially ensuring that alert rules return labels that are required for
AlertmanagerConfigmatchers. For example, when usingprometheus-operator, the operator adds an implicitnamespacematcher to everyAlertmanagerConfig. Alert rules that don't return thenamespacelabel get silently blackhole'd. Because of this, aggregations are a huge source of blackhole'd alerts for us.