Skip to content

Commit

Permalink
eliminate direct references to prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
SataQiu committed Oct 10, 2019
1 parent 0883226 commit f99b433
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion staging/src/k8s.io/apiserver/pkg/admission/metrics/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit f99b433

Please sign in to comment.