Aggregator Merge Plugin tag parameter

I’m using the Merge Plugin and had a question about the tags parameter that can be used with any aggregator plugin.

Can anyone please explain, with an example, of how the tags parameter located here is used?

Do I assign this parameter a list of tags to aggregate the data by? Will the data be aggregated by each tag that I provide to this parameter?

For example, if I want the data to be aggregated by three tags would I assign the tags parameter a list like this? tags = ["name","source","tag_name"]

Thank you.

Hey @mohsin106!

In Telegraf world a tag is a key-value pair. To add / modify tags you need to add a TOML section to the plugin. In your example this should work

[[aggregators.merge]]
  ## If true, the original metric will be dropped by the
  ## aggregator and will not get sent to the output plugins.
  drop_original = true

  ## Add tags to the output
  [aggregators.merge.tags]
    name = "my name to add"
    source = "any source you want"
    tag_name = "huh?"

I don’t see tag_name as a parameter to use here. Does it do the same thing?

I’m not sure I do understand your question. My example will create three new tags with the names name, source and tag_name and the corresponding values my name to add, any source you want and huh?. So everything below [aggregators.merge.tags] are the <key> = "<value>" tag pairs (that’s why this section needs to be the last element in the config).

See telegraf/CONFIGURATION.md at master · influxdata/telegraf (github.com) for more examples, it also holds for aggregators, processors and outputs…


I’m referring to the tags parameter in the image above.
This is what my aggregator plugin looks like:

[[aggregators.merge]]
  drop_original = true
  grace = "60s"
  name_prefix = "agg_"
  tags = ["name","source","tag_name"]

Just trying to understand what tags = ["name","source","tag_name"] would do in my case?

Ok I think I understand that it does now. the tags parameter is not going to aggregate the data set based on the specified tags, but it will add new tags to your data set.

You config will not work. Please note the map in the comment you are citing…

  • tags: A map of tags to apply to the measurement - behavior varies based on aggregator.

Got it. I will have to create the stanza in a map format as you provided above. Thanks for the clarification.

1 Like