diff --git a/src/server/engine/mute.go b/src/server/engine/mute.go index 9dc1208b..64990785 100644 --- a/src/server/engine/mute.go +++ b/src/server/engine/mute.go @@ -30,8 +30,9 @@ func matchMute(event *models.AlertCurEvent, mute *models.AlertMute, clock ...int if ts < mute.Btime || ts > mute.Etime { return false } - - return matchTags(event.TagsMap, mute.ITags) + tg := event.TagsMap + tg["alertname"] = event.RuleName + return matchTags(tg, mute.ITags) } func matchTags(eventTagsMap map[string]string, itags []models.TagFilter) bool { diff --git a/src/server/engine/worker.go b/src/server/engine/worker.go index 99b3219d..ba93c244 100644 --- a/src/server/engine/worker.go +++ b/src/server/engine/worker.go @@ -314,6 +314,7 @@ func (r RuleEval) judge(vectors []conv.Vector) { TriggerTime: vectors[i].Timestamp, TagsMap: tagsMap, GroupId: r.rule.GroupId, + RuleName: r.rule.Name, } bg := memsto.BusiGroupCache.GetByBusiGroupId(r.rule.GroupId) @@ -321,7 +322,7 @@ func (r RuleEval) judge(vectors []conv.Vector) { event.GroupName = bg.Name } - // isMuted only need TriggerTime and TagsMap + // isMuted only need TriggerTime RuleName and TagsMap if isMuted(event) { logger.Infof("event_muted: rule_id=%d %s", r.rule.Id, vectors[i].Key) continue