[v10.2.x] Alerting: Fix NoData & Error alerts not resolving when rule is reset (#80241)

Alerting: Fix NoData & Error alerts not resolving when rule is reset (#80184)

* Alerting: Fix NoData & Error alerts not resolving when rule is reset

On rule reset, when creating the PostableAlerts StateToPostableAlert did not
attach the correct NoData/Error alertname and rulename labels to expire/resolve
the active alerts when the previous cached state was NoData/Error.

(cherry picked from commit 1d4419fbe4)

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-01-09 15:04:07 -05:00
committed by GitHub
co-authored by Matthew Jacobson
parent 715aaed12c
commit e6a70ccf9a
4 changed files with 94 additions and 38 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ func (srv TestingApiSrv) RouteTestGrafanaRuleConfig(c *contextmodel.ReqContext,
alerts := make([]*amv2.PostableAlert, 0, len(transitions))
for _, alertState := range transitions {
alerts = append(alerts, state.StateToPostableAlert(alertState.State, srv.appUrl))
alerts = append(alerts, state.StateToPostableAlert(alertState, srv.appUrl))
}
return response.JSON(http.StatusOK, alerts)