From b2c0c22e8f4b17079f37e9eeefa48464a5ac2539 Mon Sep 17 00:00:00 2001 From: Mike Spreitzer Date: Fri, 6 May 2022 04:07:51 -0400 Subject: [PATCH] A bit more tidying up --- .../k8s.io/component-base/metrics/timing_histogram.go | 8 ++++---- staging/src/k8s.io/component-base/metrics/wrappers.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/staging/src/k8s.io/component-base/metrics/timing_histogram.go b/staging/src/k8s.io/component-base/metrics/timing_histogram.go index 1472b541dab..ab05cc03a31 100644 --- a/staging/src/k8s.io/component-base/metrics/timing_histogram.go +++ b/staging/src/k8s.io/component-base/metrics/timing_histogram.go @@ -196,13 +196,13 @@ func (v *timingHistogramVec) SetToCurrentTimeForLabels(labels map[string]string) // hidden, will return a GaugeMetric that is NOT a noop along // with nil error. If called on a hidden vector then it will // return a noop and a nil error. Otherwise it returns a noop -// and an error that passes ErrIsNotReady. +// and an error that passes ErrIsNotRegistered. func (v *timingHistogramVec) WithLabelValues(lvs ...string) (GaugeMetric, error) { if v.IsHidden() { return noop, nil } if !v.IsCreated() { - return noop, errNotReady + return noop, errNotRegistered } if v.LabelValueAllowLists != nil { v.LabelValueAllowLists.ConstrainToAllowedList(v.originalLabels, lvs) @@ -215,13 +215,13 @@ func (v *timingHistogramVec) WithLabelValues(lvs ...string) (GaugeMetric, error) // hidden, will return a GaugeMetric that is NOT a noop along // with nil error. If called on a hidden vector then it will // return a noop and a nil error. Otherwise it returns a noop -// and an error that passes ErrIsNotReady. +// and an error that passes ErrIsNotRegistered. func (v *timingHistogramVec) With(labels map[string]string) (GaugeMetric, error) { if v.IsHidden() { return noop, nil } if !v.IsCreated() { - return noop, errNotReady + return noop, errNotRegistered } if v.LabelValueAllowLists != nil { v.LabelValueAllowLists.ConstrainLabelMap(labels) diff --git a/staging/src/k8s.io/component-base/metrics/wrappers.go b/staging/src/k8s.io/component-base/metrics/wrappers.go index 4fb5e4d87af..840a18c48e1 100644 --- a/staging/src/k8s.io/component-base/metrics/wrappers.go +++ b/staging/src/k8s.io/component-base/metrics/wrappers.go @@ -91,7 +91,7 @@ type GaugeMetricVec interface { // hidden, will return a GaugeMetric that is NOT a noop along // with nil error. If called on a hidden vector then it will // return a noop and a nil error. Otherwise it returns a noop - // and an error that passes ErrIsNotReady. + // and an error that passes ErrIsNotRegistered. WithLabelValues(labelValues ...string) (GaugeMetric, error) // With, if called after this vector has been @@ -99,7 +99,7 @@ type GaugeMetricVec interface { // hidden, will return a GaugeMetric that is NOT a noop along // with nil error. If called on a hidden vector then it will // return a noop and a nil error. Otherwise it returns a noop - // and an error that passes ErrIsNotReady. + // and an error that passes ErrIsNotRegistered. With(labels map[string]string) (GaugeMetric, error) // Delete asserts that the vec should have no member for the given label set. @@ -161,8 +161,8 @@ type GaugeFunc interface { Collector } -func ErrIsNotReady(err error) bool { - return err == errNotReady +func ErrIsNotRegistered(err error) bool { + return err == errNotRegistered } -var errNotReady = errors.New("metric vec is not registered yet") +var errNotRegistered = errors.New("metric vec is not registered yet")