From 522a5361a283ad9fc50e88ca10a01e71fe21a2b8 Mon Sep 17 00:00:00 2001 From: liugq Date: Tue, 22 Aug 2023 09:04:17 +0800 Subject: [PATCH] add reference channel id to alerting history --- model/alerting/alert.go | 1 + service/alerting/elasticsearch/engine.go | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/model/alerting/alert.go b/model/alerting/alert.go index 8a989fed..fc8bf8b1 100644 --- a/model/alerting/alert.go +++ b/model/alerting/alert.go @@ -42,6 +42,7 @@ type ActionExecutionResult struct { Message string `json:"message"` ChannelName string `json:"channel_name"` ChannelType string `json:"channel_type"` + ChannelID string `json:"channel_id"` } const ( diff --git a/service/alerting/elasticsearch/engine.go b/service/alerting/elasticsearch/engine.go index 7a0c1239..3fdab54b 100644 --- a/service/alerting/elasticsearch/engine.go +++ b/service/alerting/elasticsearch/engine.go @@ -822,9 +822,6 @@ func (engine *Engine) Do(rule *alerting.Rule) error { if alertMessage == nil || period > periodDuration { actionResults, _ := performChannels(notifyCfg.Normal, paramsCtx, false) - if rule.ID == "builtin-calaqnh7h710dpnp2bm8" { - log.Info(actionResults) - } alertItem.ActionExecutionResults = actionResults //change and save last notification time in local kv store when action error count equals zero rule.LastNotificationTime = time.Now() @@ -1066,6 +1063,7 @@ func performChannels(channels []alerting.Channel, ctx map[string]interface{}, ra ExecutionTime: int(time.Now().UnixNano()/1e6), ChannelType: channel.SubType, ChannelName: channel.Name, + ChannelID: channel.ID, }) } return actionResults, errCount