2016-01-28 05:21:36 +08:00
|
|
|
package telegraf
|
|
|
|
|
|
|
|
|
|
type Output interface {
|
2020-06-05 22:43:43 +08:00
|
|
|
PluginDescriber
|
|
|
|
|
|
2020-10-14 23:12:41 +08:00
|
|
|
// Connect to the Output; connect is only called once when the plugin starts
|
2016-01-28 05:21:36 +08:00
|
|
|
Connect() error
|
2020-10-14 23:12:41 +08:00
|
|
|
// Close any connections to the Output. Close is called once when the output
|
|
|
|
|
// is shutting down. Close will not be called until all writes have finished,
|
|
|
|
|
// and Write() will not be called once Close() has been, so locking is not
|
|
|
|
|
// necessary.
|
2016-01-28 05:21:36 +08:00
|
|
|
Close() error
|
|
|
|
|
// Write takes in group of points to be written to the Output
|
2016-01-28 07:15:14 +08:00
|
|
|
Write(metrics []Metric) error
|
2016-01-28 05:21:36 +08:00
|
|
|
}
|
|
|
|
|
|
2018-09-12 15:23:50 +08:00
|
|
|
// AggregatingOutput adds aggregating functionality to an Output. May be used
|
|
|
|
|
// if the Output only accepts a fixed set of aggregations over a time period.
|
|
|
|
|
// These functions may be called concurrently to the Write function.
|
2018-09-06 05:50:32 +08:00
|
|
|
type AggregatingOutput interface {
|
2018-11-06 05:34:28 +08:00
|
|
|
Output
|
2018-09-12 15:23:50 +08:00
|
|
|
|
|
|
|
|
// Add the metric to the aggregator
|
2018-09-06 05:50:32 +08:00
|
|
|
Add(in Metric)
|
2018-09-12 15:23:50 +08:00
|
|
|
// Push returns the aggregated metrics and is called every flush interval.
|
2018-09-06 05:50:32 +08:00
|
|
|
Push() []Metric
|
2018-09-12 15:23:50 +08:00
|
|
|
// Reset signals the the aggregator period is completed.
|
2018-09-06 05:50:32 +08:00
|
|
|
Reset()
|
|
|
|
|
}
|