Histogram with zero-width zero bucket
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
14259fa70c
commit
9c344085f9
|
@ -64,6 +64,7 @@ func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metric
|
||||||
Help: "RPC latency distributions.",
|
Help: "RPC latency distributions.",
|
||||||
Buckets: prometheus.LinearBuckets(normMean-5*normDomain, .5*normDomain, 20),
|
Buckets: prometheus.LinearBuckets(normMean-5*normDomain, .5*normDomain, 20),
|
||||||
NativeHistogramBucketFactor: 1.1,
|
NativeHistogramBucketFactor: 1.1,
|
||||||
|
NativeHistogramZeroThreshold: prometheus.NativeHistogramZeroThresholdZero,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
reg.MustRegister(m.rpcDurations)
|
reg.MustRegister(m.rpcDurations)
|
||||||
|
@ -106,6 +107,18 @@ func main() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
m.rpcDurationsHistogram.(prometheus.ExemplarObserver).ObserveWithExemplar(
|
||||||
|
0, prometheus.Labels{"dummyID": fmt.Sprint(rand.Intn(100000))},
|
||||||
|
)
|
||||||
|
m.rpcDurationsHistogram.(prometheus.ExemplarObserver).ObserveWithExemplar(
|
||||||
|
0, prometheus.Labels{"dummyID": fmt.Sprint(rand.Intn(100000))},
|
||||||
|
)
|
||||||
|
m.rpcDurationsHistogram.(prometheus.ExemplarObserver).ObserveWithExemplar(
|
||||||
|
0, prometheus.Labels{"dummyID": fmt.Sprint(rand.Intn(100000))},
|
||||||
|
)
|
||||||
|
m.rpcDurationsHistogram.(prometheus.ExemplarObserver).ObserveWithExemplar(
|
||||||
|
0.01, prometheus.Labels{"dummyID": fmt.Sprint(rand.Intn(100000))},
|
||||||
|
)
|
||||||
for {
|
for {
|
||||||
v := (rand.NormFloat64() * *normDomain) + *normMean
|
v := (rand.NormFloat64() * *normDomain) + *normMean
|
||||||
m.rpcDurations.WithLabelValues("normal").Observe(v)
|
m.rpcDurations.WithLabelValues("normal").Observe(v)
|
||||||
|
@ -118,7 +131,7 @@ func main() {
|
||||||
m.rpcDurationsHistogram.(prometheus.ExemplarObserver).ObserveWithExemplar(
|
m.rpcDurationsHistogram.(prometheus.ExemplarObserver).ObserveWithExemplar(
|
||||||
v, prometheus.Labels{"dummyID": fmt.Sprint(rand.Intn(100000))},
|
v, prometheus.Labels{"dummyID": fmt.Sprint(rand.Intn(100000))},
|
||||||
)
|
)
|
||||||
time.Sleep(time.Duration(75*oscillationFactor()) * time.Millisecond)
|
time.Sleep(time.Duration(oscillationFactor()) * time.Millisecond)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue