From a39a7a7a031273db4199e5a4942e709ab1f75a0d Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 14 Jan 2016 10:31:47 -0800 Subject: [PATCH] Add an interface:"all" tag to the net protocol counters fixes #508 --- CHANGELOG.md | 1 + plugins/inputs/system/net.go | 5 ++++- plugins/inputs/system/net_test.go | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56058b4d3..9e7fc92da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Bugfixes - [#506](https://github.com/influxdb/telegraf/pull/506): Ping input doesn't return response time metric when timeout. Thanks @titilambert! +- [#508](https://github.com/influxdb/telegraf/pull/508): Fix prometheus cardinality issue with the `net` plugin ## v0.10.0 [2014-01-12] diff --git a/plugins/inputs/system/net.go b/plugins/inputs/system/net.go index 95df7a741..42f0d5854 100644 --- a/plugins/inputs/system/net.go +++ b/plugins/inputs/system/net.go @@ -94,7 +94,10 @@ func (s *NetIOStats) Gather(acc inputs.Accumulator) error { fields[name] = value } } - acc.AddFields("net", fields, nil) + tags := map[string]string{ + "interface": "all", + } + acc.AddFields("net", fields, tags) return nil } diff --git a/plugins/inputs/system/net_test.go b/plugins/inputs/system/net_test.go index ba71848d1..3ec2cb990 100644 --- a/plugins/inputs/system/net_test.go +++ b/plugins/inputs/system/net_test.go @@ -80,7 +80,10 @@ func TestNetStats(t *testing.T) { "udp_noports": int64(892592), "udp_indatagrams": int64(4655), } - acc.AssertContainsTaggedFields(t, "net", fields2, make(map[string]string)) + ntags = map[string]string{ + "interface": "all", + } + acc.AssertContainsTaggedFields(t, "net", fields2, ntags) acc.Points = nil