add reference channel id to alerting history

This commit is contained in:
liugq 2023-08-22 09:04:17 +08:00
parent 174126fa10
commit 522a5361a2
2 changed files with 2 additions and 3 deletions

View File

@ -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 (

View File

@ -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