Revert "app/vmselect: expose vmui at /select/<accountID>/prometheus/vmui additionally to /select/<accountID>/vmui"

This reverts commit 885a79def6799f288e14df05b35a12569659ab85.

Reason for revert: Grafana doesn't allows accessing /select/<accountID>/prometheus/vmui :(
This commit is contained in:
Aliaksandr Valialkin 2021-07-12 09:07:50 +03:00
parent ddaa12050d
commit f5fa177141

View File

@ -239,14 +239,9 @@ func selectHandler(startTime time.Time, w http.ResponseWriter, r *http.Request,
httpRequests.Get(at).Inc() httpRequests.Get(at).Inc()
httpRequestsDuration.Get(at).Add(int(time.Since(startTime).Milliseconds())) httpRequestsDuration.Get(at).Add(int(time.Since(startTime).Milliseconds()))
}() }()
// Expose vmui at /select/<accountID>/vmui and at /select/<accountID>/prometheus/vmui . if strings.HasPrefix(p.Suffix, "vmui") {
// The /select/<accountID>/prometheus/vmui is needed for server-side Prometheus datasource in Grafana.
if strings.HasPrefix(p.Suffix, "vmui") || strings.HasPrefix(p.Suffix, "prometheus/vmui") {
// vmui access. // vmui access.
prefix := strings.Join([]string{"", p.Prefix, p.AuthToken}, "/") prefix := strings.Join([]string{"", p.Prefix, p.AuthToken}, "/")
if strings.HasPrefix(p.Suffix, "prometheus/") {
prefix += "/prometheus"
}
http.StripPrefix(prefix, vmuiFileServer).ServeHTTP(w, r) http.StripPrefix(prefix, vmuiFileServer).ServeHTTP(w, r)
return true return true
} }