persist recovered events
This commit is contained in:
parent
e515039ad4
commit
94a49c17f7
|
@ -44,10 +44,12 @@ func consume(events []interface{}, sema *semaphore.Semaphore) {
|
|||
func consumeOne(event *models.AlertCurEvent) {
|
||||
logEvent(event, "consume")
|
||||
persist(event)
|
||||
if event.NotifyRecovered == 1 {
|
||||
fillUsers(event)
|
||||
callback(event)
|
||||
notify(event)
|
||||
}
|
||||
}
|
||||
|
||||
func persist(event *models.AlertCurEvent) {
|
||||
has, err := models.AlertCurEventExists("hash=?", event.Hash)
|
||||
|
|
|
@ -352,7 +352,6 @@ func (r RuleEval) recoverRule(alertingKeys map[string]struct{}, now int64) {
|
|||
delete(r.fires, hash)
|
||||
delete(r.pendings, hash)
|
||||
|
||||
if r.rule.NotifyRecovered == 1 {
|
||||
event.IsRecovered = true
|
||||
event.LastEvalTime = now
|
||||
// 可能是因为调整了promql才恢复的,所以事件里边要体现最新的promql,否则用户会比较困惑
|
||||
|
@ -374,7 +373,6 @@ func (r RuleEval) recoverRule(alertingKeys map[string]struct{}, now int64) {
|
|||
r.pushEventToQueue(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r RuleEval) pushEventToQueue(event *models.AlertCurEvent) {
|
||||
if !event.IsRecovered {
|
||||
|
|
Loading…
Reference in New Issue