Alerting: Expose info about notification delivery errors in a new /receivers endpoint (#55429)
* (WIP) switch to fork AM, first implementation of the API, generate spec * get receivers avoiding race conditions * use latest version of our forked AM, tests * make linter happy, delete TODO comment * update number of expected paths to += 2 * delete unused endpoint code, code review comments, tests * Update pkg/services/ngalert/notifier/alertmanager.go Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com> * remove call to fmt.Println * clear naming for fields * shorter variable names in GetReceivers Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
This commit is contained in:
co-authored by
Matthew Jacobson
parent
1e16dd5b7c
commit
09f8e026a1
@@ -33,6 +33,7 @@ type AlertmanagerApi interface {
|
||||
RouteGetGrafanaAMAlerts(*models.ReqContext) response.Response
|
||||
RouteGetGrafanaAMStatus(*models.ReqContext) response.Response
|
||||
RouteGetGrafanaAlertingConfig(*models.ReqContext) response.Response
|
||||
RouteGetGrafanaReceivers(*models.ReqContext) response.Response
|
||||
RouteGetGrafanaSilence(*models.ReqContext) response.Response
|
||||
RouteGetGrafanaSilences(*models.ReqContext) response.Response
|
||||
RouteGetSilence(*models.ReqContext) response.Response
|
||||
@@ -114,6 +115,9 @@ func (f *AlertmanagerApiHandler) RouteGetGrafanaAMStatus(ctx *models.ReqContext)
|
||||
func (f *AlertmanagerApiHandler) RouteGetGrafanaAlertingConfig(ctx *models.ReqContext) response.Response {
|
||||
return f.handleRouteGetGrafanaAlertingConfig(ctx)
|
||||
}
|
||||
func (f *AlertmanagerApiHandler) RouteGetGrafanaReceivers(ctx *models.ReqContext) response.Response {
|
||||
return f.handleRouteGetGrafanaReceivers(ctx)
|
||||
}
|
||||
func (f *AlertmanagerApiHandler) RouteGetGrafanaSilence(ctx *models.ReqContext) response.Response {
|
||||
// Parse Path Parameters
|
||||
silenceIdParam := web.Params(ctx.Req)[":SilenceId"]
|
||||
@@ -330,6 +334,16 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApi, m *metrics
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/grafana/config/api/v1/receivers"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/grafana/config/api/v1/receivers"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/grafana/config/api/v1/receivers",
|
||||
srv.RouteGetGrafanaReceivers,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/grafana/api/v2/silence/{SilenceId}"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/grafana/api/v2/silence/{SilenceId}"),
|
||||
|
||||
Reference in New Issue
Block a user