Skip to content

Commit

Permalink
Ignore sampling interval for first samples (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop authored Jan 13, 2021
1 parent 4fc722a commit dca842d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type sample struct {
}

func (en *entry) push(now int64, sample sample) {
atomic.AddUint64(&en.count, 1)
cnt := atomic.AddUint64(&en.count, 1)

if en.distribution != nil {
en.distribution.Add(float64(now))
Expand All @@ -83,7 +83,7 @@ func (en *entry) push(now int64, sample sample) {
}
}

if now <= atomic.LoadInt64(&en.latest) {
if cnt > uint64(cap(en.samples)) && now <= atomic.LoadInt64(&en.latest) {
return
}

Expand Down

0 comments on commit dca842d

Please sign in to comment.