From 37068064dddcf07066abb89726038912f00aca71 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 19 May 2020 14:44:45 +0300 Subject: [PATCH] app/vmselect/promql: fix `outilersk` calculations --- app/vmselect/promql/aggr.go | 3 +++ app/vmselect/promql/exec_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/vmselect/promql/aggr.go b/app/vmselect/promql/aggr.go index 2e5e4ebac4..314916c4f6 100644 --- a/app/vmselect/promql/aggr.go +++ b/app/vmselect/promql/aggr.go @@ -648,6 +648,9 @@ func aggrFuncOutliersK(afa *aggrFuncArg) ([]*timeseries, error) { }) // Return only up to k time series with the highest variation. + for i := range variations { + tss[i] = variations[i].ts + } for i, k := range ks { fillNaNsAtIdx(i, k, tss) } diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index b9c38c3d9b..8ddeff1aa2 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -4221,7 +4221,7 @@ func TestExecSuccess(t *testing.T) { t.Run(`outliersk(1)`, func(t *testing.T) { t.Parallel() q := `outliersk(1, ( - label_set(1300, "foo", "bar"), + label_set(2000, "foo", "bar"), label_set(time(), "baz", "sss"), ))` r := netstorage.Result{