[Internal] Thin Client Integration: Adds Thin Client Enablement Through Account Config and Reduce Request Headers for Proxy#5303
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements thin client integration by adding proper header management for proxy requests and updating the enablement criteria. The changes ensure that only specific headers (user-agent and activity-id) are passed to proxy requests, while also updating the thin client enablement logic to require environment variable, gateway mode selection, and gateway account level response.
Key changes include:
- Modified proxy request header handling to only include user-agent and activity-id headers
- Updated thin client enablement criteria to check environment variable, gateway mode, and account-level response
- Added UserAgentContainer parameter throughout the thin client components
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ThinClientStoreClient.cs | Updated proxy request preparation to clear headers and only add user-agent and activity-id |
| ThinClientStoreModel.cs | Added UserAgentContainer parameter to constructor |
| DocumentClient.cs | Updated thin client enablement logic and moved initialization timing |
| RetryPolicy.cs | Added isThinClientEnabled parameter and threading |
| ClientRetryPolicy.cs | Added thin client enabled flag and updated endpoint resolution logic |
| ThinClientConstants.cs | Added UserAgent constant definition |
| Test files | Updated test constructors to include UserAgentContainer parameter |
Comments suppressed due to low confidence (2)
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemThinClientTests.cs:26
- The type name 'MultiRegionSetupHelpers.CosmosSystemTextJsonSerializer' appears to be inconsistent with the previous type 'CosmosSystemTextJsonSerializer'. This change suggests a namespace or type refactoring that should be verified for correctness.
private MultiRegionSetupHelpers.CosmosSystemTextJsonSerializer cosmosSystemTextJsonSerializer;
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemThinClientTests.cs:27
- The ItemCount has been reduced from 1000 to 100. This reduction in test coverage may not adequately test performance and scalability scenarios that the original higher count was designed to verify.
private const int ItemCount = 100;
kundadebdatta
left a comment
There was a problem hiding this comment.
As discussed - please pass the isThinClientEnabled flag to GlobalPartitionEndpointManagerCore ctor, so that we don't make unnecessary I/O calls (i.e.: ConfigurationManager.IsThinClientEnabled()) to determine thin client is enabled.
Pull Request Template
Description
This PR addresses the following:
While creating the proxy request, the SDK will now pass the below headers only:
x-ms-user-Agent: Used to identify the SDK user agent.x-ms-activity-id: Activity ID to track requests in the proxy layer.Update thin client enablement criteria:
Currently the TC enablement is the combination of the below two operations:
Enable TC =
Set Environment Variable+Select Gateway ModeIf either of the above condition is not meeting, default is Gateway mode. This PR is changing the enablement with the combination of
3criteria. The flow will look like the below:First Phase Rollout:
Enable TC=Set Environment Variable+Select Gateway Mode+GW Account Level Response indicating TC is enabled(containing TC endpoints)If either of the above condition is not meeting, default is Gateway mode.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #5285
To automatically close an issue: closes #5282