mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Use Histogram instead of Summary
A histogram allows to aggregate by labels and calculate more comprehensive quantiles.
This commit is contained in:
parent
49e2074f74
commit
2b66b49a2f
@ -30,11 +30,11 @@ import (
|
|||||||
var (
|
var (
|
||||||
// requestLatency is a Prometheus Summary metric type partitioned by
|
// requestLatency is a Prometheus Summary metric type partitioned by
|
||||||
// "verb" and "url" labels. It is used for the rest client latency metrics.
|
// "verb" and "url" labels. It is used for the rest client latency metrics.
|
||||||
requestLatency = prometheus.NewSummaryVec(
|
requestLatency = prometheus.NewHistogramVec(
|
||||||
prometheus.SummaryOpts{
|
prometheus.HistogramOpts{
|
||||||
Name: "rest_client_request_latency_seconds",
|
Name: "rest_client_request_latency_seconds",
|
||||||
Help: "Request latency in seconds. Broken down by verb and URL.",
|
Help: "Request latency in seconds. Broken down by verb and URL.",
|
||||||
MaxAge: time.Hour,
|
Buckets: prometheus.ExponentialBuckets(0.001, 2, 10),
|
||||||
},
|
},
|
||||||
[]string{"verb", "url"},
|
[]string{"verb", "url"},
|
||||||
)
|
)
|
||||||
@ -55,7 +55,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type latencyAdapter struct {
|
type latencyAdapter struct {
|
||||||
m *prometheus.SummaryVec
|
m *prometheus.HistogramVec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *latencyAdapter) Observe(verb string, u url.URL, latency time.Duration) {
|
func (l *latencyAdapter) Observe(verb string, u url.URL, latency time.Duration) {
|
||||||
|
Loading…
Reference in New Issue
Block a user