diff --git a/pkg/controller/client_go_adapter.go b/pkg/controller/client_go_adapter.go index 11cb9e68422..98d7066e533 100644 --- a/pkg/controller/client_go_adapter.go +++ b/pkg/controller/client_go_adapter.go @@ -21,6 +21,7 @@ package controller import ( "context" "net/url" + "strings" "time" "github.com/prometheus/client_golang/prometheus" @@ -154,7 +155,12 @@ type latencyAdapter struct { } func (l *latencyAdapter) Observe(_ context.Context, verb string, u url.URL, latency time.Duration) { - l.metric.WithLabelValues(verb, u.String()).Observe(latency.Seconds()) + url := u.String() + last := strings.LastIndex(url, "/") + if last != -1 { + url = url[:last] + } + l.metric.WithLabelValues(verb, url).Observe(latency.Seconds()) } type resultAdapter struct { diff --git a/pkg/daemon/metrics.go b/pkg/daemon/metrics.go index 0437f941325..4237f278804 100644 --- a/pkg/daemon/metrics.go +++ b/pkg/daemon/metrics.go @@ -3,6 +3,7 @@ package daemon import ( "context" "net/url" + "strings" "time" "github.com/prometheus/client_golang/prometheus" @@ -170,7 +171,12 @@ type latencyAdapter struct { } func (l *latencyAdapter) Observe(_ context.Context, verb string, u url.URL, latency time.Duration) { - l.metric.WithLabelValues(verb, u.String()).Observe(latency.Seconds()) + url := u.String() + last := strings.LastIndex(url, "/") + if last != -1 { + url = url[:last] + } + l.metric.WithLabelValues(verb, url).Observe(latency.Seconds()) } type resultAdapter struct {