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-29 20:31:27 +00:00
|
|
|
// Create a point with a value, decorating it with tags
|
2015-05-27 05:14:42 +00:00
|
|
|
// NOTE: tags is expected to be owned by the caller, don't mutate
|
|
|
|
// it after passing to Add.
|
2015-05-29 20:31:27 +00:00
|
|
|
Add(measurement string, value interface{}, tags map[string]string)
|
2015-05-27 05:14:42 +00:00
|
|
|
|
2015-05-29 20:31:27 +00:00
|
|
|
// Create a point with a set of values, decorating it with tags
|
2015-05-27 05:14:42 +00:00
|
|
|
// NOTE: tags and values are expected to be owned by the caller, don't mutate
|
2015-09-16 23:50:43 +00:00
|
|
|
// them after passing to AddFieldsWithTime.
|
|
|
|
AddFieldsWithTime(
|
2015-05-29 20:31:27 +00:00
|
|
|
measurement string,
|
2015-05-27 05:14:42 +00:00
|
|
|
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
|
|
|
|
}
|