-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(write-api): accept 201 response to write #663
Conversation
InfluxDB v3 will soon return 201 or 204, in cases where InfluxDB v1 and v2 only return 204.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #663 +/- ##
=======================================
Coverage 90.43% 90.43%
=======================================
Files 40 40
Lines 3524 3524
=======================================
Hits 3187 3187
Misses 337 337 ☔ View full report in Codecov by Sentry. |
@@ -122,4 +122,4 @@ async def write(self, bucket: str, org: str = None, | |||
precision=write_precision, async_req=False, | |||
_return_http_data_only=False, | |||
content_type="text/plain; charset=utf-8") | |||
return response[1] == 204 | |||
return response[1] in (201, 204) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's worth doing the same thing as the Golang client and treating any 2xx as a success? Either is good though 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 2xx as a success indicator is a good approach. I've added this to our backlog, so we will improve both v2 and v3 clients to work this way - https://github.com/orgs/influxdata/projects/108/views/1?pane=issue&itemId=73988042
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR 👍
LGTM 🚀
@@ -122,4 +122,4 @@ async def write(self, bucket: str, org: str = None, | |||
precision=write_precision, async_req=False, | |||
_return_http_data_only=False, | |||
content_type="text/plain; charset=utf-8") | |||
return response[1] == 204 | |||
return response[1] in (201, 204) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 2xx as a success indicator is a good approach. I've added this to our backlog, so we will improve both v2 and v3 clients to work this way - https://github.com/orgs/influxdata/projects/108/views/1?pane=issue&itemId=73988042
@bednar I don't have permission to merge, so I'll leave it to you. Thanks for your attention! |
Helps internal issue https://github.com/influxdata/idpe/issues/18710
Proposed Changes
InfluxDB v3 Serverless will soon return 201 or 204, in cases where InfluxDB v1 and v2 only return 204. This change anticipates this API change. Public docs will also be updated.
InfluxDB v3 Dedicated and Clustered already have this behavior, and it is already documented.
Checklist
pytest tests
completes successfully