fix: tweak histogram buckets
parent
d0fd66f83f
commit
f379f6b4b4
|
@ -18,4 +18,5 @@ var requestCount = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||||
var requestLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
|
var requestLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
|
||||||
Name: "plcmirror_response_latency_millisecond",
|
Name: "plcmirror_response_latency_millisecond",
|
||||||
Help: "Latency of responses.",
|
Help: "Latency of responses.",
|
||||||
|
Buckets: prometheus.ExponentialBucketsRange(1, 30000, 20),
|
||||||
}, []string{"status"})
|
}, []string{"status"})
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (s *Server) serve(ctx context.Context, req *http.Request) convreq.HttpRespo
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
updateMetrics := func(c int) {
|
updateMetrics := func(c int) {
|
||||||
requestCount.WithLabelValues(fmt.Sprint(c)).Inc()
|
requestCount.WithLabelValues(fmt.Sprint(c)).Inc()
|
||||||
requestLatency.WithLabelValues(fmt.Sprint(c)).Observe(float64(time.Now().Sub(start).Milliseconds()))
|
requestLatency.WithLabelValues(fmt.Sprint(c)).Observe(float64(time.Now().Sub(start)) / float64(time.Millisecond))
|
||||||
}
|
}
|
||||||
|
|
||||||
delay := time.Since(s.mirror.LastSuccess())
|
delay := time.Since(s.mirror.LastSuccess())
|
||||||
|
|
Loading…
Reference in New Issue