mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #91777 from ahg-g/ahg-hist
Added +inf bucket for quantile computations
This commit is contained in:
commit
d6b42f0049
@ -286,8 +286,14 @@ func (hist *Histogram) Quantile(q float64) float64 {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// bucketQuantile expects the upper bound of the last bucket to be +inf
|
if len(buckets) == 0 || buckets[len(buckets)-1].upperBound != math.Inf(+1) {
|
||||||
// buckets[len(buckets)-1].upperBound = math.Inf(+1)
|
// The list of buckets in dto.Histogram doesn't include the final +Inf bucket, so we
|
||||||
|
// add it here for the reset of the samples.
|
||||||
|
buckets = append(buckets, bucket{
|
||||||
|
count: float64(hist.GetSampleCount()),
|
||||||
|
upperBound: math.Inf(+1),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return bucketQuantile(q, buckets)
|
return bucketQuantile(q, buckets)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user