Alerting: Fetch all applied alerting configurations (#65728)

* WIP

* skip invalid historic configurations instead of erroring

* add warning log when bad historic config is found

* remove unused custom marshaller for GettableHistoricUserConfig

* add id to historic user config, move limit check to store, fix typo

* swagger spec
This commit is contained in:
Santiago
2023-03-31 17:43:04 -03:00
committed by GitHub
parent 412fc4dcfb
commit aba91d3053
17 changed files with 920 additions and 117 deletions
@@ -33,6 +33,7 @@ type AlertmanagerApi interface {
RouteGetGrafanaAMAlerts(*contextmodel.ReqContext) response.Response
RouteGetGrafanaAMStatus(*contextmodel.ReqContext) response.Response
RouteGetGrafanaAlertingConfig(*contextmodel.ReqContext) response.Response
RouteGetGrafanaAlertingConfigHistory(*contextmodel.ReqContext) response.Response
RouteGetGrafanaReceivers(*contextmodel.ReqContext) response.Response
RouteGetGrafanaSilence(*contextmodel.ReqContext) response.Response
RouteGetGrafanaSilences(*contextmodel.ReqContext) response.Response
@@ -113,6 +114,9 @@ func (f *AlertmanagerApiHandler) RouteGetGrafanaAMStatus(ctx *contextmodel.ReqCo
func (f *AlertmanagerApiHandler) RouteGetGrafanaAlertingConfig(ctx *contextmodel.ReqContext) response.Response {
return f.handleRouteGetGrafanaAlertingConfig(ctx)
}
func (f *AlertmanagerApiHandler) RouteGetGrafanaAlertingConfigHistory(ctx *contextmodel.ReqContext) response.Response {
return f.handleRouteGetGrafanaAlertingConfigHistory(ctx)
}
func (f *AlertmanagerApiHandler) RouteGetGrafanaReceivers(ctx *contextmodel.ReqContext) response.Response {
return f.handleRouteGetGrafanaReceivers(ctx)
}
@@ -314,6 +318,16 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApi, m *metrics
m,
),
)
group.Get(
toMacaronPath("/api/alertmanager/grafana/config/history"),
api.authorize(http.MethodGet, "/api/alertmanager/grafana/config/history"),
metrics.Instrument(
http.MethodGet,
"/api/alertmanager/grafana/config/history",
srv.RouteGetGrafanaAlertingConfigHistory,
m,
),
)
group.Get(
toMacaronPath("/api/alertmanager/grafana/config/api/v1/receivers"),
api.authorize(http.MethodGet, "/api/alertmanager/grafana/config/api/v1/receivers"),