From 4474c23aede2af5213b1810cf0a0eaf6d2d7036b Mon Sep 17 00:00:00 2001 From: hagen1778 Date: Tue, 20 Feb 2024 13:50:57 +0100 Subject: [PATCH] app/vmalert: consistently sort groups by name and filename on `/groups` page This should prevent non-deterministic sorting for groups with identical names. Signed-off-by: hagen1778 (cherry picked from commit e2dad3a2ac7ac2a654d4821de4bf4d218ac40493) --- app/vmalert/web.go | 6 +++++- docs/CHANGELOG.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/vmalert/web.go b/app/vmalert/web.go index fff17abded..152373f465 100644 --- a/app/vmalert/web.go +++ b/app/vmalert/web.go @@ -296,7 +296,11 @@ func (rh *requestHandler) groups(rf rulesFilter) []apiGroup { } // sort list of groups for deterministic output sort.Slice(groups, func(i, j int) bool { - return groups[i].Name < groups[j].Name + a, b := groups[i], groups[j] + if a.Name != b.Name { + return a.Name < b.Name + } + return a.File < b.File }) return groups } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ad568fd2c6..cf85b8b5fd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -79,6 +79,8 @@ Released at 2024-02-14 * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): clear entered text in select after selecting a value. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5727). * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): improve the operation of the context for autocomplete. See [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5736), [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5737) and [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5739) issues. * BUGFIX: [dashboards](https://grafana.com/orgs/victoriametrics): update `Storage full ETA` panels for Single-node and Cluster dashboards to prevent them from showing negative or blank results caused by increase of deduplicated samples. Deduplicated samples were part of the expression to provide a better estimate for disk usage, but due to sporadic nature of [deduplication](https://docs.victoriametrics.com/#deduplication) in VictoriaMetrics it rather produced skewed results. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5747). +* BUGFIX: [vmalert](https://docs.victoriametrics.com/#vmalert): consistently sort groups by name and filename on `/groups` page in UI. This should prevent non-deterministic sorting for groups with identical names. + # [v1.97.2](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.97.2)