I am experimenting with Prometheus Go client library. Does ExponentialBuckets API accept parameter start
of less than 1.0 (e.g., 0.001)?
import "github.com/prometheus/client_golang/prometheus"
func ExponentialBuckets(start, factor float64, count int) []float64
ExponentialBuckets creates 'count' 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 meant to be used for the Buckets field of HistogramOpts.
The function panics if 'count' is 0 or negative, if 'start' is 0 or negative, or if 'factor' is less than or equal 1.
Try start
equal to the minimum normal positive float64
.
package main
import (
"fmt"
"math"
)
func main() {
// Minimum normal positive float64
// 0 00000000001 0000000000000000000000000000000000000000000000000000
// 2.2250738585072014e−308
start := math.Float64frombits(uint64(1 << (63 - 11)))
fmt.Println(start)
}
Output:
2.2250738585072014e-308