From f4336ca5e98b8e41210bfcecc236bcafc1e22cf4 Mon Sep 17 00:00:00 2001 From: ning <710leo@gmail.com> Date: Thu, 1 Feb 2024 22:47:48 +0800 Subject: [PATCH] refactor alert process --- alert/process/process.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alert/process/process.go b/alert/process/process.go index 1a3f617a..dac6948b 100644 --- a/alert/process/process.go +++ b/alert/process/process.go @@ -233,11 +233,12 @@ func (p *Processor) HandleRecover(alertingKeys map[string]struct{}, now int64) { } } -func (p *Processor) RecoverSingle(hash string, now int64, value *string) { +func (p *Processor) RecoverSingle(hash string, now int64, value *string, values ...string) { cachedRule := p.rule if cachedRule == nil { return } + event, has := p.fires.Get(hash) if !has { return @@ -249,6 +250,9 @@ func (p *Processor) RecoverSingle(hash string, now int64, value *string) { } if value != nil { event.TriggerValue = *value + if len(values) > 0 { + event.TriggerValues = values[0] + } } // 没查到触发阈值的vector,姑且就认为这个vector的值恢复了