InfluxDBOut and precision settings in Kapacitor


I am using Kapacitor to transform already collected data. The data comes into Tick scripts as a stream, and then I perform some built-in functions and use a UDF to adjust both fields, tags, and the value of time.

The points coming out of the UDF are in nanoseconds but really only contain actual precision of milliseconds (i.e., every time values has 6 zeros on the end).

I use InfluxDBOut to write the new points into a new Database in InfluxDB. Everything works fine, but I was curious about potentially optimizing things by actually setting the precision for the calls in InfluxDBOut. I tried using the property InfluxDBOut.precision('ms') but that did not seem to have an effect in the write calls to InfluxDB (i.e., I can see in Kapacitor.log that the write calls to the InfluxDB http API still use precision=ns).

Is there something about how the time field is stored in Kapacitor that nullifies my use of InfluxDBOut.precision('ms') without using stats.align() or window.align()? Is there anything I can do in my UDF to help force Kapacitor to use the assigned precision in InfluxDBOut?


Have you tried using node.precision() in your TICK script?



Yes, I was using .precision() as part of influxDBOut(). Setting it to seconds or minutes didn’t seem to have an impact.

The question is does the precision() setting actually enforce the precision or does it assume that the timestamp coming into InfluxDBOut() has already been set to a specific precision?