diff --git a/README.md b/README.md index 34f2f923b..4a3733d03 100644 --- a/README.md +++ b/README.md @@ -348,6 +348,12 @@ http://:8428 Substitute `` with the hostname or IP address of VictoriaMetrics. +In the "Type and version" section it is recommended to set the type to "Prometheus" and the version to at least "2.24.x": + +Grafana datasource + +This allows Grafana to use a more efficient API to get label values. + Then build graphs and dashboards for the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). diff --git a/app/vmselect/main.go b/app/vmselect/main.go index c299d500e..c239852a4 100644 --- a/app/vmselect/main.go +++ b/app/vmselect/main.go @@ -537,7 +537,10 @@ func handleStaticAndSimpleRequests(w http.ResponseWriter, r *http.Request, path case "/api/v1/status/buildinfo": buildInfoRequests.Inc() w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, "%s", `{"status":"success","data":{}}`) + // prometheus version is used here, which affects what API Grafana uses when retrieving label values. + // as new Grafana features are added that are customized for the Prometheus version, maybe the version will need to be increased. + // see this issue for more info: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5370 + fmt.Fprintf(w, "%s", `{"status":"success","data":{"version":"2.24.0"}}`) return true case "/api/v1/query_exemplars": // Return dumb placeholder for https://prometheus.io/docs/prometheus/latest/querying/api/#querying-exemplars diff --git a/deployment/docker/provisioning/datasources/datasource.yml b/deployment/docker/provisioning/datasources/datasource.yml index c0a7a20c9..9b768a337 100644 --- a/deployment/docker/provisioning/datasources/datasource.yml +++ b/deployment/docker/provisioning/datasources/datasource.yml @@ -6,9 +6,15 @@ datasources: access: proxy url: http://victoriametrics:8428 isDefault: true + jsonData: + prometheusType: Prometheus + prometheusVersion: 2.24.0 - name: VictoriaMetrics - cluster type: prometheus access: proxy url: http://vmauth:8427/select/0/prometheus - isDefault: false \ No newline at end of file + isDefault: false + jsonData: + prometheusType: Prometheus + prometheusVersion: 2.24.0 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5d873e9c0..9e2da5d25 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -52,6 +52,7 @@ The sandbox cluster installation is running under the constant load generated by * `go_gc_pauses_seconds` - the [histogram](https://docs.victoriametrics.com/keyConcepts.html#histogram), which shows the duration of GC pauses. * `go_scavenge_cpu_seconds_total` - the [counter](https://docs.victoriametrics.com/keyConcepts.html#counter), which shows the total CPU time spent by Go runtime for returning memory to the Operating System. * `go_memlimit_bytes` - the value of [GOMEMLIMIT](https://pkg.go.dev/runtime#hdr-Environment_Variables) environment variable. +* FEATURE: add field `version` to the response for `/api/v1/status/buildinfo` API for using more efficient API in Grafana for receiving label values. Add additional info about setup Grafana datasource. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5370) and [these docs](https://docs.victoriametrics.com/#grafana-setup) for details. * BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly calculate values for the first point on the graph for queries, which do not use [rollup functions](https://docs.victoriametrics.com/MetricsQL.html#rollup-functions). For example, previously `count(up)` could return lower than expected values for the first point on the graph. This also could result in lower than expected values in the middle of the graph like in [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5388) when the response caching isn't disabled. The issue has been introduced in [v1.95.0](https://docs.victoriametrics.com/CHANGELOG.html#v1950). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): prevent from `FATAL: cannot flush metainfo` panic when [`-remoteWrite.multitenantURL`](https://docs.victoriametrics.com/vmagent.html#multitenancy) command-line flag is set. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5357). @@ -62,7 +63,6 @@ The sandbox cluster installation is running under the constant load generated by * BUGFIX: [vminsert](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): fix panic when ingesting data via [NewRelic protocol](https://docs.victoriametrics.com/#how-to-send-data-from-newrelic-agent) into VictoriaMetrics cluster. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5416). * BUGFIX: properly escape `<` character in responses returned via [`/federate`](https://docs.victoriametrics.com/#federation) endpoint. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5431). - ## [v1.95.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.95.1) Released at 2023-11-16 diff --git a/docs/README.md b/docs/README.md index b73cc2aba..2ccab07b3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -351,6 +351,12 @@ http://:8428 Substitute `` with the hostname or IP address of VictoriaMetrics. +In the "Type and version" section it is recommended to set the type to "Prometheus" and the version to at least "2.24.x": + +Grafana datasource + +This allows Grafana to use a more efficient API to get label values. + Then build graphs and dashboards for the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). diff --git a/docs/grafana-datasource-prometheus.png b/docs/grafana-datasource-prometheus.png new file mode 100644 index 000000000..dfb9cae8c Binary files /dev/null and b/docs/grafana-datasource-prometheus.png differ diff --git a/docs/guides/grafana-vmgateway-openid-configuration.md b/docs/guides/grafana-vmgateway-openid-configuration.md index 35a0579ac..d53c1ce3a 100644 --- a/docs/guides/grafana-vmgateway-openid-configuration.md +++ b/docs/guides/grafana-vmgateway-openid-configuration.md @@ -197,6 +197,12 @@ It is also possible to provide the public keys directly via the `-auth.publicKey Create a new Prometheus datasource in Grafana with the following URL `http://:8431`. URL should point to the vmgateway instance. +In the "Type and version" section it is recommended to set the type to "Prometheus" and the version to at least "2.24.x": + +Grafana datasource + +This allows Grafana to use a more efficient API to get label values. + You can also use VictoriaMetrics [Grafana datasource](https://github.com/VictoriaMetrics/grafana-datasource) plugin. See installation instructions [here](https://github.com/VictoriaMetrics/grafana-datasource#installation). diff --git a/docs/guides/grafana-vmgateway-openid-configuration/grafana-datasource-prometheus.png b/docs/guides/grafana-vmgateway-openid-configuration/grafana-datasource-prometheus.png new file mode 100644 index 000000000..dfb9cae8c Binary files /dev/null and b/docs/guides/grafana-vmgateway-openid-configuration/grafana-datasource-prometheus.png differ