@@ -48,14 +48,22 @@ func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metric
48
48
},
49
49
[]string {"service" },
50
50
),
51
- // The same as above, but now as a histogram, and only for the normal
52
- // distribution. The buckets are targeted to the parameters of the
53
- // normal distribution, with 20 buckets centered on the mean, each
54
- // half-sigma wide.
51
+ // The same as above, but now as a histogram, and only for the
52
+ // normal distribution. The histogram features both conventional
53
+ // buckets as well as sparse buckets, the latter needed for the
54
+ // experimental native histograms (ingested by a Prometheus
55
+ // server v2.40 with the corresponding feature flag
56
+ // enabled). The conventional buckets are targeted to the
57
+ // parameters of the normal distribution, with 20 buckets
58
+ // centered on the mean, each half-sigma wide. The sparse
59
+ // buckets are always centered on zero, with a growth factor of
60
+ // one bucket to the text of (at most) 1.1. (The precise factor
61
+ // is 2^2^-3 = 1.0905077...)
55
62
rpcDurationsHistogram : prometheus .NewHistogram (prometheus.HistogramOpts {
56
- Name : "rpc_durations_histogram_seconds" ,
57
- Help : "RPC latency distributions." ,
58
- Buckets : prometheus .LinearBuckets (normMean - 5 * normDomain , .5 * normDomain , 20 ),
63
+ Name : "rpc_durations_histogram_seconds" ,
64
+ Help : "RPC latency distributions." ,
65
+ Buckets : prometheus .LinearBuckets (normMean - 5 * normDomain , .5 * normDomain , 20 ),
66
+ NativeHistogramBucketFactor : 1.1 ,
59
67
}),
60
68
}
61
69
reg .MustRegister (m .rpcDurations )
0 commit comments