From e2d70843035d97426000e4a4ae416f3cac438d8d Mon Sep 17 00:00:00 2001 From: ffaroo1 Date: Tue, 10 May 2022 15:32:52 -0700 Subject: [PATCH 1/3] do not add telegraf.host if host not passed. --- plugins/outputs/wavefront/wavefront.go | 5 ++++- plugins/outputs/wavefront/wavefront_test.go | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/outputs/wavefront/wavefront.go b/plugins/outputs/wavefront/wavefront.go index 46ae7b6377a82..5a02bf9d73fdf 100644 --- a/plugins/outputs/wavefront/wavefront.go +++ b/plugins/outputs/wavefront/wavefront.go @@ -190,7 +190,10 @@ func (w *Wavefront) buildTags(mTags map[string]string) (string, map[string]strin for k, v := range mTags { if k == s { source = v - mTags["telegraf_host"] = mTags["host"] + if mTags["host"] != "" { + mTags["telegraf_host"] = mTags["host"] + } + sourceTagFound = true delete(mTags, k) break diff --git a/plugins/outputs/wavefront/wavefront_test.go b/plugins/outputs/wavefront/wavefront_test.go index d745108dc7e94..7868f48ec5349 100644 --- a/plugins/outputs/wavefront/wavefront_test.go +++ b/plugins/outputs/wavefront/wavefront_test.go @@ -243,6 +243,11 @@ func TestBuildTagsWithSource(t *testing.T) { "r-@l\"Ho/st", map[string]string{"something": "abc"}, }, + { + map[string]string{"hostagent": "realHost", "env": "qa", "tag": "val"}, + "realHost", + map[string]string{"env": "qa", "tag": "val"}, + }, } for _, tt := range tagtests { From f3417a3b5757210d00df9ee06ebc9515766d3751 Mon Sep 17 00:00:00 2001 From: Farukh Ali Date: Tue, 10 May 2022 21:36:08 -0700 Subject: [PATCH 2/3] fix: to pass convention check --- plugins/outputs/wavefront/wavefront.go | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/outputs/wavefront/wavefront.go b/plugins/outputs/wavefront/wavefront.go index 5a02bf9d73fdf..a84cb46b534ff 100644 --- a/plugins/outputs/wavefront/wavefront.go +++ b/plugins/outputs/wavefront/wavefront.go @@ -309,3 +309,4 @@ func isRetryable(err error) bool { } return true } + From b610a09470bb17d8f3b467df0d589992139917db Mon Sep 17 00:00:00 2001 From: Farukh Ali Date: Tue, 10 May 2022 21:39:28 -0700 Subject: [PATCH 3/3] fix: fixing format. --- plugins/outputs/wavefront/wavefront.go | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/outputs/wavefront/wavefront.go b/plugins/outputs/wavefront/wavefront.go index a84cb46b534ff..5a02bf9d73fdf 100644 --- a/plugins/outputs/wavefront/wavefront.go +++ b/plugins/outputs/wavefront/wavefront.go @@ -309,4 +309,3 @@ func isRetryable(err error) bool { } return true } -