diff options
author | Valery Piashchynski <[email protected]> | 2020-11-16 17:02:23 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-16 17:02:23 +0300 |
commit | 41829c62826cf88530545715d0aac897b1b56f6d (patch) | |
tree | 4d3a1da3cbfeacec420188b308d17e89872ce9d3 /plugins/metrics/tests/plugin1.go | |
parent | 57ad958acab2d108be0a35547faf6e7a791cf069 (diff) | |
parent | 38f6925db27dd94cfbca873901bf932ed1456906 (diff) |
Merge branch 'plugin/metrics' into plugin/http
# Conflicts:
# plugins/server/plugin.go
Diffstat (limited to 'plugins/metrics/tests/plugin1.go')
-rw-r--r-- | plugins/metrics/tests/plugin1.go | 72 |
1 files changed, 7 insertions, 65 deletions
diff --git a/plugins/metrics/tests/plugin1.go b/plugins/metrics/tests/plugin1.go index 8f1ece52..b48c415d 100644 --- a/plugins/metrics/tests/plugin1.go +++ b/plugins/metrics/tests/plugin1.go @@ -28,77 +28,19 @@ func (p1 *Plugin1) Name() string { return "metrics_test.plugin1" } -func (p1 *Plugin1) MetricsCollector() prometheus.Collector { +func (p1 *Plugin1) MetricsCollector() []prometheus.Collector { collector := prometheus.NewGauge(prometheus.GaugeOpts{ Name: "my_gauge", Help: "My gauge value", }) collector.Set(100) - return collector -} -// ////////////////////////////////////////////////////////////// -type Plugin3 struct { - config config.Configurer -} - -func (p *Plugin3) Init(cfg config.Configurer) error { - p.config = cfg - return nil -} - -func (p *Plugin3) Serve() chan error { - errCh := make(chan error, 1) - return errCh -} - -func (p *Plugin3) Stop() error { - return nil -} - -func (p *Plugin3) Name() string { - return "metrics_test.plugin3" -} - -func (p *Plugin3) MetricsCollector() prometheus.Collector { - var ( - cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "cpu_temperature_celsius", - Help: "Current temperature of the CPU.", - }) - ) - return cpuTemp -} - -type Plugin4 struct { - config config.Configurer -} - -func (p *Plugin4) Init(cfg config.Configurer) error { - p.config = cfg - return nil -} - -func (p *Plugin4) Serve() chan error { - errCh := make(chan error, 1) - return errCh -} - -func (p *Plugin4) Stop() error { - return nil -} - -func (p *Plugin4) Name() string { - return "metrics_test.plugin4" -} + collector2 := prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "my_gauge2", + Help: "My gauge2 value", + }) -func (p *Plugin4) MetricsCollector() prometheus.Collector { - var ( - cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "cpu_temperature_celsius", - Help: "Current temperature of the CPU.", - }) - ) - return cpuTemp + collector2.Set(100) + return []prometheus.Collector{collector, collector2} } |