From aa2e5f15ee486638bc767b3c2767dc328fb61ec5 Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Wed, 8 Dec 2021 22:31:48 +0800 Subject: [PATCH] update recover event --- src/server/engine/worker.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/server/engine/worker.go b/src/server/engine/worker.go index 939ec176..40e0aafa 100644 --- a/src/server/engine/worker.go +++ b/src/server/engine/worker.go @@ -326,6 +326,22 @@ func (r RuleEval) recoverRule(alertingKeys map[string]struct{}, now int64) { if r.rule.NotifyRecovered == 1 { event.IsRecovered = true 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) } }