2016-12-23 15:18:27 +00:00
|
|
|
package plugins
|
2015-04-06 16:32:10 +00:00
|
|
|
|
2016-01-27 21:21:36 +00:00
|
|
|
import "time"
|
2015-04-06 16:32:10 +00:00
|
|
|
|
2016-09-08 14:22:10 +00:00
|
|
|
// Accumulator is an interface for "accumulating" metrics from plugin(s).
|
|
|
|
// The metrics are sent down a channel shared between all plugins.
|
2015-10-16 22:13:32 +00:00
|
|
|
type Accumulator interface {
|
2016-09-05 09:41:35 +00:00
|
|
|
// AddFields adds a metric to the accumulator with the given measurement
|
|
|
|
// name, fields, and tags (and timestamp). If a timestamp is not provided,
|
|
|
|
// then the accumulator sets it to "now".
|
2016-01-27 21:21:36 +00:00
|
|
|
// Create a point with a value, decorating it with tags
|
|
|
|
// NOTE: tags is expected to be owned by the caller, don't mutate
|
|
|
|
// it after passing to Add.
|
|
|
|
AddFields(measurement string,
|
|
|
|
fields map[string]interface{},
|
|
|
|
tags map[string]string,
|
|
|
|
t ...time.Time)
|
2015-05-20 05:19:32 +00:00
|
|
|
|
2016-09-05 09:41:35 +00:00
|
|
|
// AddGauge is the same as AddFields, but will add the metric as a "Gauge" type
|
2016-08-31 16:27:37 +00:00
|
|
|
AddGauge(measurement string,
|
|
|
|
fields map[string]interface{},
|
|
|
|
tags map[string]string,
|
|
|
|
t ...time.Time)
|
|
|
|
|
2016-09-05 09:41:35 +00:00
|
|
|
// AddCounter is the same as AddFields, but will add the metric as a "Counter" type
|
2016-08-31 16:27:37 +00:00
|
|
|
AddCounter(measurement string,
|
|
|
|
fields map[string]interface{},
|
|
|
|
tags map[string]string,
|
|
|
|
t ...time.Time)
|
|
|
|
|
2016-06-13 14:21:11 +00:00
|
|
|
SetPrecision(precision, interval time.Duration)
|
|
|
|
|
2016-09-08 14:22:10 +00:00
|
|
|
AddError(err error)
|
2015-04-06 16:32:10 +00:00
|
|
|
}
|