From 13331a4f75a17993bb3e90a743a01a1a56d6c738 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Thu, 20 Jul 2023 16:44:08 +0800 Subject: [PATCH] fix: dec aggregator.Result invoke times --- metrics/prometheus/model.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/metrics/prometheus/model.go b/metrics/prometheus/model.go index fbfeb7a94f..3efd2149ce 100644 --- a/metrics/prometheus/model.go +++ b/metrics/prometheus/model.go @@ -373,9 +373,10 @@ func (gv *aggregateFunctionsGaugeVec) update(labels *prometheus.Labels, curValue cur.Add(float64(curValue)) updateFunc := func(aggregator *aggregate.TimeWindowAggregator) { - gv.min.With(*labels).Set(aggregator.Result().Min) - gv.max.With(*labels).Set(aggregator.Result().Max) - gv.avg.With(*labels).Set(aggregator.Result().Avg) + result := aggregator.Result() + gv.min.With(*labels).Set(result.Min) + gv.max.With(*labels).Set(result.Max) + gv.avg.With(*labels).Set(result.Avg) } if actual, loaded := gv.syncMap.LoadOrStore(key, cur); loaded {