add recover_time only when IsRecovered

This commit is contained in:
Ulric Qin 2021-12-08 00:17:42 +08:00
parent 0e88f0074c
commit 5e19eadd61
1 changed files with 3 additions and 1 deletions

View File

@ -54,8 +54,10 @@ func (e *AlertCurEvent) IncRepeatStep(step int64) error {
func (e *AlertCurEvent) ToHis() *AlertHisEvent {
isRecovered := 0
var recoverTime int64 = 0
if e.IsRecovered {
isRecovered = 1
recoverTime = e.LastEvalTime
}
return &AlertHisEvent{
@ -80,7 +82,7 @@ func (e *AlertCurEvent) ToHis() *AlertHisEvent {
TriggerTime: e.TriggerTime,
TriggerValue: e.TriggerValue,
Tags: e.Tags,
RecoverTime: e.LastEvalTime,
RecoverTime: recoverTime,
}
}