diff --git a/helper/metricsutil/gauge_process.go b/helper/metricsutil/gauge_process.go index 6cdf9812a..0cd1dd919 100644 --- a/helper/metricsutil/gauge_process.go +++ b/helper/metricsutil/gauge_process.go @@ -205,6 +205,8 @@ func (p *GaugeCollectionProcess) streamGaugesToSink(values []GaugeLabelValues) { // 1 second / 500 = 2 ms each, so we can send 25 per 50 milliseconds. // That should be one or two packets. sendTick := p.clock.NewTicker(50 * time.Millisecond) + defer sendTick.Stop() + batchSize := 25 for i, lv := range values { if i > 0 && i%batchSize == 0 { @@ -221,7 +223,6 @@ func (p *GaugeCollectionProcess) streamGaugesToSink(values []GaugeLabelValues) { } p.sink.SetGaugeWithLabels(p.key, lv.Value, lv.Labels) } - sendTick.Stop() } // Run should be called as a goroutine.