forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registry.go
34 lines (27 loc) · 833 Bytes
/
registry.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
package plugins
import "time"
type Accumulator interface {
// Create a point with a value, decorating it with tags
// NOTE: tags is expected to be owned by the caller, don't mutate
// it after passing to Add.
Add(measurement string, value interface{}, tags map[string]string)
// Create a point with a set of values, decorating it with tags
// NOTE: tags and values are expected to be owned by the caller, don't mutate
// them after passing to AddValuesWithTime.
AddValuesWithTime(
measurement string,
values map[string]interface{},
tags map[string]string,
timestamp time.Time,
)
}
type Plugin interface {
SampleConfig() string
Description() string
Gather(Accumulator) error
}
type Creator func() Plugin
var Plugins = map[string]Creator{}
func Add(name string, creator Creator) {
Plugins[name] = creator
}