summaryrefslogtreecommitdiff
path: root/plugins/metrics/tests/plugin1.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-13 16:29:08 +0300
committerValery Piashchynski <[email protected]>2020-11-13 16:29:08 +0300
commit6eefd067f4c08ed51834926abd1a4c60ec55b56d (patch)
tree5c4e3d3d930243f0c19083eff8bd5719ec266500 /plugins/metrics/tests/plugin1.go
parent002eb4bb1981558fa5e614aed22d322f0f45d7ea (diff)
Update tests
Diffstat (limited to 'plugins/metrics/tests/plugin1.go')
-rw-r--r--plugins/metrics/tests/plugin1.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/metrics/tests/plugin1.go b/plugins/metrics/tests/plugin1.go
new file mode 100644
index 00000000..fdf10e54
--- /dev/null
+++ b/plugins/metrics/tests/plugin1.go
@@ -0,0 +1,49 @@
+package tests
+
+import (
+ "fmt"
+
+ "github.com/prometheus/client_golang/prometheus"
+ "github.com/spiral/roadrunner/v2/plugins/config"
+)
+
+type Plugin1 struct {
+ config config.Configurer
+}
+
+func (p1 *Plugin1) Init(cfg config.Configurer) error {
+ p1.config = cfg
+ return nil
+}
+
+func (p1 *Plugin1) Serve() chan error {
+ errCh := make(chan error, 1)
+ return errCh
+}
+
+func (p1 *Plugin1) Stop() error {
+ return nil
+}
+
+func (p1 *Plugin1) Name() string {
+ return "metrics_test.plugin1"
+}
+
+func (p1 *Plugin1) MetricsCollector() prometheus.Collector {
+ var (
+ cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
+ Name: "cpu_temperature_celsius",
+ Help: "Current temperature of the CPU.",
+ })
+ )
+ return cpuTemp
+}
+
+type PluginRpc struct {
+ srv *Plugin1
+}
+
+func (r *PluginRpc) Hello(in string, out *string) error {
+ *out = fmt.Sprintf("Hello, username: %s", in)
+ return nil
+}