mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
rebase: update K8s packages to v0.32.1
Update K8s packages in go.mod to v0.32.1 Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
31
vendor/k8s.io/component-base/metrics/gauge.go
generated
vendored
31
vendor/k8s.io/component-base/metrics/gauge.go
generated
vendored
@ -18,6 +18,7 @@ package metrics
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/blang/semver/v4"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
@ -105,11 +106,6 @@ func NewGaugeVec(opts *GaugeOpts, labels []string) *GaugeVec {
|
||||
opts.StabilityLevel.setDefaults()
|
||||
|
||||
fqName := BuildFQName(opts.Namespace, opts.Subsystem, opts.Name)
|
||||
allowListLock.RLock()
|
||||
if allowList, ok := labelValueAllowLists[fqName]; ok {
|
||||
opts.LabelValueAllowLists = allowList
|
||||
}
|
||||
allowListLock.RUnlock()
|
||||
|
||||
cv := &GaugeVec{
|
||||
GaugeVec: noopGaugeVec,
|
||||
@ -149,6 +145,15 @@ func (v *GaugeVec) WithLabelValuesChecked(lvs ...string) (GaugeMetric, error) {
|
||||
}
|
||||
if v.LabelValueAllowLists != nil {
|
||||
v.LabelValueAllowLists.ConstrainToAllowedList(v.originalLabels, lvs)
|
||||
} else {
|
||||
v.initializeLabelAllowListsOnce.Do(func() {
|
||||
allowListLock.RLock()
|
||||
if allowList, ok := labelValueAllowLists[v.FQName()]; ok {
|
||||
v.LabelValueAllowLists = allowList
|
||||
allowList.ConstrainToAllowedList(v.originalLabels, lvs)
|
||||
}
|
||||
allowListLock.RUnlock()
|
||||
})
|
||||
}
|
||||
elt, err := v.GaugeVec.GetMetricWithLabelValues(lvs...)
|
||||
return elt, err
|
||||
@ -186,6 +191,15 @@ func (v *GaugeVec) WithChecked(labels map[string]string) (GaugeMetric, error) {
|
||||
}
|
||||
if v.LabelValueAllowLists != nil {
|
||||
v.LabelValueAllowLists.ConstrainLabelMap(labels)
|
||||
} else {
|
||||
v.initializeLabelAllowListsOnce.Do(func() {
|
||||
allowListLock.RLock()
|
||||
if allowList, ok := labelValueAllowLists[v.FQName()]; ok {
|
||||
v.LabelValueAllowLists = allowList
|
||||
allowList.ConstrainLabelMap(labels)
|
||||
}
|
||||
allowListLock.RUnlock()
|
||||
})
|
||||
}
|
||||
elt, err := v.GaugeVec.GetMetricWith(labels)
|
||||
return elt, err
|
||||
@ -226,6 +240,13 @@ func (v *GaugeVec) Reset() {
|
||||
v.GaugeVec.Reset()
|
||||
}
|
||||
|
||||
// ResetLabelAllowLists resets the label allow list for the GaugeVec.
|
||||
// NOTE: This should only be used in test.
|
||||
func (v *GaugeVec) ResetLabelAllowLists() {
|
||||
v.initializeLabelAllowListsOnce = sync.Once{}
|
||||
v.LabelValueAllowLists = nil
|
||||
}
|
||||
|
||||
func newGaugeFunc(opts *GaugeOpts, function func() float64, v semver.Version) GaugeFunc {
|
||||
g := NewGauge(opts)
|
||||
|
||||
|
Reference in New Issue
Block a user