From 104f6495bf49cb11f6f4ca7df498f85dfc21e378 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 28 Jun 2026 20:00:00 +0800 Subject: [PATCH] metrics: fix inclusive boundary in runtime histogram percentile When a percentile threshold equals the cumulative count at a bucket boundary, assign that bucket instead of skipping to the next one. --- metrics/runtimehistogram.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metrics/runtimehistogram.go b/metrics/runtimehistogram.go index e975a570a464..9f1746d7ad3c 100644 --- a/metrics/runtimehistogram.go +++ b/metrics/runtimehistogram.go @@ -224,7 +224,7 @@ func (h *runtimeHistogramSnapshot) computePercentiles(thresh []float64) { for i, count := range h.internal.Counts { totalCount += float64(count) - for len(thresh) > 0 && thresh[0] < totalCount { + for len(thresh) > 0 && thresh[0] <= totalCount { thresh[0] = h.internal.Buckets[i] thresh = thresh[1:] }