2016-09-08 14:22:10 +00:00
|
|
|
package telegraf
|
|
|
|
|
2020-06-05 14:43:43 +00:00
|
|
|
// Processor is a processor plugin interface for defining new inline processors.
|
|
|
|
// these are extremely efficient and should be used over StreamingProcessor if
|
|
|
|
// you do not need asynchronous metric writes.
|
2016-09-08 14:22:10 +00:00
|
|
|
type Processor interface {
|
2020-06-05 14:43:43 +00:00
|
|
|
PluginDescriber
|
2016-09-08 14:22:10 +00:00
|
|
|
|
2018-11-05 21:34:28 +00:00
|
|
|
// Apply the filter to the given metric.
|
2016-09-08 14:22:10 +00:00
|
|
|
Apply(in ...Metric) []Metric
|
|
|
|
}
|
2020-06-05 14:43:43 +00:00
|
|
|
|
|
|
|
// StreamingProcessor is a processor that can take in a stream of messages
|
|
|
|
type StreamingProcessor interface {
|
|
|
|
PluginDescriber
|
|
|
|
|
|
|
|
// Start is the initializer for the processor
|
|
|
|
// Start is only called once per plugin instance, and never in parallel.
|
|
|
|
// Start should exit immediately after setup
|
|
|
|
Start(acc Accumulator) error
|
|
|
|
|
|
|
|
// Add is called for each metric to be processed.
|
|
|
|
Add(metric Metric, acc Accumulator)
|
|
|
|
|
|
|
|
// Stop gives you a callback to free resources.
|
|
|
|
// by the time Stop is called, the input stream will have already been closed
|
|
|
|
// and Add will not be called anymore.
|
|
|
|
// When stop returns, you should no longer be writing metrics to the
|
|
|
|
// accumulator.
|
|
|
|
Stop() error
|
|
|
|
}
|