Skip to content

fix: send correct time unit when writing Points#384

Merged
NguyenHoangSon96 merged 5 commits into
mainfrom
fix/incorrect-write-timestamp1
May 13, 2026
Merged

fix: send correct time unit when writing Points#384
NguyenHoangSon96 merged 5 commits into
mainfrom
fix/incorrect-write-timestamp1

Conversation

@NguyenHoangSon96
Copy link
Copy Markdown
Contributor

@NguyenHoangSon96 NguyenHoangSon96 commented May 11, 2026

Closes #382

Proposed Changes

  • When writing Points, precision in query parameters always set to nanosecond because time in Points always converted into nanoseconds by default.
  • Update test cases to respect the new changes above.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@NguyenHoangSon96 NguyenHoangSon96 self-assigned this May 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.25%. Comparing base (a0b6dbf) to head (80f95ef).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #384      +/-   ##
==========================================
+ Coverage   88.19%   88.25%   +0.05%     
==========================================
  Files          21       21              
  Lines        1525     1532       +7     
  Branches      275      277       +2     
==========================================
+ Hits         1345     1352       +7     
  Misses         82       82              
  Partials       98       98              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a write precision mismatch when writing Point objects to InfluxDB v3: the line protocol payload is serialized with nanosecond timestamps, so the request’s precision query parameter must match to avoid server-side “timestamp out of range for precision” errors (issue #382).

Changes:

  • Force precision=nanosecond in write query parameters when writing Point instances.
  • Update unit tests to expect precision=nanosecond for Point writes even when client config sets another precision.
  • Add an end-to-end integration test covering writing points with timestamps provided in different input units.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/main/java/com/influxdb/v3/client/internal/InfluxDBClientImpl.java Changes precision selection logic for write requests when writing Points.
src/test/java/com/influxdb/v3/client/InfluxDBClientWriteTest.java Updates expected precision in write request assertions for point writes.
src/test/java/com/influxdb/v3/client/integration/E2ETest.java Adds an integration test that writes multiple points with mixed timestamp input units.
CHANGELOG.md Documents the bug fix in the unreleased section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/java/com/influxdb/v3/client/InfluxDBClientWriteTest.java Outdated
Comment thread src/test/java/com/influxdb/v3/client/InfluxDBClientWriteTest.java Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 13 comments.

Comment thread src/main/java/com/influxdb/v3/client/internal/InfluxDBClientImpl.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/config/ClientConfig.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/config/ClientConfig.java Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/test/java/com/influxdb/v3/client/integration/E2ETest.java
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread src/test/java/com/influxdb/v3/client/integration/E2ETest.java
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/test/java/com/influxdb/v3/client/integration/E2ETest.java
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread src/test/java/com/influxdb/v3/client/integration/E2ETest.java
Comment thread src/test/java/com/influxdb/v3/client/integration/E2ETest.java
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java
Comment thread src/main/java/com/influxdb/v3/client/config/ClientConfig.java
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/main/java/com/influxdb/v3/client/internal/InfluxDBClientImpl.java:34

  • Unused import java.util.function.Predicate is introduced but not used anywhere in this class. This will fail the repository's Checkstyle UnusedImports rule; please remove it.
import java.util.logging.Logger;

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/test/java/com/influxdb/v3/client/InfluxDBClientWriteTest.java
@NguyenHoangSon96 NguyenHoangSon96 force-pushed the fix/incorrect-write-timestamp1 branch 2 times, most recently from d0d491b to e180f32 Compare May 12, 2026 05:06
@NguyenHoangSon96 NguyenHoangSon96 requested a review from alespour May 12, 2026 05:11
Copy link
Copy Markdown
Contributor

@alespour alespour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should tweak javadoc for precision args just a tiny bit, Copilot finding makes sense. And cover the logic more by unit test in addition to e2e test.

Comment thread src/test/java/com/influxdb/v3/client/InfluxDBClientWriteTest.java
Comment thread src/main/java/com/influxdb/v3/client/config/ClientConfig.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/config/ClientConfig.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
@NguyenHoangSon96 NguyenHoangSon96 force-pushed the fix/incorrect-write-timestamp1 branch from bbd627f to effee32 Compare May 13, 2026 05:16
@NguyenHoangSon96 NguyenHoangSon96 requested a review from alespour May 13, 2026 06:08
Copy link
Copy Markdown
Contributor

@alespour alespour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry found one last occurrence, otherwise this PR is GTG

Comment thread src/main/java/com/influxdb/v3/client/write/WriteOptions.java Outdated
@NguyenHoangSon96 NguyenHoangSon96 requested a review from alespour May 13, 2026 09:22
Copy link
Copy Markdown
Contributor

@alespour alespour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now

@NguyenHoangSon96 NguyenHoangSon96 merged commit 8221ebe into main May 13, 2026
18 checks passed
@NguyenHoangSon96 NguyenHoangSon96 deleted the fix/incorrect-write-timestamp1 branch May 13, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Precision not respected when sending LP

4 participants