Changes to accommodate client-go changes and kube vendor update

to v1.18.0

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal
2020-04-14 12:34:33 +05:30
committed by mergify[bot]
parent 4c96ad3c85
commit 34fc1d847e
1083 changed files with 50505 additions and 155846 deletions

View File

@ -63,6 +63,7 @@ implements kubeCollector to get deferred registration behavior. You must call la
with the kubeCollector itself as an argument.
*/
type lazyMetric struct {
fqName string
isDeprecated bool
isHidden bool
isCreated bool
@ -81,7 +82,8 @@ func (r *lazyMetric) IsCreated() bool {
// lazyInit provides the lazyMetric with a reference to the kubeCollector it is supposed
// to allow lazy initialization for. It should be invoked in the factory function which creates new
// kubeCollector type objects.
func (r *lazyMetric) lazyInit(self kubeCollector) {
func (r *lazyMetric) lazyInit(self kubeCollector, fqName string) {
r.fqName = fqName
r.self = self
}
@ -98,7 +100,7 @@ func (r *lazyMetric) determineDeprecationStatus(version semver.Version) {
r.isDeprecated = true
}
if ShouldShowHidden() {
klog.Warningf("Hidden metrics have been manually overridden, showing this very deprecated metric.")
klog.Warningf("Hidden metrics (%s) have been manually overridden, showing this very deprecated metric.", r.fqName)
return
}
if shouldHide(&version, selfVersion) {
@ -156,6 +158,11 @@ func (r *lazyMetric) ClearState() {
r.createOnce = *(new(sync.Once))
}
// FQName returns the fully-qualified metric name of the collector.
func (r *lazyMetric) FQName() string {
return r.fqName
}
/*
This code is directly lifted from the prometheus codebase. It's a convenience struct which
allows you satisfy the Collector interface automatically if you already satisfy the Metric interface.
@ -181,6 +188,8 @@ func (c *selfCollector) Collect(ch chan<- prometheus.Metric) {
// no-op vecs for convenience
var noopCounterVec = &prometheus.CounterVec{}
var noopHistogramVec = &prometheus.HistogramVec{}
// lint:ignore U1000 Keep it for future use
var noopSummaryVec = &prometheus.SummaryVec{}
var noopGaugeVec = &prometheus.GaugeVec{}
var noopObserverVec = &noopObserverVector{}