Overhaul config <-> agent coupling. Put config in it's own package.
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/influxdb/telegraf/internal/config"
|
||||
|
||||
"github.com/influxdb/influxdb/client/v2"
|
||||
)
|
||||
|
||||
@@ -27,12 +29,12 @@ type Accumulator interface {
|
||||
}
|
||||
|
||||
func NewAccumulator(
|
||||
plugin *ConfiguredPlugin,
|
||||
pluginConfig *config.PluginConfig,
|
||||
points chan *client.Point,
|
||||
) Accumulator {
|
||||
acc := accumulator{}
|
||||
acc.points = points
|
||||
acc.plugin = plugin
|
||||
acc.pluginConfig = pluginConfig
|
||||
return &acc
|
||||
}
|
||||
|
||||
@@ -45,7 +47,7 @@ type accumulator struct {
|
||||
|
||||
debug bool
|
||||
|
||||
plugin *ConfiguredPlugin
|
||||
pluginConfig *config.PluginConfig
|
||||
|
||||
prefix string
|
||||
}
|
||||
@@ -104,8 +106,8 @@ func (ac *accumulator) AddFields(
|
||||
measurement = ac.prefix + measurement
|
||||
}
|
||||
|
||||
if ac.plugin != nil {
|
||||
if !ac.plugin.ShouldPass(measurement) || !ac.plugin.ShouldTagsPass(tags) {
|
||||
if ac.pluginConfig != nil {
|
||||
if !ac.pluginConfig.ShouldPass(measurement) || !ac.pluginConfig.ShouldTagsPass(tags) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user