-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add client id to all request headers #42104
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
Conversation
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.
Pull Request Overview
This PR extends the inclusion of Client ID headers to all Cosmos DB requests, whereas previously it was only added to database account operations. The change ensures consistent client identification across all API calls.
- Adds
client_id=self.client_id
parameter to allbase.GetHeaders()
calls in both sync and async client connections - Adds comprehensive test coverage to verify Client ID is included in request headers
- Updates changelog to document this enhancement
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
_cosmos_client_connection_async.py |
Updates all async operation methods to include client_id parameter in headers |
_cosmos_client_connection.py |
Updates all sync operation methods to include client_id parameter in headers |
test_headers_async.py |
Adds async test to verify Client ID presence in request headers |
test_headers.py |
Adds sync test to verify Client ID presence in request headers |
CHANGELOG.md |
Documents the Client ID header enhancement |
Comments suppressed due to low confidence (2)
sdk/cosmos/azure-cosmos/tests/test_headers_async.py:227
- The test only verifies Client ID inclusion for read_item operations. Since the PR claims to add Client ID to 'all requests', consider testing other operation types (create, update, delete, query) to ensure comprehensive coverage.
await self.container.read_item(item="id-1", partition_key="pk-1")
sdk/cosmos/azure-cosmos/tests/test_headers.py:113
- The test only verifies Client ID inclusion for read_item operations. Since the PR claims to add Client ID to 'all requests', consider testing other operation types (create, update, delete, query) to ensure comprehensive coverage.
self.container.read_item(item="id-1", partition_key="pk-1")
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.
LGTM
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client_connection_async.py
Outdated
Show resolved
Hide resolved
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.
Annie had a good comment but won't block on it - LGTM
update client connection to not pass in client id and instead have it set to headers in base.getheaders
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.
LGTM
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.
LGTM, thanks
Description
Previously, Client ID was only included in the headers when doing database account operations. It will now be included in every request/response.