break telegraf registry into separate package

this is for supporting external plugins.

external plugins will depend on a few telegraf interface types, as well
as a common telegraf registry.

this will allow external and internal plugins to both share this package
and make it easier to vendor/version the whole thing semantically, which
will make it easier to keep plugins supported across build and telegraf
versions.

see #1717
This commit is contained in:
Cameron Sparr
2017-02-04 15:58:02 +00:00
parent 9726ecfec3
commit 2eee1b84fb
124 changed files with 124 additions and 122 deletions

View File

@@ -0,0 +1,11 @@
package aggregators
import "github.com/influxdata/telegraf"
type Creator func() telegraf.Aggregator
var Aggregators = map[string]Creator{}
func Add(name string, creator Creator) {
Aggregators[name] = creator
}

1
registry/doc.go Normal file
View File

@@ -0,0 +1 @@
package registry

View File

@@ -0,0 +1,11 @@
package inputs
import "github.com/influxdata/telegraf"
type Creator func() telegraf.Input
var Inputs = map[string]Creator{}
func Add(name string, creator Creator) {
Inputs[name] = creator
}

View File

@@ -0,0 +1,13 @@
package outputs
import (
"github.com/influxdata/telegraf"
)
type Creator func() telegraf.Output
var Outputs = map[string]Creator{}
func Add(name string, creator Creator) {
Outputs[name] = creator
}

View File

@@ -0,0 +1,11 @@
package processors
import "github.com/influxdata/telegraf"
type Creator func() telegraf.Processor
var Processors = map[string]Creator{}
func Add(name string, creator Creator) {
Processors[name] = creator
}