mirror of
https://github.com/prometheus/alertmanager
synced 2024-12-26 16:12:20 +00:00
Simplify inhibition mute check
This commit is contained in:
parent
365b641223
commit
0fdaf263c1
13
inhibit.go
13
inhibit.go
@ -110,15 +110,14 @@ func NewInhibitRule(cr *config.InhibitRule) *InhibitRule {
|
||||
}
|
||||
|
||||
func (r *InhibitRule) Mutes(source, target model.LabelSet) bool {
|
||||
if r.TargetMatchers.Match(target) && r.SourceMatchers.Match(source) {
|
||||
for ln := range r.Equal {
|
||||
if source[ln] != target[ln] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !r.TargetMatchers.Match(target) || !r.SourceMatchers.Match(source) {
|
||||
return false
|
||||
}
|
||||
for ln := range r.Equal {
|
||||
if source[ln] != target[ln] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user