fix static check failures in component-base/metrics

This commit is contained in:
朱正浩,Zhu Zhenghao 2019-08-27 17:10:21 +08:00 committed by RainbowMango
parent bd239d42e4
commit 2b304bf5e2
2 changed files with 4 additions and 3 deletions

View File

@ -188,6 +188,8 @@ func (c *selfCollector) Collect(ch chan<- prometheus.Metric) {
// no-op vecs for convenience
var noopCounterVec = &prometheus.CounterVec{}
var noopHistogramVec = &prometheus.HistogramVec{}
// lint:ignore U1000 Keep it for future use
var noopSummaryVec = &prometheus.SummaryVec{}
var noopGaugeVec = &prometheus.GaugeVec{}
var noopObserverVec = &noopObserverVector{}

View File

@ -31,7 +31,6 @@ import (
var (
v115 = semver.MustParse("1.15.0")
v114 = semver.MustParse("1.14.0")
alphaCounter = NewCounter(
&CounterOpts{
Namespace: "some_namespace",
@ -240,6 +239,7 @@ func TestShowHiddenMetric(t *testing.T) {
registry.MustRegister(alphaHiddenCounter)
ms, err := registry.Gather()
assert.Nil(t, err, "Gather failed %v", err)
assert.Equalf(t, expectedMetricCount, len(ms), "Got %v metrics, Want: %v metrics", len(ms), expectedMetricCount)
showHidden.Store(true)
@ -257,9 +257,8 @@ func TestShowHiddenMetric(t *testing.T) {
expectedMetricCount = 1
ms, err = registry.Gather()
assert.Equalf(t, expectedMetricCount, len(ms), "Got %v metrics, Want: %v metrics", len(ms), expectedMetricCount)
assert.Nil(t, err, "Gather failed %v", err)
assert.Equalf(t, expectedMetricCount, len(ms), "Got %v metrics, Want: %v metrics", len(ms), expectedMetricCount)
}
func TestValidateShowHiddenMetricsVersion(t *testing.T) {