Refactor and code cleanup of filtering

started working on this with the idea of fixing #1623, although I
realized that this was actually just a documentation issue around
a toml eccentricity.

closes #1623
This commit is contained in:
Cameron Sparr
2016-09-05 16:16:37 +01:00
parent b63dedb74d
commit 50ef3282b6
12 changed files with 216 additions and 173 deletions

View File

@@ -77,13 +77,13 @@ func (s *Varnish) Gather(acc telegraf.Accumulator) error {
if s.filter == nil {
var err error
if len(s.Stats) == 0 {
s.filter, err = filter.CompileFilter(defaultStats)
s.filter, err = filter.Compile(defaultStats)
} else {
// legacy support, change "all" -> "*":
if s.Stats[0] == "all" {
s.Stats[0] = "*"
}
s.filter, err = filter.CompileFilter(s.Stats)
s.filter, err = filter.Compile(s.Stats)
}
if err != nil {
return err