rebase: update kubernetes to v1.25.0

update kubernetes to latest v1.25.0
release.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-08-24 07:54:25 +05:30
committed by mergify[bot]
parent f47839d73d
commit e3bf375035
645 changed files with 42507 additions and 9219 deletions

View File

@ -17,6 +17,8 @@ limitations under the License.
package metrics
import (
"errors"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
)
@ -65,6 +67,64 @@ type GaugeMetric interface {
SetToCurrentTime()
}
// GaugeVecMetric is a collection of Gauges that differ only in label values.
type GaugeVecMetric interface {
// Default Prometheus Vec behavior is that member extraction results in creation of a new element
// if one with the unique label values is not found in the underlying stored metricMap.
// This means that if this function is called but the underlying metric is not registered
// (which means it will never be exposed externally nor consumed), the metric would exist in memory
// for perpetuity (i.e. throughout application lifecycle).
//
// For reference: https://github.com/prometheus/client_golang/blob/v0.9.2/prometheus/gauge.go#L190-L208
//
// In contrast, the Vec behavior in this package is that member extraction before registration
// returns a permanent noop object.
// WithLabelValuesChecked, if called before this vector has been registered in
// at least one registry, will return a noop gauge and
// an error that passes ErrIsNotRegistered.
// If called on a hidden vector,
// will return a noop gauge and a nil error.
// If called with a syntactic problem in the labels, will
// return a noop gauge and an error about the labels.
// If none of the above apply, this method will return
// the appropriate vector member and a nil error.
WithLabelValuesChecked(labelValues ...string) (GaugeMetric, error)
// WithLabelValues calls WithLabelValuesChecked
// and handles errors as follows.
// An error that passes ErrIsNotRegistered is ignored
// and the noop gauge is returned;
// all other errors cause a panic.
WithLabelValues(labelValues ...string) GaugeMetric
// WithChecked, if called before this vector has been registered in
// at least one registry, will return a noop gauge and
// an error that passes ErrIsNotRegistered.
// If called on a hidden vector,
// will return a noop gauge and a nil error.
// If called with a syntactic problem in the labels, will
// return a noop gauge and an error about the labels.
// If none of the above apply, this method will return
// the appropriate vector member and a nil error.
WithChecked(labels map[string]string) (GaugeMetric, error)
// With calls WithChecked and handles errors as follows.
// An error that passes ErrIsNotRegistered is ignored
// and the noop gauge is returned;
// all other errors cause a panic.
With(labels map[string]string) GaugeMetric
// Delete asserts that the vec should have no member for the given label set.
// The returned bool indicates whether there was a change.
// The return will certainly be `false` if the given label set has the wrong
// set of label names.
Delete(map[string]string) bool
// Reset removes all the members
Reset()
}
// ObserverMetric captures individual observations.
type ObserverMetric interface {
Observe(float64)
@ -93,3 +153,9 @@ type GaugeFunc interface {
Metric
Collector
}
func ErrIsNotRegistered(err error) bool {
return err == errNotRegistered
}
var errNotRegistered = errors.New("metric vec is not registered yet")