eliminate direct references to prometheus
This commit is contained in:
		@@ -25,7 +25,7 @@ go_test(
 | 
				
			|||||||
        "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
 | 
					        "//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/apimachinery/pkg/runtime/schema:go_default_library",
 | 
				
			||||||
        "//staging/src/k8s.io/apiserver/pkg/admission: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",
 | 
					        "//vendor/github.com/prometheus/client_model/go:go_default_library",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,8 +19,8 @@ package metrics
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/prometheus/client_golang/prometheus"
 | 
					 | 
				
			||||||
	ptype "github.com/prometheus/client_model/go"
 | 
						ptype "github.com/prometheus/client_model/go"
 | 
				
			||||||
 | 
						"k8s.io/component-base/metrics/legacyregistry"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func labelsMatch(metric *ptype.Metric, labelFilter map[string]string) bool {
 | 
					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.
 | 
					// 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 {
 | 
					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 {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("Failed to gather metrics: %s", err)
 | 
							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
 | 
					// expectHistogramCountTotal ensures that the sum of counts of metrics matching the labelFilter is as
 | 
				
			||||||
// expected.
 | 
					// expected.
 | 
				
			||||||
func expectHistogramCountTotal(t *testing.T, name string, labelFilter map[string]string, wantCount int) {
 | 
					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 {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("Failed to gather metrics: %s", err)
 | 
							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
 | 
					// expectCounterValue ensures that the counts of metrics matching the labelFilter is as
 | 
				
			||||||
// expected.
 | 
					// expected.
 | 
				
			||||||
func expectCounterValue(t *testing.T, name string, labelFilter map[string]string, wantCount int) {
 | 
					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 {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("Failed to gather metrics: %s", err)
 | 
							t.Fatalf("Failed to gather metrics: %s", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user