Context
We've been using the opt-in REST client metrics from #3510 (thanks for that work — also for the cherry-pick to release-0.24 in #3525) during a controller latency investigation in kubernetes-sigs/agent-sandbox, where they were instrumental in finding client-side bottlenecks (e.g. HTTP/2 stream-limit queuing that is invisible to server-side metrics).
Problem
The classic buckets for rest_client_request_duration_seconds and rest_client_rate_limiter_duration_seconds start at 5ms:
Buckets: []float64{0.005, 0.025, 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 15.0, 30.0, 60.0},
For controllers whose hot-path requests are fast — in our case warm-path PATCH/PUT calls with real p50s in the 1–15ms range — everything below 5ms collapses into the first bucket and the 5–25ms span into the second, so p50/p90 estimates over the exact range being optimized are mostly quantization artifact.
We're aware NativeHistogramBucketFactor is set, and native histograms fully solve this where the scrape pipeline supports them — but many pipelines still consume only classic buckets.
Ask
Since the file documents that the default buckets intentionally mirror core Kubernetes, changing the defaults seems off the table. Instead: would you accept making buckets overridable at registration, e.g. an options variant of RegisterRESTClientMetrics (or a WithBuckets-style option) that applies caller-supplied buckets before the collectors are registered? Callers who need low-end resolution could then prepend e.g. 0.001, 0.0025 without any divergence in the defaults.
Happy to send a PR if maintainers are open to it.
Context
We've been using the opt-in REST client metrics from #3510 (thanks for that work — also for the cherry-pick to release-0.24 in #3525) during a controller latency investigation in kubernetes-sigs/agent-sandbox, where they were instrumental in finding client-side bottlenecks (e.g. HTTP/2 stream-limit queuing that is invisible to server-side metrics).
Problem
The classic buckets for
rest_client_request_duration_secondsandrest_client_rate_limiter_duration_secondsstart at 5ms:For controllers whose hot-path requests are fast — in our case warm-path PATCH/PUT calls with real p50s in the 1–15ms range — everything below 5ms collapses into the first bucket and the 5–25ms span into the second, so p50/p90 estimates over the exact range being optimized are mostly quantization artifact.
We're aware
NativeHistogramBucketFactoris set, and native histograms fully solve this where the scrape pipeline supports them — but many pipelines still consume only classic buckets.Ask
Since the file documents that the default buckets intentionally mirror core Kubernetes, changing the defaults seems off the table. Instead: would you accept making buckets overridable at registration, e.g. an options variant of
RegisterRESTClientMetrics(or aWithBuckets-style option) that applies caller-supplied buckets before the collectors are registered? Callers who need low-end resolution could then prepend e.g.0.001, 0.0025without any divergence in the defaults.Happy to send a PR if maintainers are open to it.