From 23837bb8f56f6b0a774e9b95435b7334afccc009 Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Thu, 26 Sep 2019 12:12:12 +0800 Subject: [PATCH] Remove direct reference to prometheus.Label from metrics API. --- staging/src/k8s.io/component-base/metrics/counter.go | 4 ++-- staging/src/k8s.io/component-base/metrics/gauge.go | 4 ++-- staging/src/k8s.io/component-base/metrics/histogram.go | 4 ++-- staging/src/k8s.io/component-base/metrics/opts.go | 6 +++--- staging/src/k8s.io/component-base/metrics/summary.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/staging/src/k8s.io/component-base/metrics/counter.go b/staging/src/k8s.io/component-base/metrics/counter.go index 08901963adf..ccc1f084b6b 100644 --- a/staging/src/k8s.io/component-base/metrics/counter.go +++ b/staging/src/k8s.io/component-base/metrics/counter.go @@ -139,7 +139,7 @@ func (v *CounterVec) WithLabelValues(lvs ...string) CounterMetric { // must match those of the VariableLabels in Desc). If that label map is // accessed for the first time, a new Counter is created IFF the counterVec has // been registered to a metrics registry. -func (v *CounterVec) With(labels prometheus.Labels) CounterMetric { +func (v *CounterVec) With(labels map[string]string) CounterMetric { if !v.IsCreated() { return noop // return no-op counter } @@ -153,7 +153,7 @@ func (v *CounterVec) With(labels prometheus.Labels) CounterMetric { // with those of the VariableLabels in Desc. However, such inconsistent Labels // can never match an actual metric, so the method will always return false in // that case. -func (v *CounterVec) Delete(labels prometheus.Labels) bool { +func (v *CounterVec) Delete(labels map[string]string) bool { if !v.IsCreated() { return false // since we haven't created the metric, we haven't deleted a metric with the passed in values } diff --git a/staging/src/k8s.io/component-base/metrics/gauge.go b/staging/src/k8s.io/component-base/metrics/gauge.go index 020f387acfd..665a24c4135 100644 --- a/staging/src/k8s.io/component-base/metrics/gauge.go +++ b/staging/src/k8s.io/component-base/metrics/gauge.go @@ -138,7 +138,7 @@ func (v *GaugeVec) WithLabelValues(lvs ...string) GaugeMetric { // must match those of the VariableLabels in Desc). If that label map is // accessed for the first time, a new GaugeMetric is created IFF the gaugeVec has // been registered to a metrics registry. -func (v *GaugeVec) With(labels prometheus.Labels) GaugeMetric { +func (v *GaugeVec) With(labels map[string]string) GaugeMetric { if !v.IsCreated() { return noop // return no-op gauge } @@ -152,7 +152,7 @@ func (v *GaugeVec) With(labels prometheus.Labels) GaugeMetric { // with those of the VariableLabels in Desc. However, such inconsistent Labels // can never match an actual metric, so the method will always return false in // that case. -func (v *GaugeVec) Delete(labels prometheus.Labels) bool { +func (v *GaugeVec) Delete(labels map[string]string) bool { if !v.IsCreated() { return false // since we haven't created the metric, we haven't deleted a metric with the passed in values } diff --git a/staging/src/k8s.io/component-base/metrics/histogram.go b/staging/src/k8s.io/component-base/metrics/histogram.go index 58ad36bbd33..1b2de88fc22 100644 --- a/staging/src/k8s.io/component-base/metrics/histogram.go +++ b/staging/src/k8s.io/component-base/metrics/histogram.go @@ -146,7 +146,7 @@ func (v *HistogramVec) WithLabelValues(lvs ...string) ObserverMetric { // must match those of the VariableLabels in Desc). If that label map is // accessed for the first time, a new ObserverMetric is created IFF the HistogramVec has // been registered to a metrics registry. -func (v *HistogramVec) With(labels prometheus.Labels) ObserverMetric { +func (v *HistogramVec) With(labels map[string]string) ObserverMetric { if !v.IsCreated() { return noop } @@ -160,7 +160,7 @@ func (v *HistogramVec) With(labels prometheus.Labels) ObserverMetric { // with those of the VariableLabels in Desc. However, such inconsistent Labels // can never match an actual metric, so the method will always return false in // that case. -func (v *HistogramVec) Delete(labels prometheus.Labels) bool { +func (v *HistogramVec) Delete(labels map[string]string) bool { if !v.IsCreated() { return false // since we haven't created the metric, we haven't deleted a metric with the passed in values } diff --git a/staging/src/k8s.io/component-base/metrics/opts.go b/staging/src/k8s.io/component-base/metrics/opts.go index 496f2470f7d..0b5e2c381c3 100644 --- a/staging/src/k8s.io/component-base/metrics/opts.go +++ b/staging/src/k8s.io/component-base/metrics/opts.go @@ -34,7 +34,7 @@ type KubeOpts struct { Subsystem string Name string Help string - ConstLabels prometheus.Labels + ConstLabels map[string]string DeprecatedVersion string deprecateOnce sync.Once annotateOnce sync.Once @@ -132,7 +132,7 @@ type HistogramOpts struct { Subsystem string Name string Help string - ConstLabels prometheus.Labels + ConstLabels map[string]string Buckets []float64 DeprecatedVersion string deprecateOnce sync.Once @@ -178,7 +178,7 @@ type SummaryOpts struct { Subsystem string Name string Help string - ConstLabels prometheus.Labels + ConstLabels map[string]string Objectives map[float64]float64 MaxAge time.Duration AgeBuckets uint32 diff --git a/staging/src/k8s.io/component-base/metrics/summary.go b/staging/src/k8s.io/component-base/metrics/summary.go index 338e5085d07..cad4ce63376 100644 --- a/staging/src/k8s.io/component-base/metrics/summary.go +++ b/staging/src/k8s.io/component-base/metrics/summary.go @@ -140,7 +140,7 @@ func (v *SummaryVec) WithLabelValues(lvs ...string) ObserverMetric { // must match those of the VariableLabels in Desc). If that label map is // accessed for the first time, a new ObserverMetric is created IFF the summaryVec has // been registered to a metrics registry. -func (v *SummaryVec) With(labels prometheus.Labels) ObserverMetric { +func (v *SummaryVec) With(labels map[string]string) ObserverMetric { if !v.IsCreated() { return noop } @@ -154,7 +154,7 @@ func (v *SummaryVec) With(labels prometheus.Labels) ObserverMetric { // with those of the VariableLabels in Desc. However, such inconsistent Labels // can never match an actual metric, so the method will always return false in // that case. -func (v *SummaryVec) Delete(labels prometheus.Labels) bool { +func (v *SummaryVec) Delete(labels map[string]string) bool { if !v.IsCreated() { return false // since we haven't created the metric, we haven't deleted a metric with the passed in values }