doushou8730 2018-12-20 01:54
浏览 594
已采纳

Prometheus Go客户端库的ExponentialBuckets API的最低粒度是多少?

I am experimenting with Prometheus Go client library. Does ExponentialBuckets API accept parameter start of less than 1.0 (e.g., 0.001)?

  • 写回答

1条回答 默认 最新

  • dousa2794 2018-12-20 04:27
    关注

    package prometheus

    import "github.com/prometheus/client_golang/prometheus"
    

    func ExponentialBuckets

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!