From f99b4339681329779e44cd9f0c8ffdbabfeb6fcf Mon Sep 17 00:00:00 2001 From: SataQiu Date: Thu, 10 Oct 2019 11:18:52 +0800 Subject: [PATCH] eliminate direct references to prometheus --- staging/src/k8s.io/apiserver/pkg/admission/metrics/BUILD | 2 +- .../apiserver/pkg/admission/metrics/testutil_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/admission/metrics/BUILD b/staging/src/k8s.io/apiserver/pkg/admission/metrics/BUILD index e15ed9a25b2..98e129cb9d5 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/metrics/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/admission/metrics/BUILD @@ -25,7 +25,7 @@ go_test( "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//staging/src/k8s.io/apiserver/pkg/admission:go_default_library", - "//vendor/github.com/prometheus/client_golang/prometheus:go_default_library", + "//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library", "//vendor/github.com/prometheus/client_model/go:go_default_library", ], ) diff --git a/staging/src/k8s.io/apiserver/pkg/admission/metrics/testutil_test.go b/staging/src/k8s.io/apiserver/pkg/admission/metrics/testutil_test.go index 4fbbd3e60aa..b31739a6c4a 100644 --- a/staging/src/k8s.io/apiserver/pkg/admission/metrics/testutil_test.go +++ b/staging/src/k8s.io/apiserver/pkg/admission/metrics/testutil_test.go @@ -19,8 +19,8 @@ package metrics import ( "testing" - "github.com/prometheus/client_golang/prometheus" ptype "github.com/prometheus/client_model/go" + "k8s.io/component-base/metrics/legacyregistry" ) func labelsMatch(metric *ptype.Metric, labelFilter map[string]string) bool { @@ -34,7 +34,7 @@ func labelsMatch(metric *ptype.Metric, labelFilter map[string]string) bool { // expectFindMetric find a metric with the given name nad labels or reports a fatal test error. func expectFindMetric(t *testing.T, name string, expectedLabels map[string]string) *ptype.Metric { - metrics, err := prometheus.DefaultGatherer.Gather() + metrics, err := legacyregistry.DefaultGatherer.Gather() if err != nil { t.Fatalf("Failed to gather metrics: %s", err) } @@ -61,7 +61,7 @@ func expectFindMetric(t *testing.T, name string, expectedLabels map[string]strin // expectHistogramCountTotal ensures that the sum of counts of metrics matching the labelFilter is as // expected. func expectHistogramCountTotal(t *testing.T, name string, labelFilter map[string]string, wantCount int) { - metrics, err := prometheus.DefaultGatherer.Gather() + metrics, err := legacyregistry.DefaultGatherer.Gather() if err != nil { t.Fatalf("Failed to gather metrics: %s", err) } @@ -93,7 +93,7 @@ func expectHistogramCountTotal(t *testing.T, name string, labelFilter map[string // expectCounterValue ensures that the counts of metrics matching the labelFilter is as // expected. func expectCounterValue(t *testing.T, name string, labelFilter map[string]string, wantCount int) { - metrics, err := prometheus.DefaultGatherer.Gather() + metrics, err := legacyregistry.DefaultGatherer.Gather() if err != nil { t.Fatalf("Failed to gather metrics: %s", err) }