Skip to content

Commit

Permalink
fix reset of slices
Browse files Browse the repository at this point in the history
  • Loading branch information
shaan420 committed Oct 30, 2023
1 parent 706152f commit 3bfe23d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,16 @@ func (s *scope) processLoop(interval time.Duration) {
s.reportChanges(counters, gauges)
s.cachedReporter.Flush()
// Reset the changed counters and gauges
var zeroCounter *counter
for i := range counters {
counters[i] = zeroCounter
}
counters = counters[:0]

var zeroGauge *gauge
for i := range gauges {
gauges[i] = zeroGauge
}
gauges = gauges[:0]
default:
return
Expand Down

0 comments on commit 3bfe23d

Please sign in to comment.