Moves Batch/Bulk to proxy endpoint when GW2.0 is enabled#45945
Moves Batch/Bulk to proxy endpoint when GW2.0 is enabled#45945nehrao1 merged 6 commits intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables Batch and Bulk operations to route through the new GW2.0 proxy endpoint by propagating the target endpoint through the HTTP transport serializers, store responses, and diagnostics.
- Added an
endpointfield toStoreResponseand related classes to track the target URI. - Updated transport serializers (
HttpTransportSerializer,ResponseUtils,HttpClientUtils) and request managers (RntbdRequestManager,GatewayAddressCache, etc.) to pass the endpoint intoStoreResponse. - Enhanced diagnostics and tests to assert that Batch/Bulk requests use the thin-client proxy endpoint.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cosmos/.../HttpTransportSerializer.java | Added endpoint parameter to unwrapToStoreResponse. |
| sdk/cosmos/.../RntbdResponse.java | Extended toStoreResponse to accept an endpoint argument. |
| sdk/cosmos/.../RntbdRequestManager.java | Propagate requestUriAsString into StoreResponse and exceptions. |
| sdk/cosmos/.../ResponseUtils.java | Updated toStoreResponse to include endpoint. |
| sdk/cosmos/.../HttpTransportClient.java | Call ResponseUtils.toStoreResponse(response, resourceAddress). |
| sdk/cosmos/.../HttpClientUtils.java | Added endpoint to parseResponseAsync and its callers. |
| sdk/cosmos/.../GatewayAddressCache.java | Pass targetEndpoint.toString() into parseResponseAsync. |
| sdk/cosmos/.../ThinClientStoreModel.java | Updated unwrapToStoreResponse signature to include endpoint. |
| sdk/cosmos/.../RxGatewayStoreModel.java | Updated unwrapToStoreResponse and invocation sites. |
| sdk/cosmos/.../RxDocumentClientImpl.java | Simplified useThinClientStoreModel logic; enhanced logging. |
| sdk/cosmos/.../StoreResponse.java | Introduced endpoint field and accessors. |
| sdk/cosmos/.../StoreResponseDiagnostics.java | Captured endpoint in diagnostics; introduced accessor. |
| sdk/cosmos/.../ClientSideRequestStatistics.java | Stored endpoint in gateway statistics and serializer. |
| sdk/cosmos/.../CosmosDiagnosticsRequestInfo.java | Added endpoint to diagnostics request info. |
| sdk/cosmos/.../CosmosDiagnosticsContext.java | Populated endpoint when building diagnostics context. |
| sdk/cosmos-tests/.../StoreResultDiagnosticsSerializerTests.java | Updated constructor invocation for new StoreResponse signature. |
| sdk/cosmos-tests/.../StoreResponseTest.java | Adjusted test setup to pass null endpoint. |
| sdk/cosmos-tests/.../TransactionalBatchResponseTests.java | Updated StoreResponse instantiation. |
| sdk/cosmos-tests/.../CosmosBulkItemResponseTest.java | Updated StoreResponse instantiation. |
| sdk/cosmos-tests/.../ThinClientE2ETest.java | Added tests and assertions for Batch/Bulk endpoints. |
| sdk/cosmos-tests/.../ConsistencyWriterTest.java | Adjusted StoreResponse constructor calls. |
| sdk/cosmos-tests/.../StoreResponseBuilder.java | Updated builder to new constructor signature. |
| sdk/cosmos-tests/.../RxDocumentClientImplTest.java | Updated mock StoreResponse instantiation. |
| sdk/cosmos-tests/.../RetryContextOnDiagnosticTest.java | Updated mock StoreResponse instantiation. |
Comments suppressed due to low confidence (3)
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreResponse.java:297
- Public API method getEndpoint() in StoreResponse is missing JavaDoc; please add a JavaDoc comment explaining what the endpoint represents.
public String getEndpoint() {
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreResponseDiagnostics.java:205
- Public API method getEndpoint() in StoreResponseDiagnostics is missing JavaDoc; please document its purpose and return value.
public String getEndpoint() {
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ThinClientE2ETest.java:46
- [nitpick] Constant thinClientEndpointIndicator should follow static constant naming conventions (UPPER_SNAKE_CASE); consider renaming to THIN_CLIENT_ENDPOINT_INDICATOR.
private static final String thinClientEndpointIndicator = ":10250/";
…mplementation/ThinClientE2ETest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…Meiswinkel/azure-sdk-for-java into users/fabianm/TCBatchBulk
|
Should we separate the diagnostics changes out? Iirc we were going to update contacted endpoint to reflect thin client endpoint instead of gateway - but looks like the changes here introduce a new endpoint to the diagnostics altogether EDIT: Discussed offline, LGTM |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - spark |
|
Azure Pipelines successfully started running 1 pipeline(s). |
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
Description
Enables Batch and bulk for GW2.0
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines