From f825d97de4d45dcbbff85fba7ed3f95d50f4640d Mon Sep 17 00:00:00 2001 From: Max Leonard Inden Date: Thu, 3 May 2018 12:21:36 +0200 Subject: [PATCH] api: Deprecate `api/alerts` endpoint With prometheus/prometheus commit e114ce0ff7a1ae06b24fdc479ffc7422074c1ebe [1] Prometheus switches from using `api/alerts` to `api/v1/alerts`. This commit is included starting from Prometheus v0.17.0. As discussed on the prometheus-developers mailing list [2] the deprecation period is long over. [1] github.com/prometheus/prometheus/commit/e114ce0ff7a1ae06b24fdc479ffc7422074c1ebe [2] https://groups.google.com/d/msg/prometheus-developers/2CCuFTMbmAg/Qg58rvyzAQAJ Signed-off-by: Max Leonard Inden --- api/api.go | 8 +------- cmd/alertmanager/main.go | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/api/api.go b/api/api.go index c3f133a7..060e977b 100644 --- a/api/api.go +++ b/api/api.go @@ -133,16 +133,10 @@ func (api *API) Register(r *route.Router) { r.Options("/*path", wrap(func(w http.ResponseWriter, r *http.Request) {})) - // Register legacy forwarder for alert pushing. - r.Post("/alerts", wrap(api.legacyAddAlerts)) - - // Register actual API. - r = r.WithPrefix("/v1") - r.Get("/status", wrap(api.status)) r.Get("/receivers", wrap(api.receivers)) - r.Get("/alerts/groups", wrap(api.alertGroups)) + r.Get("/alerts/groups", wrap(api.alertGroups)) r.Get("/alerts", wrap(api.listAlerts)) r.Post("/alerts", wrap(api.addAlerts)) diff --git a/cmd/alertmanager/main.go b/cmd/alertmanager/main.go index 19946926..fe72c561 100644 --- a/cmd/alertmanager/main.go +++ b/cmd/alertmanager/main.go @@ -370,7 +370,7 @@ func main() { ui.Register(router, webReload, logger) - apiv.Register(router.WithPrefix("/api")) + apiv.Register(router.WithPrefix("/api/v1")) level.Info(logger).Log("msg", "Listening", "address", *listenAddress) go listen(*listenAddress, router, logger)