code refactor
This commit is contained in:
parent
f5e2b43526
commit
cc32194fb6
|
@ -30,9 +30,8 @@ func matchMute(event *models.AlertCurEvent, mute *models.AlertMute, clock ...int
|
||||||
if ts < mute.Btime || ts > mute.Etime {
|
if ts < mute.Btime || ts > mute.Etime {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
tg := event.TagsMap
|
|
||||||
tg["rulename"] = event.RuleName
|
return matchTags(event.TagsMap, mute.ITags)
|
||||||
return matchTags(tg, mute.ITags)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchTag(value string, filter models.TagFilter) bool {
|
func matchTag(value string, filter models.TagFilter) bool {
|
||||||
|
|
|
@ -294,6 +294,8 @@ func (r RuleEval) judge(vectors []conv.Vector) {
|
||||||
tagsMap[arr[0]] = arr[1]
|
tagsMap[arr[0]] = arr[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tagsMap["rulename"] = r.rule.Name
|
||||||
|
|
||||||
// handle target note
|
// handle target note
|
||||||
targetIdent, has := vectors[i].Labels["ident"]
|
targetIdent, has := vectors[i].Labels["ident"]
|
||||||
targetNote := ""
|
targetNote := ""
|
||||||
|
|
Loading…
Reference in New Issue