Skip to content

Commit e847e4b

Browse files
suhanimedgoodwin
authored andcommitted
Drop rest client request latecy metric
In an effort to reduce the storage for nonessential memory-intensive metrics, rest_client_request_latency_seconds was identified as the metric that reports and stores the most time series This metric has been deprecated since kube 1.14 and turned off in kube 1.17
1 parent 0d84ce4 commit e847e4b

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

pkg/metrics/client_go_adapter.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ limitations under the License.
1717
package metrics
1818

1919
import (
20-
"net/url"
21-
"time"
22-
2320
"github.com/prometheus/client_golang/prometheus"
2421
reflectormetrics "k8s.io/client-go/tools/cache"
2522
clientmetrics "k8s.io/client-go/tools/metrics"
@@ -32,7 +29,6 @@ import (
3229
// Metrics subsystem and all of the keys used by the rest client.
3330
const (
3431
RestClientSubsystem = "rest_client"
35-
LatencyKey = "request_latency_seconds"
3632
ResultKey = "requests_total"
3733
)
3834

@@ -51,13 +47,6 @@ const (
5147

5248
var (
5349
// client metrics
54-
requestLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
55-
Subsystem: RestClientSubsystem,
56-
Name: LatencyKey,
57-
Help: "Request latency in seconds. Broken down by verb and URL.",
58-
Buckets: prometheus.ExponentialBuckets(0.001, 2, 10),
59-
}, []string{"verb", "url"})
60-
6150
requestResult = prometheus.NewCounterVec(prometheus.CounterOpts{
6251
Subsystem: RestClientSubsystem,
6352
Name: ResultKey,
@@ -126,13 +115,11 @@ func init() {
126115
// registerClientMetrics sets up the client latency metrics from client-go
127116
func registerClientMetrics() {
128117
// register the metrics with our registry
129-
Registry.MustRegister(requestLatency)
130118
Registry.MustRegister(requestResult)
131119

132120
// register the metrics with client-go
133121
clientmetrics.Register(clientmetrics.RegisterOpts{
134-
RequestLatency: &latencyAdapter{metric: requestLatency},
135-
RequestResult: &resultAdapter{metric: requestResult},
122+
RequestResult: &resultAdapter{metric: requestResult},
136123
})
137124
}
138125

@@ -158,14 +145,6 @@ func registerReflectorMetrics() {
158145
// copied (more-or-less directly) from k8s.io/kubernetes setup code
159146
// (which isn't anywhere in an easily-importable place).
160147

161-
type latencyAdapter struct {
162-
metric *prometheus.HistogramVec
163-
}
164-
165-
func (l *latencyAdapter) Observe(verb string, u url.URL, latency time.Duration) {
166-
l.metric.WithLabelValues(verb, u.String()).Observe(latency.Seconds())
167-
}
168-
169148
type resultAdapter struct {
170149
metric *prometheus.CounterVec
171150
}

0 commit comments

Comments
 (0)