fix(outputs.Wavefront): If no "host" tag is provided, do not add "telegraf.host" tag (#11078)
Co-authored-by: ffaroo1 <svc-registry-github@intuit.com>
This commit is contained in:
parent
3c79acbd80
commit
906b24e31d
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue