code refactor

This commit is contained in:
Ulric Qin 2022-07-10 11:27:36 +08:00
parent f5e2b43526
commit cc32194fb6
2 changed files with 4 additions and 3 deletions

View File

@ -30,9 +30,8 @@ func matchMute(event *models.AlertCurEvent, mute *models.AlertMute, clock ...int
if ts < mute.Btime || ts > mute.Etime {
return false
}
tg := event.TagsMap
tg["rulename"] = event.RuleName
return matchTags(tg, mute.ITags)
return matchTags(event.TagsMap, mute.ITags)
}
func matchTag(value string, filter models.TagFilter) bool {

View File

@ -294,6 +294,8 @@ func (r RuleEval) judge(vectors []conv.Vector) {
tagsMap[arr[0]] = arr[1]
}
tagsMap["rulename"] = r.rule.Name
// handle target note
targetIdent, has := vectors[i].Labels["ident"]
targetNote := ""