Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
32
plugins/processors/registry.go
Normal file
32
plugins/processors/registry.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package processors
|
||||
|
||||
import "github.com/influxdata/telegraf"
|
||||
|
||||
type Creator func() telegraf.Processor
|
||||
type StreamingCreator func() telegraf.StreamingProcessor
|
||||
|
||||
// HasUnwrap indicates the presence of an Unwrap() function to retrieve the
|
||||
// underlying telegraf.Processor.
|
||||
type HasUnwrap interface {
|
||||
Unwrap() telegraf.Processor
|
||||
}
|
||||
|
||||
// all processors are streaming processors.
|
||||
// telegraf.Processor processors are upgraded to telegraf.StreamingProcessor
|
||||
var Processors = make(map[string]StreamingCreator)
|
||||
|
||||
// Add adds a telegraf.Processor processor
|
||||
func Add(name string, creator Creator) {
|
||||
Processors[name] = upgradeToStreamingProcessor(creator)
|
||||
}
|
||||
|
||||
// AddStreaming adds a telegraf.StreamingProcessor streaming processor
|
||||
func AddStreaming(name string, creator StreamingCreator) {
|
||||
Processors[name] = creator
|
||||
}
|
||||
|
||||
func upgradeToStreamingProcessor(oldCreator Creator) StreamingCreator {
|
||||
return func() telegraf.StreamingProcessor {
|
||||
return NewStreamingProcessorFromProcessor(oldCreator())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue