From e2e44a3374c4963a78c7bf87ed85b8b4059074aa Mon Sep 17 00:00:00 2001 From: Charlie Smith Date: Wed, 27 Jun 2018 19:34:55 -0400 Subject: [PATCH] fix issue parsing metric names (#15) --- CHANGELOG.md | 7 +++++++ plugins/outputs/signalfx/parse/parse.go | 10 +++++----- plugins/outputs/signalfx/signalfx.go | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 141a55eff0adf..ef7b33e0b8f8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## v1.7.0.sfx1 [2018-06-27] + +### Release Notes + +- Fix bug in SignalFx Output Plugin that resulted in metrics with "value" field + to be dropped + ## v1.7.0.sfx0 [2018-06-22] ### Release Notes diff --git a/plugins/outputs/signalfx/parse/parse.go b/plugins/outputs/signalfx/parse/parse.go index 7ace0a63c9367..ad902e7b53e8d 100644 --- a/plugins/outputs/signalfx/parse/parse.go +++ b/plugins/outputs/signalfx/parse/parse.go @@ -21,18 +21,18 @@ func SetPluginDimension(metricName string, metricDims map[string]string) { } // GetMetricName combines telegraf fields and tags into a full metric name -func GetMetricName(metric string, field string, dims map[string]string) (name string, isSFX bool) { +func GetMetricName(metric string, field string, dims map[string]string) (string, bool) { // If sf_metric is provided - if name, isSFX = dims["sf_metric"]; isSFX { - return + if name, isSFX := dims["sf_metric"]; isSFX { + return name, isSFX } // Include field when it adds to the metric name if field != "value" { - name = metric + "." + field + return fmt.Sprintf("%s.%s", metric, field), false } - return + return metric, false } // ExtractProperty of the metric according to the following rules diff --git a/plugins/outputs/signalfx/signalfx.go b/plugins/outputs/signalfx/signalfx.go index 7439ed30cbb20..9c41d1cd83051 100644 --- a/plugins/outputs/signalfx/signalfx.go +++ b/plugins/outputs/signalfx/signalfx.go @@ -231,7 +231,7 @@ func (s *SignalFx) GetObjects(metrics []telegraf.Metric, dps chan *datapoint.Dat // Check if the metric is explicitly excluded if s.isExcluded(metricName) { - log.Println("D! Outputs [signalfx] excluding the following metric: ", metricName) + log.Println("D! Outputs [signalfx] excluding the following metric: ", metricName, metric) continue }