From d74f18f3c984a33ed884d2107a8057c5e0cbaa88 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Fri, 29 Dec 2023 18:57:11 -0800 Subject: [PATCH] always sort getOutputSeries labels for aggregate expr Signed-off-by: Ben Ye --- walk.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/walk.go b/walk.go index 305c134..a34064a 100644 --- a/walk.go +++ b/walk.go @@ -513,6 +513,9 @@ func getOutputSeries(expr parser.Expr) ([]labels.Labels, bool) { for _, v := range m { output = append(output, v) } + sort.Slice(output, func(i, j int) bool { + return labels.Compare(output[i], output[j]) < 0 + }) return output, false case *parser.SubqueryExpr: return getOutputSeries(node.Expr)