Prometheus: Use configured HTTP method for /series and /labels endpoints (#31401)

* Run post-friendly request with set method first

* Improve messaging, retry only when post and specific status code

* Add comments

* Fix backend

* Update public/app/plugins/datasource/prometheus/datasource.ts
This commit is contained in:
Ivana Huckova
2021-02-23 16:31:03 +01:00
committed by GitHub
parent 6d1076fca7
commit dce67db6ba
3 changed files with 28 additions and 6 deletions
+2 -2
View File
@@ -245,8 +245,8 @@ func (proxy *DataSourceProxy) validateRequest() error {
if proxy.ctx.Req.Request.Method == "PUT" {
return errors.New("puts not allowed on proxied Prometheus datasource")
}
if proxy.ctx.Req.Request.Method == "POST" && !(proxy.proxyPath == "api/v1/query" || proxy.proxyPath == "api/v1/query_range") {
return errors.New("posts not allowed on proxied Prometheus datasource except on /query and /query_range")
if proxy.ctx.Req.Request.Method == "POST" && !(proxy.proxyPath == "api/v1/query" || proxy.proxyPath == "api/v1/query_range" || proxy.proxyPath == "api/v1/series" || proxy.proxyPath == "api/v1/labels") {
return errors.New("posts not allowed on proxied Prometheus datasource except on /query, /query_range, /series and /labels")
}
}