Intended behaviour on tagging - Ref. Commit #1056

Hey guys,

I’m new to the party, so please forgive stupid questions :wink:

My issue is with the Commit mentioned above - specifically, it changes the behaviour of how telegraf works with tagging. It no longer allows a global tag to be overwritten by the plugin configuration tag. I’m wondering if this is really the intended behaviour. From my viewpoint, it makes sense that a plugin configuration is able to overwrite a globally set tag. In my understanding having the global tag as the “default” tag and allowing plugin specific tags to overwrite this is a better handling of tagging in general.

It makes, in my view, especially sense because you allow the plugin code to change the tag, but not the plugin configuration.

Thanks for consideration

This change is a couple years old now, so we would need to be mindful of changes to behavior, but we could reevaluate the behavior. I tried setting up a socket_listener like this and was able to overwrite both the global tag and the host tag:

Config:

[global_tags]
  user = "$USER"

[[inputs.socket_listener]]
  service_address = "udp://:8094"
  [inputs.socket_listener.tags]
     user = "foo"
     host = "bar"

Send in test data:

$ echo 'test foo=42' > /dev/udp/localhost/8094

Output:

test,user=foo,host=bar foo=42 1516992294854331996

It looks like it is overwriting the values in this setup, can you add some details about what you have tried?

Not sure what I was on about, honestly - It does indeed seem to work perfectly fine. Sorry about that.