mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: bump sigs.k8s.io/controller-runtime from 0.9.2 to 0.10.0
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.9.2 to 0.10.0. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.9.2...v0.10.0) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
60c2afbcca
commit
fb000647b5
29
vendor/sigs.k8s.io/controller-runtime/pkg/metrics/client_go_adapter.go
generated
vendored
29
vendor/sigs.k8s.io/controller-runtime/pkg/metrics/client_go_adapter.go
generated
vendored
@ -52,7 +52,24 @@ const (
|
||||
|
||||
var (
|
||||
// client metrics.
|
||||
requestLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||
|
||||
// RequestLatency reports the request latency in seconds per verb/URL.
|
||||
// Deprecated: This metric is deprecated for removal in a future release: using the URL as a
|
||||
// dimension results in cardinality explosion for some consumers. It was deprecated upstream
|
||||
// in k8s v1.14 and hidden in v1.17 via https://github.com/kubernetes/kubernetes/pull/83836.
|
||||
// It is not registered by default. To register:
|
||||
// import (
|
||||
// clientmetrics "k8s.io/client-go/tools/metrics"
|
||||
// clmetrics "sigs.k8s.io/controller-runtime/metrics"
|
||||
// )
|
||||
//
|
||||
// func init() {
|
||||
// clmetrics.Registry.MustRegister(clmetrics.RequestLatency)
|
||||
// clientmetrics.Register(clientmetrics.RegisterOpts{
|
||||
// RequestLatency: clmetrics.LatencyAdapter
|
||||
// })
|
||||
// }
|
||||
RequestLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||
Subsystem: RestClientSubsystem,
|
||||
Name: LatencyKey,
|
||||
Help: "Request latency in seconds. Broken down by verb and URL.",
|
||||
@ -127,13 +144,11 @@ func init() {
|
||||
// registerClientMetrics sets up the client latency metrics from client-go.
|
||||
func registerClientMetrics() {
|
||||
// register the metrics with our registry
|
||||
Registry.MustRegister(requestLatency)
|
||||
Registry.MustRegister(requestResult)
|
||||
|
||||
// register the metrics with client-go
|
||||
clientmetrics.Register(clientmetrics.RegisterOpts{
|
||||
RequestLatency: &latencyAdapter{metric: requestLatency},
|
||||
RequestResult: &resultAdapter{metric: requestResult},
|
||||
RequestResult: &resultAdapter{metric: requestResult},
|
||||
})
|
||||
}
|
||||
|
||||
@ -159,11 +174,13 @@ func registerReflectorMetrics() {
|
||||
// copied (more-or-less directly) from k8s.io/kubernetes setup code
|
||||
// (which isn't anywhere in an easily-importable place).
|
||||
|
||||
type latencyAdapter struct {
|
||||
// LatencyAdapter implements LatencyMetric.
|
||||
type LatencyAdapter struct {
|
||||
metric *prometheus.HistogramVec
|
||||
}
|
||||
|
||||
func (l *latencyAdapter) Observe(_ context.Context, verb string, u url.URL, latency time.Duration) {
|
||||
// Observe increments the request latency metric for the given verb/URL.
|
||||
func (l *LatencyAdapter) Observe(_ context.Context, verb string, u url.URL, latency time.Duration) {
|
||||
l.metric.WithLabelValues(verb, u.String()).Observe(latency.Seconds())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user