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:
Kubernetes Prow Robot 2022-02-17 06:09:36 -08:00 committed by GitHub
commit 6de9dddf94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {