Skip to content

Commit

Permalink
add critical optimization todo
Browse files Browse the repository at this point in the history
  • Loading branch information
maciuszek committed Jan 16, 2025
1 parent 70cc61c commit b352a4f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ func (s *statStore) Flush() {

s.timers.Range(func(key, v interface{}) bool {
if timer, ok := v.(*reservoirTimer); ok {
// todo: this locking is uncessary, rewrite reservoirTimer to return all values and clear the counter and unlock right away, we can calculate sample rate here

// lock while flushing to:
// 1. provide correct sample rate
// 2. allow for exit despite continuous writes
Expand Down

0 comments on commit b352a4f

Please sign in to comment.