Push the new origin into the sample ring so a reset cannot underflow the totals
This commit is contained in:
@@ -263,11 +263,13 @@ func (d *direction) snapshot() sample {
|
||||
}
|
||||
|
||||
// Counters keep climbing in the workers, so resetting just moves the origin
|
||||
// everything is measured from. Rates are deliberately left running, since they
|
||||
// are instantaneous and would only blink to zero and back.
|
||||
// everything is measured from. Rates and the rolling error window are about now
|
||||
// rather than since the reset, so they keep running; the origin goes into the
|
||||
// ring so the newest bucket never sits behind it.
|
||||
func (d *direction) reset() {
|
||||
d.mu.Lock()
|
||||
d.base = d.capture(time.Now())
|
||||
d.win.push(d.base)
|
||||
d.mu.Unlock()
|
||||
|
||||
d.heldFrames = heldValue{}
|
||||
|
||||
Reference in New Issue
Block a user