Telegraf merge plugin

I’m trying to use the “merge” plugin to collect stats together as each values are sent per messages.

From the following:

ds_stats,cachegroup=total,cdn=cdn1,deliveryservice=test tps_5xx=0 1604066460811000000
ds_stats,cachegroup=total,cdn=cdn1,deliveryservice=test tps_total=0 1604066460811000000
ds_stats,cachegroup=total,cdn=cdn1,deliveryservice=test kbps=0 1604066460811000000

I’m trying to get this result:
ds_stats,cachegroup=total,cdn=cdn1,deliveryservice=test tps_5xx=0,tps_total=0,kbps=0 1604066460811000000

I’m using the following in my configuration:

[[aggregators.merge]]
period = “10s”

If I add “drop_original = true” then I never get any outputs.

Any feedback would be great.

Thanks, Steve

From the docs looks like “period” is not even supported in this aggregator, in fact, it does not merge point in a range, but point by key. (tags + timestamp)

Do you have other aggregators or filters in your configuration? can you share the whole config file?

I haven’t seen any example or any bug reports about this aggregator.

Here is the full configuration:

[agent]
interval = “10s”
debug = false
round_interval = true
collection_jitter = “2s”
flush_jitter = “5s”
metric_buffer_limit = 15000

[[inputs.influxdb_listener]]
service_address = “:8186”
read_timeout = “10s”
max_body_size = 0
database_tag = “db”

[[processors.starlark]]
source = ‘’’
def apply(metric):
metric.fields[str(metric.name)] = metric.fields[‘value’]
metric.name = ‘ds_stats’
metric.fields.pop(‘value’,None)
metric.tags.pop(‘host’,None)
return metric
‘’’

[[aggregators.merge]]
period = “10s”

[[outputs.file]]
files = [“stdout”]

Try to add/edit the following in your config

[agent]
  {...}
  precision = "1s"

{...}

## Clone existing data
[[processors.clone]]
  namepass = "ds_stats"
  name_override = "ds_stats_merge"

## aggreagte only the cloned data
[[aggregators.merge]]
  namepass = "ds_stats_merge"
  drop_original = false

Then have a look at the output file and look for the “ds_stats_merge” measurement… the data should be there.

Not sure this worked as intended. It created the following:

ds_stats,cachegroup=us-cdn1-edge-docker,cdn=cdn1,deliveryservice=cox-dev-csx-a ds_stats_merge=217 1604501129704000000
ds_stats,cachegroup=cdn1-atlanta,cdn=cdn1,deliveryservice=cox-dev-csx-a ds_stats_merge=0 1604501129704000000
ds_stats,cachegroup=all,cdn=cdn1,deliveryservice=cox-dev-csx-a,type=EDGE ds_stats_merge=22 1604501129704000000
ds_stats,cachegroup=all,cdn=cdn1,deliveryservice=cox-dev-csx-a,type=EDGE ds_stats_merge=0 1604501129704000000

I expected something entirely different tbh…
A full clone of the measurement, plus the merged lines…

If you remove the merge aggregator does it return a full copy of the measurement?

The current result of clone + merge does not make any sense… is not even valid line protocol… if the clone works properly, then maybe there is a problem with the merge and it might be useful to open an issue on GitHub and/or summon a developer here in this thread.

I’ll try something with static data tomorrow and see if I can replicate the issue