2015-04-01 16:34:32 +00:00
|
|
|
package plugins
|
|
|
|
|
2015-05-27 05:14:42 +00:00
|
|
|
import "time"
|
|
|
|
|
2015-04-06 16:32:10 +00:00
|
|
|
type Accumulator interface {
|
2015-05-27 05:14:42 +00:00
|
|
|
// Create a named point with a value, decorating it with named tags
|
|
|
|
// NOTE: tags is expected to be owned by the caller, don't mutate
|
|
|
|
// it after passing to Add.
|
2015-04-06 16:32:10 +00:00
|
|
|
Add(name string, value interface{}, tags map[string]string)
|
2015-05-27 05:14:42 +00:00
|
|
|
|
|
|
|
// Create a named point with a set of values, decorating it with named tags
|
|
|
|
// NOTE: tags and values are expected to be owned by the caller, don't mutate
|
|
|
|
// them after passing to AddValuesWithTime.
|
|
|
|
AddValuesWithTime(
|
|
|
|
name string,
|
|
|
|
values map[string]interface{},
|
|
|
|
tags map[string]string,
|
|
|
|
timestamp time.Time,
|
|
|
|
)
|
2015-04-06 16:32:10 +00:00
|
|
|
}
|
2015-04-01 16:34:32 +00:00
|
|
|
|
|
|
|
type Plugin interface {
|
2015-05-18 22:10:11 +00:00
|
|
|
SampleConfig() string
|
|
|
|
Description() string
|
2015-04-06 16:32:10 +00:00
|
|
|
Gather(Accumulator) error
|
2015-04-01 16:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Creator func() Plugin
|
|
|
|
|
|
|
|
var Plugins = map[string]Creator{}
|
|
|
|
|
|
|
|
func Add(name string, creator Creator) {
|
|
|
|
Plugins[name] = creator
|
|
|
|
}
|