influxdata / influxdata/influxdb-client-ruby

Batching POST request is locked on nanosecond timeprecision

Open
#128 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
50
Forks
22
PR merge metrics
No merged PRs in 30d

Description

__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: )
```

__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](https://user-images.githubusercontent.com/33008961/222449989-03b749ef-8ce7-4b9d-95cb-cb9ede2b3e52.png)
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing Client.new through create_write_api and the batching path used by WriteOptions, focusing on where the write precision becomes the POST request's query parameter. Reproduce the supplied seconds-precision batching configuration and verify that the request uses seconds rather than nanoseconds and that the data is accepted by InfluxDB.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.