mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 16:30:55 +01:00
app/vmselect: expose vmui at /select/<accountID>/prometheus/vmui additionally to /select/<accountID>/vmui
The /select/<accountID>/prometheus/vmui is needed for accessing via server-side Prometheus datasource for Grafana. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1413
This commit is contained in:
parent
0b98f6c7ff
commit
ddaa12050d
@ -239,9 +239,14 @@ func selectHandler(startTime time.Time, w http.ResponseWriter, r *http.Request,
|
||||
httpRequests.Get(at).Inc()
|
||||
httpRequestsDuration.Get(at).Add(int(time.Since(startTime).Milliseconds()))
|
||||
}()
|
||||
if strings.HasPrefix(p.Suffix, "vmui") {
|
||||
// Expose vmui at /select/<accountID>/vmui and at /select/<accountID>/prometheus/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.
|
||||
prefix := strings.Join([]string{"", p.Prefix, p.AuthToken}, "/")
|
||||
if strings.HasPrefix(p.Suffix, "prometheus/") {
|
||||
prefix += "/prometheus"
|
||||
}
|
||||
http.StripPrefix(prefix, vmuiFileServer).ServeHTTP(w, r)
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user