From e996252aff599b32184923ae17c906d6972ac009 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 25 May 2021 15:49:58 +0300 Subject: [PATCH] Fix avg aggregation --- pkg/timeseries/timeseries.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/timeseries/timeseries.go b/pkg/timeseries/timeseries.go index 401b6ae..578ee1a 100644 --- a/pkg/timeseries/timeseries.go +++ b/pkg/timeseries/timeseries.go @@ -81,7 +81,8 @@ func AggAvg(points []TimePoint) *float64 { sum += *p.Value } } - return &sum + avg := sum / float64(len(points)) + return &avg } func AggMax(points []TimePoint) *float64 {