fix mute bug (#1025)
Co-authored-by: tripitakav <chengzhi.shang@longbridge.sg>
This commit is contained in:
parent
fe82886f09
commit
18a9288b75
|
@ -30,8 +30,9 @@ 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
|
||||||
return matchTags(event.TagsMap, mute.ITags)
|
tg["alertname"] = event.RuleName
|
||||||
|
return matchTags(tg, mute.ITags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchTags(eventTagsMap map[string]string, itags []models.TagFilter) bool {
|
func matchTags(eventTagsMap map[string]string, itags []models.TagFilter) bool {
|
||||||
|
|
|
@ -314,6 +314,7 @@ func (r RuleEval) judge(vectors []conv.Vector) {
|
||||||
TriggerTime: vectors[i].Timestamp,
|
TriggerTime: vectors[i].Timestamp,
|
||||||
TagsMap: tagsMap,
|
TagsMap: tagsMap,
|
||||||
GroupId: r.rule.GroupId,
|
GroupId: r.rule.GroupId,
|
||||||
|
RuleName: r.rule.Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
bg := memsto.BusiGroupCache.GetByBusiGroupId(r.rule.GroupId)
|
bg := memsto.BusiGroupCache.GetByBusiGroupId(r.rule.GroupId)
|
||||||
|
@ -321,7 +322,7 @@ func (r RuleEval) judge(vectors []conv.Vector) {
|
||||||
event.GroupName = bg.Name
|
event.GroupName = bg.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
// isMuted only need TriggerTime and TagsMap
|
// isMuted only need TriggerTime RuleName and TagsMap
|
||||||
if isMuted(event) {
|
if isMuted(event) {
|
||||||
logger.Infof("event_muted: rule_id=%d %s", r.rule.Id, vectors[i].Key)
|
logger.Infof("event_muted: rule_id=%d %s", r.rule.Id, vectors[i].Key)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue