From c5f0b454f0db8a6cb01f7cbadcb55a194cc23857 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 7 Jul 2021 17:28:06 +0300 Subject: [PATCH] app/vmselect: follow-up after aa11ef6d3b9ff29c7dad917d2e617186ad417d15 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1413 --- README.md | 6 +++--- app/victoria-metrics/main.go | 1 + app/vmagent/README.md | 4 ++-- app/vmalert/README.md | 4 ++-- app/vmauth/README.md | 2 +- app/vmbackup/README.md | 2 +- app/vmctl/README.md | 4 ++-- app/vmrestore/README.md | 2 +- app/vmselect/main.go | 16 ++++++++++------ deployment/docker/Makefile | 11 +++++------ docs/CHANGELOG.md | 1 + docs/Cluster-VictoriaMetrics.md | 2 +- docs/README.md | 6 +++--- docs/Single-server-VictoriaMetrics.md | 6 +++--- docs/vmagent.md | 4 ++-- docs/vmalert.md | 4 ++-- docs/vmauth.md | 2 +- docs/vmbackup.md | 2 +- docs/vmctl.md | 4 ++-- docs/vmrestore.md | 2 +- 20 files changed, 45 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 5f5835e28..ed0f3a46d 100644 --- a/README.md +++ b/README.md @@ -664,7 +664,7 @@ to your needs or when testing bugfixes. ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics` binary and puts it into the `bin` folder. @@ -680,7 +680,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics-arm` or `make victoria-metrics-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics-arm` or `victoria-metrics-arm64` binary respectively and puts it into the `bin` folder. @@ -694,7 +694,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b `Pure Go` mode builds only Go code without [cgo](https://golang.org/cmd/cgo/) dependencies. -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics-pure` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics-pure` binary and puts it into the `bin` folder. diff --git a/app/victoria-metrics/main.go b/app/victoria-metrics/main.go index 164b06960..9c630d981 100644 --- a/app/victoria-metrics/main.go +++ b/app/victoria-metrics/main.go @@ -90,6 +90,7 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { fmt.Fprintf(w, "See docs at https://docs.victoriametrics.com/
") fmt.Fprintf(w, "Useful endpoints:
") httpserver.WriteAPIHelp(w, [][2]string{ + {"/ui", "Web UI"}, {"/targets", "discovered targets list"}, {"/api/v1/targets", "advanced information about discovered targets in JSON format"}, {"/metrics", "available service metrics"}, diff --git a/app/vmagent/README.md b/app/vmagent/README.md index 3ded034c7..7b1d02fd9 100644 --- a/app/vmagent/README.md +++ b/app/vmagent/README.md @@ -449,7 +449,7 @@ We recommend using [binary releases](https://github.com/VictoriaMetrics/Victoria ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmagent` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds the `vmagent` binary and puts it into the `bin` folder. @@ -478,7 +478,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmagent-arm` or `make vmagent-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics) It builds `vmagent-arm` or `vmagent-arm64` binary respectively and puts it into the `bin` folder. diff --git a/app/vmalert/README.md b/app/vmalert/README.md index 4eb8d4aeb..aeab4325c 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -558,7 +558,7 @@ It is recommended using ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmalert` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmalert` binary and puts it into the `bin` folder. @@ -575,7 +575,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmalert-arm` or `make vmalert-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmalert-arm` or `vmalert-arm64` binary respectively and puts it into the `bin` folder. diff --git a/app/vmauth/README.md b/app/vmauth/README.md index 34333e2f2..ff4173549 100644 --- a/app/vmauth/README.md +++ b/app/vmauth/README.md @@ -146,7 +146,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmauth` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmauth` binary and puts it into the `bin` folder. diff --git a/app/vmbackup/README.md b/app/vmbackup/README.md index ab6209175..54deddce7 100644 --- a/app/vmbackup/README.md +++ b/app/vmbackup/README.md @@ -235,7 +235,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmbackup` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmbackup` binary and puts it into the `bin` folder. diff --git a/app/vmctl/README.md b/app/vmctl/README.md index 5127cecd9..5911e1226 100644 --- a/app/vmctl/README.md +++ b/app/vmctl/README.md @@ -22,7 +22,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmctl` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmctl` binary and puts it into the `bin` folder. @@ -51,7 +51,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b #### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmctl-arm` or `make vmctl-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmctl-arm` or `vmctl-arm64` binary respectively and puts it into the `bin` folder. diff --git a/app/vmrestore/README.md b/app/vmrestore/README.md index e760dbce8..18a9920fa 100644 --- a/app/vmrestore/README.md +++ b/app/vmrestore/README.md @@ -131,7 +131,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmrestore` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmrestore` binary and puts it into the `bin` folder. diff --git a/app/vmselect/main.go b/app/vmselect/main.go index 72f47f378..efe04301c 100644 --- a/app/vmselect/main.go +++ b/app/vmselect/main.go @@ -23,10 +23,6 @@ import ( "github.com/VictoriaMetrics/metrics" ) -// static content -//go:embed ui -var files embed.FS - var ( deleteAuthKey = flag.String("deleteAuthKey", "", "authKey for metrics' deletion via /api/v1/admin/tsdb/delete_series and /tags/delSeries") maxConcurrentRequests = flag.Int("search.maxConcurrentRequests", getDefaultMaxConcurrentRequests(), "The maximum number of concurrent search requests. "+ @@ -82,15 +78,23 @@ var ( }) ) +// static content +//go:embed ui +var uiFiles embed.FS + +var uiFileServer = http.FileServer(http.FS(uiFiles)) + // RequestHandler handles remote read API requests func RequestHandler(w http.ResponseWriter, r *http.Request) bool { // ui access. if strings.HasPrefix(r.URL.Path, "/ui") { - http.FileServer(http.FS(files)).ServeHTTP(w, r) + uiFileServer.ServeHTTP(w, r) return true } + startTime := time.Now() - defer requestDuration.UpdateDuration(startTime) + defer requestDuration.UpdateDuration(startTime) + // Limit the number of concurrent queries. select { case concurrencyCh <- struct{}{}: diff --git a/deployment/docker/Makefile b/deployment/docker/Makefile index 64755f3d6..af8b6aa12 100644 --- a/deployment/docker/Makefile +++ b/deployment/docker/Makefile @@ -8,13 +8,12 @@ GO_BUILDER_IMAGE := golang:1.16.5 BUILDER_IMAGE := local/builder:2.0.0-$(shell echo $(GO_BUILDER_IMAGE) | tr : _) BASE_IMAGE := local/base:1.1.3-$(shell echo $(ROOT_IMAGE) | tr : _)-$(shell echo $(CERTS_IMAGE) | tr : _) VMUI_VERSION=v0.1.0 -VMUI_RELEASE=https://github.com/VictoriaMetrics/vmui/releases -vmui: - cd app/vmselect/ui && \ - wget ${VMUI_RELEASE}/download/${VMUI_VERSION}/static.zip \ - -O /tmp/static.zip; unzip /tmp/static.zip -d /tmp; \ - rm -rf ./*; mv /tmp/build/* ./ +vmui-update: + curl -L https://github.com/VictoriaMetrics/vmui/releases/download/${VMUI_VERSION}/static.zip > vmui-static.zip && \ + unzip vmui-static.zip -d vmui-static && \ + rm -rf app/vmselect/ui/* && mv vmui-static/build/* app/vmselect/ui && \ + rm -rf vmui-static vmui-static.zip package-base: (docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BASE_IMAGE)$$') \ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 47988d05e..ee76786fe 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,6 +10,7 @@ sort: 15 * FEATURE: reduce memory usage by up to 30% on production workloads. * FEATURE: log http request path plus all the query args on errors during request processing. Previously only http request path was logged without query args, so it could be hard debugging such errors. * FEATURE: export `vmselect_request_duration_seconds` and `vminsert_request_duration_seconds` [VictoriaMetrics histograms](https://valyala.medium.com/improving-histogram-usability-for-prometheus-and-grafana-bc7e5df0e350) at `/metrics` page. These histograms can be used for determining latency distribution for the served requests. +* FEATURE: vmselect: embed [vmui](https://github.com/VictoriaMetrics/vmui) into a single-node VictoriaMetrics and into `vmselect` component of cluster version. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1413). The web interface is available at `/ui` page. * BUGFIX: vmagent: remove `{ %space %}` typo in `/targets` output. The typo has been introduced in v1.62.0. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1408). * BUGFIX: vmagent: fix CSS styles on `/targets` page. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1422). diff --git a/docs/Cluster-VictoriaMetrics.md b/docs/Cluster-VictoriaMetrics.md index e5430e0b9..2f0abb4be 100644 --- a/docs/Cluster-VictoriaMetrics.md +++ b/docs/Cluster-VictoriaMetrics.md @@ -101,7 +101,7 @@ vmstorage-prod ### Development Builds -1. [Install go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make` from [the repository root](https://github.com/VictoriaMetrics/VictoriaMetrics). It should build `vmstorage`, `vmselect` and `vminsert` binaries and put them into the `bin` folder. diff --git a/docs/README.md b/docs/README.md index 5f5835e28..ed0f3a46d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -664,7 +664,7 @@ to your needs or when testing bugfixes. ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics` binary and puts it into the `bin` folder. @@ -680,7 +680,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics-arm` or `make victoria-metrics-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics-arm` or `victoria-metrics-arm64` binary respectively and puts it into the `bin` folder. @@ -694,7 +694,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b `Pure Go` mode builds only Go code without [cgo](https://golang.org/cmd/cgo/) dependencies. -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics-pure` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics-pure` binary and puts it into the `bin` folder. diff --git a/docs/Single-server-VictoriaMetrics.md b/docs/Single-server-VictoriaMetrics.md index 1bf389069..a5b31cb1b 100644 --- a/docs/Single-server-VictoriaMetrics.md +++ b/docs/Single-server-VictoriaMetrics.md @@ -668,7 +668,7 @@ to your needs or when testing bugfixes. ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics` binary and puts it into the `bin` folder. @@ -684,7 +684,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics-arm` or `make victoria-metrics-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics-arm` or `victoria-metrics-arm64` binary respectively and puts it into the `bin` folder. @@ -698,7 +698,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b `Pure Go` mode builds only Go code without [cgo](https://golang.org/cmd/cgo/) dependencies. -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make victoria-metrics-pure` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `victoria-metrics-pure` binary and puts it into the `bin` folder. diff --git a/docs/vmagent.md b/docs/vmagent.md index a7f28c5ea..0eeb38532 100644 --- a/docs/vmagent.md +++ b/docs/vmagent.md @@ -453,7 +453,7 @@ We recommend using [binary releases](https://github.com/VictoriaMetrics/Victoria ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmagent` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds the `vmagent` binary and puts it into the `bin` folder. @@ -482,7 +482,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmagent-arm` or `make vmagent-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics) It builds `vmagent-arm` or `vmagent-arm64` binary respectively and puts it into the `bin` folder. diff --git a/docs/vmalert.md b/docs/vmalert.md index 602d989e6..1d7575807 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -562,7 +562,7 @@ It is recommended using ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmalert` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmalert` binary and puts it into the `bin` folder. @@ -579,7 +579,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmalert-arm` or `make vmalert-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmalert-arm` or `vmalert-arm64` binary respectively and puts it into the `bin` folder. diff --git a/docs/vmauth.md b/docs/vmauth.md index 6253a1681..4e08b06a4 100644 --- a/docs/vmauth.md +++ b/docs/vmauth.md @@ -150,7 +150,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmauth` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmauth` binary and puts it into the `bin` folder. diff --git a/docs/vmbackup.md b/docs/vmbackup.md index 930d735a6..c4f646bae 100644 --- a/docs/vmbackup.md +++ b/docs/vmbackup.md @@ -239,7 +239,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmbackup` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmbackup` binary and puts it into the `bin` folder. diff --git a/docs/vmctl.md b/docs/vmctl.md index 42d491717..75316fd12 100644 --- a/docs/vmctl.md +++ b/docs/vmctl.md @@ -26,7 +26,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmctl` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmctl` binary and puts it into the `bin` folder. @@ -55,7 +55,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b #### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmctl-arm` or `make vmctl-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmctl-arm` or `vmctl-arm64` binary respectively and puts it into the `bin` folder. diff --git a/docs/vmrestore.md b/docs/vmrestore.md index ea9423332..75945bc2d 100644 --- a/docs/vmrestore.md +++ b/docs/vmrestore.md @@ -135,7 +135,7 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.15. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. 2. Run `make vmrestore` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmrestore` binary and puts it into the `bin` folder.