summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/agent/module/module.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/collectors/go.d.plugin/agent/module/module.go')
-rw-r--r--src/go/collectors/go.d.plugin/agent/module/module.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/agent/module/module.go b/src/go/collectors/go.d.plugin/agent/module/module.go
new file mode 100644
index 0000000000..3421a02ee7
--- /dev/null
+++ b/src/go/collectors/go.d.plugin/agent/module/module.go
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package module
+
+import (
+ "github.com/netdata/go.d.plugin/logger"
+)
+
+// Module is an interface that represents a module.
+type Module interface {
+ // Init does initialization.
+ // If it returns false, the job will be disabled.
+ Init() bool
+
+ // Check is called after Init.
+ // If it returns false, the job will be disabled.
+ Check() bool
+
+ // Charts returns the chart definition.
+ // Make sure not to share returned instance.
+ Charts() *Charts
+
+ // Collect collects metrics.
+ Collect() map[string]int64
+
+ // Cleanup Cleanup
+ Cleanup()
+
+ GetBase() *Base
+}
+
+// Base is a helper struct. All modules should embed this struct.
+type Base struct {
+ *logger.Logger
+}
+
+func (b *Base) GetBase() *Base { return b }