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{