Skip to content

Commit f4118ca

Browse files
committed
Specify buckets for "controller_runtime_reconcile_time_seconds" histogram metrics
Current metric uses Prometheus default bucket for reconcile time histogram. This bucket is not sufficient to reason about percentile of requests which take less than x seconds when x falls outside the bucket of 10 secs. It's also hard to infer when the reconcile loops are fairly fast, as mentioned in this issue: #258. This PR attempts to define explicit buckets for the metrics, values are chosen based on the apiserver request latency defined here: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go#L103. The default Prometheus histogram buckets has also been added(wherever missing) to ensure backward compatibility.
1 parent f3831c2 commit f4118ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/internal/controller/metrics/metrics.go

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ var (
4343
ReconcileTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
4444
Name: "controller_runtime_reconcile_time_seconds",
4545
Help: "Length of time per reconciliation per controller",
46+
Buckets: []float64{0.005, 0.01, 0.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,
47+
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},
4648
}, []string{"controller"})
4749

4850
// WorkerCount is a prometheus metric which holds the number of

0 commit comments

Comments
 (0)