influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.63k stars 5.58k forks source link

Log error when metric name is empty #8841

Closed reimda closed 1 year ago

reimda commented 3 years ago

It's possible for telegraf to generate a metric with no metric name. This is not useful because metrics without names are silently dropped, leaving the user with no way to know why metrics are missing. Telegraf should log an error when the metric name is blank so the user can fix the problem.

For example, see #8840

Input plugins shouldn't produce metrics with no name, but there's nothing preventing them from doing so. Telegraf should log an error if any input produces an unnamed metric. I would expect this generic error to be something like "error: dropping metric with empty name. tags:agent_host=127.0.0.1,index=5 fields:ifHCOutOctets=0i,ifHCInOctets=0i time:1612830898000000000". It would be nice to print the input plugin name but I'm not sure this is available.

Telegraf could log such an error when the metric is given to the accumulator, or right before the metric is passed to outputs.

powersj commented 2 years ago

next steps: determine when to add this check (e.g. at metric creation? during outputs? etc.)