Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
+ Coverage 75.17% 75.96% +0.79%
==========================================
Files 35 35
Lines 2417 2559 +142
==========================================
+ Hits 1817 1944 +127
- Misses 600 615 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds client-side support for InfluxDB v3 partial writes by introducing a structured InfluxDBPartialWriteError (with per-line error details) and updates write routing/options to default to the v3 /api/v3/write_lp endpoint while allowing an opt-in v2 compatibility route (/api/v2/write).
Changes:
- Add
InfluxDBPartialWriteError/InfluxDBPartialWriteLineErrorand parse v3 partial-write error payloads into structured line-level failures. - Default write routing to
/api/v3/write_lp, addaccept_partial(defaultTrue) anduse_v2_api(defaultFalse) write options with env/kwarg support. - Update unit/integration tests and README to cover the new defaults and new error/option behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_write_local_server.py | Updates expected endpoints/query params for v3 defaults; adds coverage for accept_partial and use_v2_api routing/validation. |
| tests/test_polars.py | Adjusts mocked write call expectations to include new write kwargs. |
| tests/test_influxdb_client_3.py | Verifies new default write options and env parsing for accept_partial/use_v2_api. |
| tests/test_influxdb_client_3_integration.py | Updates integration test to expect InfluxDBPartialWriteError for invalid LP scenarios. |
| tests/test_api_client.py | Expands API error parsing tests to validate partial-write parsing and typed/raw fallback behavior. |
| README.md | Documents partial-write handling and v2 compatibility mode configuration. |
| influxdb_client_3/write_client/service/write_service.py | Routes writes to v3 by default, adds v2 compatibility routing and partial-write error translation. |
| influxdb_client_3/write_client/client/write_api.py | Adds new defaults/options, validates invalid combinations, and threads new params through write dispatch. |
| influxdb_client_3/exceptions/exceptions.py | Implements partial-write detection/parsing, structured error classes, and improved message formatting. |
| influxdb_client_3/exceptions/init.py | Re-exports the new partial-write exception types. |
| influxdb_client_3/init.py | Adds env/kwarg configuration keys for new write options and updates error imports/handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a286bfa to
b514d94
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| use_v2_api = 'use_v2_api' in local_var_params and local_var_params['use_v2_api'] | ||
| if not use_v2_api and e.status == HTTPStatus.METHOD_NOT_ALLOWED: | ||
| message = "Server doesn't support v3 write API. Set use_v2_api=True for v2 compatibility endpoint." | ||
| raise ApiException(status=0, reason=message) |
| """Structured partial-write error with per-line failures.""" | ||
|
|
||
| def __init__(self, response: HTTPResponse, message: str, line_errors: List[InfluxDBPartialWriteLineError]): | ||
| super().__init__(response=response) |
Proposed Changes
Adds partial-write support with structured error details in
InfluxDBPartialWriteError, including per-lineline_number,error_message, andoriginal_lineso callers can decide whether to drop/retry/fix specific lines in a batch.This also aligns write routing with the rollout contract:
/api/v3/write_lpaccept_partialdefaults toTrue(server default behavior)accept_partial=falseis sent only when partial writes are explicitly disableduse_v2_apiroutes writes to/api/v2/writefor Clustered/v2-compatible backendsConfiguration surfaces now include:
accept_partial,use_v2_apiwrite_accept_partial,write_use_v2_apiINFLUX_WRITE_ACCEPT_PARTIAL,INFLUX_WRITE_USE_V2_APIValidation:
use_v2_api=Truewithno_sync=Trueis rejected before request dispatch.See Partial writes in InfluxDB documentation.
Example:
Optional v2 compatibility mode:
Checklist