From bef8e8e5483004a0b025c7b5c2a7a98bfd19689c Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Mon, 6 Dec 2021 18:44:56 +0800 Subject: [PATCH] bugfix: handle rule judge --- src/server/engine/worker.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server/engine/worker.go b/src/server/engine/worker.go index dd46e20e..4a61f55d 100644 --- a/src/server/engine/worker.go +++ b/src/server/engine/worker.go @@ -173,6 +173,16 @@ func (ws *WorkersType) Build(rids []int64) { } func (r RuleEval) judge(vectors []Vector) { + // 有可能rule的一些配置已经发生变化,比如告警接收人、callbacks等 + // 这些信息的修改是不会引起worker restart的,但是确实会影响告警处理逻辑 + // 所以,这里直接从memsto.AlertRuleCache中获取并覆盖 + curRule := memsto.AlertRuleCache.Get(r.rule.Id) + if curRule == nil { + return + } + + r.rule = curRule + count := len(vectors) alertingKeys := make(map[string]struct{}) now := time.Now().Unix()