From 80fa87f1979a440aa037ce48d55d14e8bf0d9c2d Mon Sep 17 00:00:00 2001 From: Vladimir Sagan Date: Thu, 23 Jun 2016 11:11:44 +0300 Subject: [PATCH] Remove flush_scope logic --- plugins/inputs/cgroup/README.md | 1 - plugins/inputs/cgroup/cgroup.go | 27 +++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/plugins/inputs/cgroup/README.md b/plugins/inputs/cgroup/README.md index a8fd1243e..283b17634 100644 --- a/plugins/inputs/cgroup/README.md +++ b/plugins/inputs/cgroup/README.md @@ -41,7 +41,6 @@ All measurements have the following tags: ``` # [[inputs.cgroup]] - # flush_scope = 10 # optional (the fields will be divided into parts of 10 items) # paths = [ # "/cgroup/memory", # root cgroup # "/cgroup/memory/child1", # container cgroup diff --git a/plugins/inputs/cgroup/cgroup.go b/plugins/inputs/cgroup/cgroup.go index df8f9d915..57ea67a06 100644 --- a/plugins/inputs/cgroup/cgroup.go +++ b/plugins/inputs/cgroup/cgroup.go @@ -18,9 +18,8 @@ import ( const metricName = "cgroup" type CGroup struct { - Paths []string `toml:"paths"` - Files []string `toml:"fields"` - FlushScope int `toml:"flush_scope"` + Paths []string `toml:"paths"` + Files []string `toml:"fields"` } var sampleConfig = ` @@ -83,31 +82,11 @@ func (g *CGroup) gatherDir(dir string, acc telegraf.Accumulator) error { tags := map[string]string{"path": dir} - if g.FlushScope <= 0 { - acc.AddFields(metricName, fields, tags) - return nil - } - writeWithBatches(acc, fields, tags, g.FlushScope) + acc.AddFields(metricName, fields, tags) return nil } -func writeWithBatches(acc telegraf.Accumulator, fields map[string]interface{}, tags map[string]string, scope int) { - for len(fields) > 0 { - batch := make(map[string]interface{}) - - for k, v := range fields { - batch[k] = v - delete(fields, k) - if len(batch) == scope || len(fields) == 0 { - break - } - } - - acc.AddFields(metricName, batch, tags) - } -} - // ====================================================================== type pathInfo struct {