LinearBuckets creates 'count' regular buckets, each 'width' wide, where the lowest bucket has an upper bound of 'start'. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field of HistogramOpts. The function panics if
(start, width float64, count int)
| 293 | // |
| 294 | // The function panics if 'count' is zero or negative. |
| 295 | func LinearBuckets(start, width float64, count int) []float64 { |
| 296 | if count < 1 { |
| 297 | panic("LinearBuckets needs a positive count") |
| 298 | } |
| 299 | buckets := make([]float64, count) |
| 300 | for i := range buckets { |
| 301 | buckets[i] = start |
| 302 | start += width |
| 303 | } |
| 304 | return buckets |
| 305 | } |
| 306 | |
| 307 | // ExponentialBuckets creates 'count' regular buckets, where the lowest bucket |
| 308 | // has an upper bound of 'start' and each following bucket's upper bound is |
no outgoing calls