influxdb-client-ruby icon indicating copy to clipboard operation
influxdb-client-ruby copied to clipboard

Batching POST request is locked on nanosecond timeprecision

Open Ibbend opened this issue 2 years ago • 1 comments

Steps to reproduce:

Instantiate the session similarly to:

influxdb = InfluxDB2::Client.new("http://#{INFLUXDB_HOST}:8086",
                                          INFLUXDB_TOKEN,
                                          bucket: INFLUXDB_DATA, org: INFLUXDB_ORG,
                                          use_ssl: false,
                                          precision: InfluxDB2::WritePrecision::SECOND)
write_options = InfluxDB2::WriteOptions.new(write_type: InfluxDB2::WriteType::BATCHING,
                                                    batch_size: 100, flush_interval: 90_000,
                                                    max_retries: 3, max_retry_delay: 15_000,
                                                    exponential_base: 2)

influx_write_api = influxdb.create_write_api(write_options: write_options)

influx_write_api.write(data: <whatever data with timestamp in seconds>)

Expected behavior: The data should be sent with seconds time precision.

Actual behavior: The data is sent with nanoseconds time precision, and is not recognized by Influx since its timestamp is in seconds. Here's a screenshot of pcap POST request packet: image You can see that the precision used is ns instead of s.

Specifications:

  • Client Version: 2.9.0
  • InfluxDB Version: 2.6.1
  • Platform: Alpine Linux v3.17

Ibbend avatar Mar 02 '23 14:03 Ibbend

I was having the same issue. Specifying the precision also on the write call worked for me as a workaround:

influx_write_api.write(data: <whatever data with timestamp in seconds>, precision: 's')

apauly avatar Apr 05 '23 20:04 apauly