mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
app/vmselect: properly serve static css for /select/.../metric-relabel-debug page
This commit is contained in:
parent
97b41e727c
commit
72ea387c86
2 changed files with 23 additions and 0 deletions
|
@ -74,6 +74,11 @@ func getDefaultMaxConcurrentRequests() int {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed static
|
||||||
|
var staticFiles embed.FS
|
||||||
|
|
||||||
|
var staticServer = http.FileServer(http.FS(staticFiles))
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Write flags and help message to stdout, since it is easier to grep or pipe.
|
// Write flags and help message to stdout, since it is easier to grep or pipe.
|
||||||
flag.CommandLine.SetOutput(os.Stdout)
|
flag.CommandLine.SetOutput(os.Stdout)
|
||||||
|
@ -300,11 +305,23 @@ func selectHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseW
|
||||||
fmt.Fprintf(w, "See <a href='https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format'>docs</a></br>")
|
fmt.Fprintf(w, "See <a href='https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format'>docs</a></br>")
|
||||||
fmt.Fprintf(w, "Useful endpoints:</br>")
|
fmt.Fprintf(w, "Useful endpoints:</br>")
|
||||||
fmt.Fprintf(w, `<a href="vmui">Web UI</a><br>`)
|
fmt.Fprintf(w, `<a href="vmui">Web UI</a><br>`)
|
||||||
|
fmt.Fprintf(w, `<a href="metric-relabel-debug">Metric-level relabel debugging</a></br>`)
|
||||||
fmt.Fprintf(w, `<a href="prometheus/api/v1/status/tsdb">tsdb status page</a><br>`)
|
fmt.Fprintf(w, `<a href="prometheus/api/v1/status/tsdb">tsdb status page</a><br>`)
|
||||||
fmt.Fprintf(w, `<a href="prometheus/api/v1/status/top_queries">top queries</a><br>`)
|
fmt.Fprintf(w, `<a href="prometheus/api/v1/status/top_queries">top queries</a><br>`)
|
||||||
fmt.Fprintf(w, `<a href="prometheus/api/v1/status/active_queries">active queries</a><br>`)
|
fmt.Fprintf(w, `<a href="prometheus/api/v1/status/active_queries">active queries</a><br>`)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(p.Suffix, "static") {
|
||||||
|
prefix := strings.Join([]string{"", p.Prefix, p.AuthToken}, "/")
|
||||||
|
http.StripPrefix(prefix, staticServer).ServeHTTP(w, r)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(p.Suffix, "prometheus/static") {
|
||||||
|
prefix := strings.Join([]string{"", p.Prefix, p.AuthToken}, "/")
|
||||||
|
r.URL.Path = strings.Replace(r.URL.Path, "/prometheus/static", "/static", 1)
|
||||||
|
http.StripPrefix(prefix, staticServer).ServeHTTP(w, r)
|
||||||
|
return true
|
||||||
|
}
|
||||||
if p.Suffix == "vmui" || p.Suffix == "graph" || p.Suffix == "prometheus/vmui" || p.Suffix == "prometheus/graph" {
|
if p.Suffix == "vmui" || p.Suffix == "graph" || p.Suffix == "prometheus/vmui" || p.Suffix == "prometheus/graph" {
|
||||||
// VMUI access via incomplete url without `/` in the end. Redirect to complete url.
|
// VMUI access via incomplete url without `/` in the end. Redirect to complete url.
|
||||||
// Use relative redirect, since, since the hostname and path prefix may be incorrect if VictoriaMetrics
|
// Use relative redirect, since, since the hostname and path prefix may be incorrect if VictoriaMetrics
|
||||||
|
|
6
app/vmselect/static/css/bootstrap.min.css
vendored
Normal file
6
app/vmselect/static/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue