-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollector.go
40 lines (35 loc) · 1.51 KB
/
collector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package snapPluginBoilerplate
import "github.com/intelsdi-x/snap-plugin-lib-go/v1/plugin"
// ExampleCollector implementation used for testing
type ExampleCollector struct {
}
/* CollectMetrics collects metrics for testing.
CollectMetrics() will be called by Snap when a task that collects one of the metrics returned from this plugins
GetMetricTypes() is started. The input will include a slice of all the metric types being collected.
The output is the collected metrics as plugin.Metric and an error.
*/
func (ExampleCollector) CollectMetrics(mts []plugin.Metric) ([]plugin.Metric, error) {
metrics := []plugin.Metric{}
return metrics, nil
}
/*
GetMetricTypes returns metric types for testing.
GetMetricTypes() will be called when your plugin is loaded in order to populate the metric catalog(where snaps stores all
available metrics).
Config info is passed in. This config information would come from global config snap settings.
The metrics returned will be advertised to users who list all the metrics and will become targetable by tasks.
*/
func (ExampleCollector) GetMetricTypes(cfg plugin.Config) ([]plugin.Metric, error) {
metrics := []plugin.Metric{}
return metrics, nil
}
/*
GetConfigPolicy() returns the configPolicy for your plugin.
A config policy is how users can provide configuration info to
plugin. Here you define what sorts of config info your plugin
needs and/or requires.
*/
func (ExampleCollector) GetConfigPolicy() (plugin.ConfigPolicy, error) {
policy := plugin.NewConfigPolicy()
return *policy, nil
}