Skip to content

Add option to configure `metric_batch_size`

Description

In default configuration telegraf sends all colected metrics with 1000 metric buffer. In my environment I'm collecting sometimes at least 600+ metrics, which is fine, but for some reason not all of them reach destination. Somewhere packets are lost (I've tried to find them, but without success). I managed to find a solution (or workaround) in defining how much/how fast telegraf would send those packets.

The solution is to set smaller metric_batch_size in telegraf.conf It forces telegraf to send smaller batches and keep remaining in buffer, sending them in next flush.

Proposal

Add in templates/telegraf.conf

[agent]
...
{% if telegraf_metric_batch_size %}
metric_batch_size = {{ telegraf_metric_batch_size }} 
{% endif %}

Links / references

Telegraf Configuration readme