From 89819f2054d19b29eaa24745cb4cd6d2da207a87 Mon Sep 17 00:00:00 2001 From: hagen1778 Date: Wed, 22 May 2024 16:32:51 +0200 Subject: [PATCH] dashboards: use `$__interval` variable for offsets and look-behind windows in annotations This should improve precision of `restarts` and `version change` annotations when zooming-in/zooming-out on the dashboards. The change also makes `restarts` dashboard visible on the panels, so user can disable it from displaying if needed. This could be useful when restarts overlap with version change events. Signed-off-by: hagen1778 (cherry picked from commit 9dd9b4442f7a64b9d0f662a8354a1b6cd5d08a63) --- dashboards/victorialogs.json | 4 ++-- dashboards/victoriametrics-cluster.json | 5 ++--- dashboards/victoriametrics.json | 2 +- dashboards/vm/victoriametrics-cluster.json | 5 ++--- dashboards/vm/victoriametrics.json | 2 +- dashboards/vm/vmagent.json | 5 ++--- dashboards/vm/vmalert.json | 5 ++--- dashboards/vmagent.json | 5 ++--- dashboards/vmalert.json | 5 ++--- docs/CHANGELOG.md | 2 ++ 10 files changed, 18 insertions(+), 22 deletions(-) diff --git a/dashboards/victorialogs.json b/dashboards/victorialogs.json index 1ea7a2d918..60f282df5f 100644 --- a/dashboards/victorialogs.json +++ b/dashboards/victorialogs.json @@ -53,7 +53,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(short_version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(short_version))", "hide": true, "iconColor": "blue", "name": "version change", @@ -66,7 +66,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job)", + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job)", "hide": true, "iconColor": "orange", "name": "restarts", diff --git a/dashboards/victoriametrics-cluster.json b/dashboards/victoriametrics-cluster.json index 2c11b3d065..40e6687c7a 100644 --- a/dashboards/victoriametrics-cluster.json +++ b/dashboards/victoriametrics-cluster.json @@ -76,7 +76,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(version))", "hide": true, "iconColor": "dark-blue", "name": "version change", @@ -89,8 +89,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job)", - "hide": true, + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job)", "iconColor": "dark-yellow", "name": "restarts", "textFormat": "{{job}} restarted" diff --git a/dashboards/victoriametrics.json b/dashboards/victoriametrics.json index 785bc07be2..3703a5558d 100644 --- a/dashboards/victoriametrics.json +++ b/dashboards/victoriametrics.json @@ -76,7 +76,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(version))", "hide": true, "iconColor": "dark-blue", "name": "version", diff --git a/dashboards/vm/victoriametrics-cluster.json b/dashboards/vm/victoriametrics-cluster.json index 2c6d8b3724..21f4185e52 100644 --- a/dashboards/vm/victoriametrics-cluster.json +++ b/dashboards/vm/victoriametrics-cluster.json @@ -77,7 +77,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(version))", "hide": true, "iconColor": "dark-blue", "name": "version change", @@ -90,8 +90,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job)", - "hide": true, + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job)", "iconColor": "dark-yellow", "name": "restarts", "textFormat": "{{job}} restarted" diff --git a/dashboards/vm/victoriametrics.json b/dashboards/vm/victoriametrics.json index 88094431c5..c324fafdd0 100644 --- a/dashboards/vm/victoriametrics.json +++ b/dashboards/vm/victoriametrics.json @@ -77,7 +77,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(version))", "hide": true, "iconColor": "dark-blue", "name": "version", diff --git a/dashboards/vm/vmagent.json b/dashboards/vm/vmagent.json index 9376effd9b..d9e5fdc982 100644 --- a/dashboards/vm/vmagent.json +++ b/dashboards/vm/vmagent.json @@ -66,7 +66,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(short_version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(short_version))", "hide": true, "iconColor": "dark-blue", "name": "version", @@ -79,8 +79,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job, instance)", - "hide": true, + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job, instance)", "iconColor": "dark-yellow", "name": "restarts", "textFormat": "{{job}}:{{instance}} restarted" diff --git a/dashboards/vm/vmalert.json b/dashboards/vm/vmalert.json index cc63b9e6a5..d990555fc6 100644 --- a/dashboards/vm/vmalert.json +++ b/dashboards/vm/vmalert.json @@ -60,7 +60,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(short_version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(short_version))", "hide": true, "iconColor": "dark-blue", "name": "version", @@ -73,8 +73,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job, instance)", - "hide": true, + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job, instance)", "iconColor": "dark-yellow", "name": "restarts", "textFormat": "{{job}}:{{instance}} restarted" diff --git a/dashboards/vmagent.json b/dashboards/vmagent.json index 415416478c..80c6bddb8b 100644 --- a/dashboards/vmagent.json +++ b/dashboards/vmagent.json @@ -65,7 +65,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(short_version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(short_version))", "hide": true, "iconColor": "dark-blue", "name": "version", @@ -78,8 +78,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job, instance)", - "hide": true, + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job, instance)", "iconColor": "dark-yellow", "name": "restarts", "textFormat": "{{job}}:{{instance}} restarted" diff --git a/dashboards/vmalert.json b/dashboards/vmalert.json index 2e23aed0c8..e7904f1893 100644 --- a/dashboards/vmalert.json +++ b/dashboards/vmalert.json @@ -59,7 +59,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset 20m) by(short_version))", + "expr": "sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"}) by(short_version) unless (sum(vm_app_version{job=~\"$job\", instance=~\"$instance\"} offset $__interval) by(short_version))", "hide": true, "iconColor": "dark-blue", "name": "version", @@ -72,8 +72,7 @@ "uid": "$ds" }, "enable": true, - "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[5m])) by(job, instance)", - "hide": true, + "expr": "sum(changes(vm_app_start_timestamp{job=~\"$job\", instance=~\"$instance\"}[$__interval])) by(job, instance)", "iconColor": "dark-yellow", "name": "restarts", "textFormat": "{{job}}:{{instance}} restarted" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 16bab3d6d7..34282c1ef0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -31,6 +31,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). ## tip **Update note 1: the `-remoteWrite.multitenantURL` command-line flag at `vmagent` was removed starting from this release. This flag was deprecated since [v1.96.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.96.0). Use `-enableMultitenantHandlers` instead, as it is easier to use and combine with [multitenant URL at vminsert](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy-via-labels). See these [docs for details](https://docs.victoriametrics.com/vmagent.html#multitenancy).** + **Update note 2: the `-streamAggr.dropInputLabels` command-line flag at `vmagent` was renamed to `-remoteWrite.streamAggr.dropInputLabels`. `-streamAggr.dropInputLabels` is now used for global streaming aggregation.** * SECURITY: upgrade Go builder from Go1.22.2 to Go1.22.3. See [the list of issues addressed in Go1.22.3](https://github.com/golang/go/issues?q=milestone%3AGo1.22.3+label%3ACherryPickApproved). @@ -49,6 +50,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert/): speed up retrieving rules files from object storages by skipping unchanged objects during reloading. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6210). * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert/): support reading [DNS SRV](https://en.wikipedia.org/wiki/SRV_record) records in `-datasource.url`, `-remoteWrite.url` and `-remoteRead.url` command-line option. For example, `-remoteWrite.url=http://srv+victoria-metrics` automatically resolves the `victoria-metrics` DNS SRV to a list of hostnames with TCP ports and then sends data to one of the addresses. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6053). * FEATURE: [vmbackup](https://docs.victoriametrics.com/vmbackup/), [vmrestore](https://docs.victoriametrics.com/vmrestore/), [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager/): add `-s3TLSInsecureSkipVerify` command-line flag for skipping TLS certificates verification when connecting to S3 endpoint. +* FEATURE: [dashboards](https://grafana.com/orgs/victoriametrics): use `$__interval` variable for offsets and look-behind windows in annotations. This should improve precision of `restarts` and `version change` annotations when zooming-in/zooming-out on the dashboards. * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix bug that prevents the first query trace from expanding on click event. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6186). The issue was introduced in [v1.100.0](https://docs.victoriametrics.com/changelog/#v11000) release. * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix calendar display when `UTC+00:00` timezone is set. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6239).