A bit more tidying up

This commit is contained in:
Mike Spreitzer 2022-05-06 04:07:51 -04:00
parent 68d9249490
commit b2c0c22e8f
2 changed files with 9 additions and 9 deletions

View File

@ -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)

View File

@ -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")