Skip to content
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

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

jacobmarble
Copy link
Member

@jacobmarble jacobmarble commented Aug 7, 2024

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

  • CHANGELOG.md updated
  • Rebased/mergeable
  • n/a A test has been added if appropriate
  • pytest tests completes successfully
  • Commit messages are conventional
  • n/a Sign CLA (if not already signed)
    • I'm an employee.

InfluxDB v3 will soon return 201 or 204, in cases where InfluxDB v1 and v2 only return 204.
@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.43%. Comparing base (653af46) to head (9b4cf12).
Report is 13 commits behind head on master.

❗ 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.
📢 Have feedback on the report? Share it here.

@jacobmarble jacobmarble requested a review from bednar August 7, 2024 19:54
@@ -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)

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 👍

Copy link
Contributor

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

Copy link
Contributor

@bednar bednar left a 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)
Copy link
Contributor

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

@jacobmarble
Copy link
Member Author

@bednar I don't have permission to merge, so I'll leave it to you. Thanks for your attention!

@bednar bednar merged commit 74a0fbf into influxdata:master Aug 9, 2024
20 checks passed
@bednar bednar added this to the 1.45.0 milestone Aug 9, 2024
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.

4 participants