From f7d28bddbf320617fbdb17669fc2f6fd4581cf7a Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 12 Oct 2020 11:27:46 +0300 Subject: [PATCH] Revert "app/vmselect/promql: remove metric name from results of certain rollup functions in order to be consistent with Prometheus" This reverts commit e5202a4eaee52b3bf03f59fabdc09a84352857c4. Reason for revert: the previous behavior for VictoriaMetrics is easier to understand and use by users - functions, which don't change the meaning of the time series shouldn't drop metric name. Now the following functions do not drop metric name: * max_over_time * min_over_time * avg_over_time * quantile_over_time * geomean_over_time * mode_over_time * holt_winters * predict_linear Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/674 --- app/vmselect/promql/exec_test.go | 1 + app/vmselect/promql/rollup.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index 6a83fb473..6f347e613 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -3634,6 +3634,7 @@ func TestExecSuccess(t *testing.T) { Values: []float64{7.8, 9.9, 11.9, 13.9, 15.9, 17.9}, Timestamps: timestampsExpected, } + r.MetricName.MetricGroup = []byte("foobar") resultExpected := []netstorage.Result{r} f(q, resultExpected) }) diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index 6d612fee9..3c34d4301 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -169,12 +169,20 @@ var rollupFuncsRemoveCounterResets = map[string]bool{ } var rollupFuncsKeepMetricGroup = map[string]bool{ + "holt_winters": true, + "predict_linear": true, "default_rollup": true, + "avg_over_time": true, + "min_over_time": true, + "max_over_time": true, + "quantile_over_time": true, "rollup": true, + "geomean_over_time": true, "hoeffding_bound_lower": true, "hoeffding_bound_upper": true, "first_over_time": true, "last_over_time": true, + "mode_over_time": true, } func getRollupAggrFuncNames(expr metricsql.Expr) ([]string, error) {