Skip to content

Commit

Permalink
Make filter labels consistent with Prometheus
Browse files Browse the repository at this point in the history
Filtering the alert out when the label is missing precludes a
possible match for an empty value. This change allows the
match to be evaluated.

Closes #2342

Signed-off-by: Victor Araujo <vear91@gmail.com>
  • Loading branch information
vears91 committed Oct 26, 2020
1 parent 10ecddd commit 9c9d09b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func matchFilterLabels(matchers []*labels.Matcher, sms map[string]string) bool {
if string(m.Value) == "" && !prs {
continue
}
if !prs || !m.Matches(string(v)) {
if !m.Matches(string(v)) {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func matchFilterLabels(matchers []*labels.Matcher, sms map[string]string) bool {
if m.Value == "" && !prs {
continue
}
if !prs || !m.Matches(v) {
if !m.Matches(v) {
return false
}
}
Expand Down

0 comments on commit 9c9d09b

Please sign in to comment.