aboutsummaryrefslogtreecommitdiffstats
path: root/metrics/resetting_timer.go
diff options
context:
space:
mode:
Diffstat (limited to 'metrics/resetting_timer.go')
-rw-r--r--metrics/resetting_timer.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/metrics/resetting_timer.go b/metrics/resetting_timer.go
index 57bcb3134..f33a9f8aa 100644
--- a/metrics/resetting_timer.go
+++ b/metrics/resetting_timer.go
@@ -210,7 +210,7 @@ func (t *ResettingTimerSnapshot) calc(percentiles []float64) {
// poor man's math.Round(x):
// math.Floor(x + 0.5)
indexOfPerc := int(math.Floor(((abs / 100.0) * float64(count)) + 0.5))
- if pct >= 0 {
+ if pct >= 0 && indexOfPerc > 0 {
indexOfPerc -= 1 // index offset=0
}
thresholdBoundary = t.values[indexOfPerc]