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:
11
registry/aggregators/registry.go
Normal file
11
registry/aggregators/registry.go
Normal 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
1
registry/doc.go
Normal file
@@ -0,0 +1 @@
|
||||
package registry
|
||||
11
registry/inputs/registry.go
Normal file
11
registry/inputs/registry.go
Normal 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
|
||||
}
|
||||
13
registry/outputs/registry.go
Normal file
13
registry/outputs/registry.go
Normal 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
|
||||
}
|
||||
11
registry/processors/registry.go
Normal file
11
registry/processors/registry.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user