如何开发Aggregator插件
Aggregator 接口定义
type LogGroupQueue interface { // Returns errAggAdd immediately if queue is full. Add(loggroup *LogGroup) error // Wait at most @duration if queue is full and returns errAggAdd if timeout. // Do not use this method if you are unsure. AddWithWait(loggroup *LogGroup, duration time.Duration) error }
// Aggregator is an interface for implementing an Aggregator plugin.
// the RunningAggregator wraps this interface and guarantees that
// Add, Push, and Reset can not be called concurrently, so locking is not
// required when implementing an Aggregator plugin.
type Aggregator interface {
// Init called for init some system resources, like socket, mutex...
// return flush interval(ms) and error flag, if interval is 0, use default interval
Init(Context, LogGroupQueue) (int, error)
// Description returns a one-sentence description on the Input.
Description() string
// Add the metric to the aggregator.
Add(log *protocol.Log) error
// Flush pushes the current aggregates to the accumulator.
Flush() []*protocol.LogGroup
// Reset resets the aggregators caches and aggregates.
Reset()
}Aggregator 开发
Last updated