mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
A bit more tidying up
This commit is contained in:
parent
68d9249490
commit
b2c0c22e8f
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user