Time precision in telegraf output or influxdb

If there is any way to specify default time precision in influxdb or can we convert while sending it from telegraf to influxdb?

Setup

  • Collecting data from telegraf inputs.amqp. Data in line protocol with the timestamp in seconds
  • telegraph’s outputs.influxb sends data to influxdb.

Data in line protocol with the timestamp in seconds

Just to clarify, do you mean the line protocol timestamp is formatted like this?:

foo value=42 1518817202

If so, we only have support for nanoseconds currently, other precisions are only supported in the http_listener input, but you could open a new issue.

foo value=42 1518817202

Yes, the data contains timestamp in seconds.

So configurable time precision not supported yet. Is it possible to write custom telegraf plugin on top of the existing amqp_consumer plugin to achieve this? I did look at some of the telegraf plugins, but I’m quite new to Go lang so raising an issue here.

The reason for doing this, we get 2-3 data per sensor per minutes, so second precision makes sense. But to convert into the nanoseconds will take 9 more bytes per message.

You can achieve this by just zero-padding the timestamp to 19 digits (full nanosecond resolution). The system will roll up the datapoints for you during queries.

Already mentioned the reason for not to append 9 zeros, it takes more memory.