diff options
author | Valery Piashchynski <[email protected]> | 2020-11-16 15:39:28 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-16 15:39:28 +0300 |
commit | eba447f39dfe085ece9bb50f26c2d1c6db9b1d89 (patch) | |
tree | 9a16ae58e439831e824693c173539a2b50253122 /plugins/metrics | |
parent | f592c6e410fd1f8075c8b75597eb8e5dc7ba9cf1 (diff) |
MetricsCollector returns multiply collectors
Diffstat (limited to 'plugins/metrics')
-rw-r--r-- | plugins/metrics/tests/metrics_test.go | 1 | ||||
-rw-r--r-- | plugins/metrics/tests/plugin1.go | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/plugins/metrics/tests/metrics_test.go b/plugins/metrics/tests/metrics_test.go index d3043fbb..ed5d085a 100644 --- a/plugins/metrics/tests/metrics_test.go +++ b/plugins/metrics/tests/metrics_test.go @@ -157,6 +157,7 @@ func TestMetricsGaugeCollector(t *testing.T) { out, err := get("http://localhost:2112/metrics") assert.NoError(t, err) assert.Contains(t, out, "my_gauge 100") + assert.Contains(t, out, "my_gauge2 100") out, err = get("http://localhost:2112/metrics") assert.NoError(t, err) diff --git a/plugins/metrics/tests/plugin1.go b/plugins/metrics/tests/plugin1.go index fb2a2235..b48c415d 100644 --- a/plugins/metrics/tests/plugin1.go +++ b/plugins/metrics/tests/plugin1.go @@ -35,5 +35,12 @@ func (p1 *Plugin1) MetricsCollector() []prometheus.Collector { }) collector.Set(100) - return []prometheus.Collector{collector} + + collector2 := prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "my_gauge2", + Help: "My gauge2 value", + }) + + collector2.Set(100) + return []prometheus.Collector{collector, collector2} } |