ExponentialBuckets creates 'count' regular buckets, where the lowest bucket has an upper bound of 'start' and each following bucket's upper bound is 'factor' times the previous bucket's upper bound. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is me
(start, factor float64, count int)
| 313 | // The function panics if 'count' is 0 or negative, if 'start' is 0 or negative, |
| 314 | // or if 'factor' is less than or equal 1. |
| 315 | func ExponentialBuckets(start, factor float64, count int) []float64 { |
| 316 | if count < 1 { |
| 317 | panic("ExponentialBuckets needs a positive count") |
| 318 | } |
| 319 | if start <= 0 { |
| 320 | panic("ExponentialBuckets needs a positive start value") |
| 321 | } |
| 322 | if factor <= 1 { |
| 323 | panic("ExponentialBuckets needs a factor greater than 1") |
| 324 | } |
| 325 | buckets := make([]float64, count) |
| 326 | for i := range buckets { |
| 327 | buckets[i] = start |
| 328 | start *= factor |
| 329 | } |
| 330 | return buckets |
| 331 | } |
| 332 | |
| 333 | // ExponentialBucketsRange creates 'count' buckets, where the lowest bucket is |
| 334 | // 'min' and the highest bucket is 'max'. The final +Inf bucket is not counted |
no outgoing calls