mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #106539 from dgrisonnet/rest-client-latency
Replace url label in rest client latency metrics by host and path
This commit is contained in:
commit
6de9dddf94
@ -29,24 +29,24 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// requestLatency is a Prometheus Summary metric type partitioned by
|
||||
// "verb" and "url" labels. It is used for the rest client latency metrics.
|
||||
// requestLatency is a Prometheus Histogram metric type partitioned by
|
||||
// "verb", and "host" labels. It is used for the rest client latency metrics.
|
||||
requestLatency = k8smetrics.NewHistogramVec(
|
||||
&k8smetrics.HistogramOpts{
|
||||
Name: "rest_client_request_duration_seconds",
|
||||
Help: "Request latency in seconds. Broken down by verb and URL.",
|
||||
Help: "Request latency in seconds. Broken down by verb, and host.",
|
||||
Buckets: k8smetrics.ExponentialBuckets(0.001, 2, 10),
|
||||
},
|
||||
[]string{"verb", "url"},
|
||||
[]string{"verb", "host"},
|
||||
)
|
||||
|
||||
rateLimiterLatency = k8smetrics.NewHistogramVec(
|
||||
&k8smetrics.HistogramOpts{
|
||||
Name: "rest_client_rate_limiter_duration_seconds",
|
||||
Help: "Client side rate limiter latency in seconds. Broken down by verb and URL.",
|
||||
Help: "Client side rate limiter latency in seconds. Broken down by verb, and host.",
|
||||
Buckets: k8smetrics.ExponentialBuckets(0.001, 2, 10),
|
||||
},
|
||||
[]string{"verb", "url"},
|
||||
[]string{"verb", "host"},
|
||||
)
|
||||
|
||||
requestResult = k8smetrics.NewCounterVec(
|
||||
@ -140,7 +140,7 @@ type latencyAdapter struct {
|
||||
}
|
||||
|
||||
func (l *latencyAdapter) Observe(ctx context.Context, verb string, u url.URL, latency time.Duration) {
|
||||
l.m.WithContext(ctx).WithLabelValues(verb, u.String()).Observe(latency.Seconds())
|
||||
l.m.WithContext(ctx).WithLabelValues(verb, u.Host).Observe(latency.Seconds())
|
||||
}
|
||||
|
||||
type resultAdapter struct {
|
||||
|
Loading…
Reference in New Issue
Block a user