From 9d8441f17d90c46eca6390a522e8771bed10e0ba Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Thu, 20 Aug 2020 11:49:15 -0400 Subject: [PATCH] Make similar buckets for api and etcd request duration histogram Make similar buckets for the apiserver_request_duration_seconds and the etcd_request_duration_seconds histogram so that the result is more comparable side by side. etcd_request_duration_seconds uses the default buckets provided by prometheus client library: DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10} apiserver_request_duration_seconds on the other hand uses more fine grained buckets, and the maximum bucket size is 60s. Both histograms should use similar bucket sizes so they are more comparable side by side. --- .../k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go index a0de7e18cec..4ba0b14fd18 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go @@ -35,8 +35,12 @@ import ( var ( etcdRequestLatency = compbasemetrics.NewHistogramVec( &compbasemetrics.HistogramOpts{ - Name: "etcd_request_duration_seconds", - Help: "Etcd request latency in seconds for each operation and object type.", + Name: "etcd_request_duration_seconds", + Help: "Etcd request latency in seconds for each operation and object type.", + // Keeping it similar to the buckets used by the apiserver_request_duration_seconds metric so that + // api latency and etcd latency can be more comparable side by side. + Buckets: []float64{.005, .01, .025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, + 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60}, StabilityLevel: compbasemetrics.ALPHA, }, []string{"operation", "type"},