update recover event

This commit is contained in:
Ulric Qin 2021-12-08 22:31:48 +08:00
parent ed5e93f373
commit aa2e5f15ee
1 changed files with 16 additions and 0 deletions

View File

@ -326,6 +326,22 @@ func (r RuleEval) recoverRule(alertingKeys map[string]struct{}, now int64) {
if r.rule.NotifyRecovered == 1 { if r.rule.NotifyRecovered == 1 {
event.IsRecovered = true event.IsRecovered = true
event.LastEvalTime = now event.LastEvalTime = now
// 可能是因为调整了promql才恢复的所以事件里边要体现最新的promql否则用户会比较困惑
// 当然其实rule的各个字段都可能发生变化了都更新一下吧
event.RuleName = r.rule.Name
event.RuleNote = r.rule.Note
event.Severity = r.rule.Severity
event.PromForDuration = r.rule.PromForDuration
event.PromQl = r.rule.PromQl
event.PromEvalInterval = r.rule.PromEvalInterval
event.Callbacks = r.rule.Callbacks
event.CallbacksJSON = r.rule.CallbacksJSON
event.RunbookUrl = r.rule.RunbookUrl
event.NotifyRecovered = r.rule.NotifyRecovered
event.NotifyChannels = r.rule.NotifyChannels
event.NotifyChannelsJSON = r.rule.NotifyChannelsJSON
event.NotifyGroups = r.rule.NotifyGroups
event.NotifyGroupsJSON = r.rule.NotifyGroupsJSON
pushEventToQueue(event) pushEventToQueue(event)
} }
} }