From de810031bf7949beeb1a4ecd72df709a05bb182b Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Wed, 29 Sep 2021 00:38:55 +0300 Subject: [PATCH] app/vmselect: always return zero for `stddev` func if there is only one value (#1659) The fix will always return zero if received set of items consists of one element only, which also means no deviation. Signed-off-by: hagen1778 --- app/vmselect/promql/rollup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index 6ad3bda67..d283ef6ff 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -1373,7 +1373,7 @@ func rollupStdvar(rfa *rollupFuncArg) float64 { } if len(values) == 1 { // Fast path. - return values[0] + return 0 } var avg float64 var count float64