fix: write API defaults#19
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
==========================================
+ Coverage 83.41% 83.45% +0.03%
==========================================
Files 10 10
Lines 1815 1837 +22
==========================================
+ Hits 1514 1533 +19
- Misses 301 304 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a163c75 to
bbab379
Compare
bbab379 to
ae0f712
Compare
There was a problem hiding this comment.
Pull request overview
Aligns the Rust client’s default write behavior with other clients by switching the default write endpoint to the V2 compatibility API (/api/v2/write), improving out-of-the-box compatibility across the InfluxDB 3 family. It also adds configuration validation to prevent V3-only options (notably no_sync) from being used with the V2 endpoint.
Changes:
- Switch
WriteOptionsdefault touse_v2_api = trueand add validation enforcingno_syncrequiresuse_v2_api=false. - Add
ClientConfigBuilderconvenience setters:write_use_v2_api,write_accept_partial,write_no_sync. - Update tests and documentation to reflect the new defaults and constraints.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/write.rs |
Defaults writes to V2 endpoint and introduces WriteOptions::validate() for incompatible option detection. |
src/config.rs |
Adds builder helpers for common write defaults and validates write options during config build. |
src/client.rs |
Validates per-request write options at execution time to catch invalid overrides (e.g., .no_sync() under V2). |
tests/write_tests.rs |
Updates write tests for new default endpoint and adds a test asserting no_sync requires V3. |
tests/retry_tests.rs |
Ensures retry tests explicitly use V3 to preserve existing test expectations. |
tests/config_tests.rs |
Adds coverage for new default + builder helpers and validates invalid no_sync/V2 combinations. |
README.md |
Updates version/examples and documents environment/connection-string write defaults and endpoint compatibility. |
CHANGELOG.md |
Documents the default endpoint change and V3-only behavior constraints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed Changes
Aligns Rust client behaviour with the rest - switches the default write endpoint to v2 for broader InfluxDB 3 family compatibility.
Details:
use_v2_api: true): writes now use V2 API endpoint (/api/v2/write) by default, making the client compatible with InfluxDB Clustered and InfluxDB Cloud Serverless/Dedicated by default. This change align the behaviour of Rust client with others. Setuse_v2_api(false)to use the v3 endpoint.no_sync=truewithuse_v2_api=trueis now a config error —no_syncis a v3-only feature, caught at build time and at write execution time. Alignment, again.write_use_v2_api,write_accept_partial,write_no_synconClientConfigBuilderfor easier instantiation.Note to reviewers: v0.2.0 will be the first public relase (0.1.0 version was only published to crates.io just to set up infrastructure), so the changes are not really breaking.
Checklist