From 4e30693a26c5061ef3ab26ea08c890c1591ad5dd Mon Sep 17 00:00:00 2001 From: Artem Nikolayevsky Date: Mon, 6 May 2019 13:37:22 -0400 Subject: [PATCH 1/2] [Query] add POST to /series endpoint --- src/query/api/v1/handler/prometheus/remote/match.go | 4 ++-- src/query/api/v1/httpd/handler.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/query/api/v1/handler/prometheus/remote/match.go b/src/query/api/v1/handler/prometheus/remote/match.go index 37fde44dda..fdea14707f 100644 --- a/src/query/api/v1/handler/prometheus/remote/match.go +++ b/src/query/api/v1/handler/prometheus/remote/match.go @@ -38,8 +38,8 @@ const ( // PromSeriesMatchURL is the url for remote prom series matcher handler. PromSeriesMatchURL = handler.RoutePrefixV1 + "/series" - // PromSeriesMatchHTTPMethod is the HTTP method used with this resource. - PromSeriesMatchHTTPMethod = http.MethodGet + // PromSeriesMatchHTTPMethods are the HTTP methods used with this resource. + PromSeriesMatchHTTPMethods = []string{http.MethodGet, http.MethodPost} ) // PromSeriesMatchHandler represents a handler for prometheus series matcher endpoint. diff --git a/src/query/api/v1/httpd/handler.go b/src/query/api/v1/httpd/handler.go index b8bc2d11c4..5a6bfcb920 100644 --- a/src/query/api/v1/httpd/handler.go +++ b/src/query/api/v1/httpd/handler.go @@ -226,9 +226,11 @@ func (h *Handler) RegisterRoutes() error { } // Series match endpoints - h.router.HandleFunc(remote.PromSeriesMatchURL, - wrapped(remote.NewPromSeriesMatchHandler(h.storage, h.tagOptions)).ServeHTTP, - ).Methods(remote.PromSeriesMatchHTTPMethod) + for _, method := range remote.PromSeriesMatchHTTPMethods { + h.router.HandleFunc(remote.PromSeriesMatchURL, + wrapped(remote.NewPromSeriesMatchHandler(h.storage, h.tagOptions)).ServeHTTP, + ).Methods(method) + } // Debug endpoints h.router.HandleFunc(validator.PromDebugURL, From b855913f6d77ced893a1b584f0630f0337112371 Mon Sep 17 00:00:00 2001 From: Artem Nikolayevsky Date: Mon, 6 May 2019 13:43:45 -0400 Subject: [PATCH 2/2] Oops --- src/query/api/v1/handler/prometheus/remote/match.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/query/api/v1/handler/prometheus/remote/match.go b/src/query/api/v1/handler/prometheus/remote/match.go index fdea14707f..e83a444bf5 100644 --- a/src/query/api/v1/handler/prometheus/remote/match.go +++ b/src/query/api/v1/handler/prometheus/remote/match.go @@ -37,7 +37,9 @@ import ( const ( // PromSeriesMatchURL is the url for remote prom series matcher handler. PromSeriesMatchURL = handler.RoutePrefixV1 + "/series" +) +var ( // PromSeriesMatchHTTPMethods are the HTTP methods used with this resource. PromSeriesMatchHTTPMethods = []string{http.MethodGet, http.MethodPost} )