From c07e311c7f3f83b3a75a42243329a8696c2d87f8 Mon Sep 17 00:00:00 2001 From: Hanshuo Tan Date: Fri, 9 Aug 2024 10:46:41 +1000 Subject: [PATCH] fix the var reference in the iif function --- pkg/backends/otlp/backend.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/backends/otlp/backend.go b/pkg/backends/otlp/backend.go index f165da27..4e795b09 100644 --- a/pkg/backends/otlp/backend.go +++ b/pkg/backends/otlp/backend.go @@ -292,9 +292,9 @@ func (bd *Backend) SendMetricsAsync(ctx context.Context, mm *gostatsd.MetricMap, eg, ectx := errgroup.WithContext(ctx) for _, b := range currentGroup.batches { atomic.AddUint64(&bd.batchesCreated, 1) - func(g group) { + func(currentBatch group) { eg.Go(func() error { - err := bd.postMetrics(ectx, b) + err := bd.postMetrics(ectx, currentBatch) if err != nil { bd.logger.WithError(err).WithFields(logrus.Fields{ "endpoint": bd.metricsEndpoint, @@ -302,7 +302,7 @@ func (bd *Backend) SendMetricsAsync(ctx context.Context, mm *gostatsd.MetricMap, atomic.AddUint64(&bd.batchesDropped, 1) } else { atomic.AddUint64(&bd.batchesSent, 1) - atomic.AddUint64(&bd.seriesSent, uint64(b.lenMetrics())) + atomic.AddUint64(&bd.seriesSent, uint64(currentBatch.lenMetrics())) } return err })