Alerting: update state manager to return StateTransition instead of State (#58867)

* improve test for stale states
* update state manager return StateTransition
* update scheduler to accept state transitions
This commit is contained in:
Yuri Tseretyan
2022-12-06 13:07:39 -05:00
committed by GitHub
parent a85adeed96
commit abb49d96b5
6 changed files with 108 additions and 81 deletions

View File

@@ -371,7 +371,7 @@ func (sch *schedule) ruleRoutine(grafanaCtx context.Context, key ngmodels.AlertR
return
}
processedStates := sch.stateManager.ProcessEvalResults(ctx, e.scheduledAt, e.rule, results, sch.getRuleExtraLabels(e))
alerts := FromAlertStateToPostableAlerts(processedStates, sch.stateManager, sch.appURL)
alerts := FromStateTransitionToPostableAlerts(processedStates, sch.stateManager, sch.appURL)
if len(alerts.PostableAlerts) > 0 {
sch.alertsSender.Send(key, alerts)
}