How to handle missing data to telegraf plugin?

If I have a telegraf plugin (custom) running to grab data from a sensor at a fixed rate (e.g., once per minute), what is the best way to handle the case where the plugin fails to get a sample due to a transient network error, or similar. My concern is to have the data collection program return gracefully when that happens and not hang. But if it returns without valid data, what should it pass to telegraf?


The easiest and kind of obvious way is to don’t pass anything.
If a sample is missing (or invalid), which may happen for lots of reasons then you just don’t have the data, and having no data is itself information (which I don’t usually hide)
InfluxDB does a good job in filling those gaps (if needed) by using the fill() function, both in InfluxQL and Flux.

Thanks for that Giovanni. It’s certainly easy to implement. :slight_smile:
The reason I asked is that some data analysis tools that I use get very grumpy about missing data points and do things like plot missing points with value 1e-99. Good to know that Influx isn’t that picky!