Skip to content

chore(benchmark): wire excludedRegionsList into Cosmos*RequestOptions#49313

Merged
jeet1995 merged 2 commits into
Azure:mainfrom
jeet1995:jeet1995/benchmark-exclude-regions-wiring
May 29, 2026
Merged

chore(benchmark): wire excludedRegionsList into Cosmos*RequestOptions#49313
jeet1995 merged 2 commits into
Azure:mainfrom
jeet1995:jeet1995/benchmark-exclude-regions-wiring

Conversation

@jeet1995
Copy link
Copy Markdown
Member

@jeet1995 jeet1995 commented May 29, 2026

Summary

Plumbs the existing excludedRegionsList benchmark config field through every per-request Cosmos*RequestOptions construction site in the vanilla async/sync workloads of azure-cosmos-benchmark. Without this, configuring excludedRegionsList had no effect on the actual request paths.

Note: CosmosClientBuilder also exposes excludedRegionsSupplier(Supplier<CosmosExcludedRegions>) for client-wide configuration. This PR takes the per-request approach to keep the change localized to the request-options layer; a follow-up can switch to the client-level supplier if preferred.

Changes

TenantDefaultConfig.java — mirrors preferredRegionsList:

  • New excludedRegionsList field with @JsonProperty
  • New getExcludedRegionsList() that splits the comma-separated value (returns null when empty)
  • Inheritance line in applyTo(TenantWorkloadConfig)

Wired setExcludedRegions(workloadConfig.getExcludedRegionsList()) into:

  • AsyncBenchmarkCosmosBulkExecutionOptions (pre-population bulk path)
  • AsyncQueryBenchmarkCosmosQueryRequestOptions
  • AsyncQuerySinglePartitionMultipleCosmosQueryRequestOptions in constructor
  • AsyncReadBenchmark — switched to the readItem overload accepting CosmosItemRequestOptions
  • AsyncReadManyBenchmark — switched to the readMany overload accepting CosmosReadManyRequestOptions
  • AsyncWriteBenchmarkCosmosItemRequestOptions on both createItem branches
  • SyncBenchmarkCosmosBulkExecutionOptions (pre-population bulk path)
  • SyncReadBenchmark — hoisted inline CosmosItemRequestOptions to a local
  • SyncWriteBenchmarkCosmosItemRequestOptions on both createItem branches

Out of scope (intentionally not modified)

  • AsyncMixedBenchmark, ctl/AsyncCtlWorkload, ReadMyWriteWorkflow, all encryption/* workloads — deferred.
  • DocDBUtils, BenchmarkHelper retry path, CosmosMetricsReporter — not workload paths (management metadata, retry helper, reporter infra).

Verification

  • mvn -f sdk/cosmos/azure-cosmos-benchmark/pom.xml -DskipTests -am compile — passes
  • mvn -f sdk/cosmos/azure-cosmos-benchmark/pom.xml checkstyle:check spotbugs:check — passes
  • Grep audit of new Cosmos*RequestOptions / new CosmosBulkExecutionOptions in src/main confirms every remaining occurrence is either followed by setExcludedRegions(...) or is in the intentionally-skipped list above.

10 files changed, +38/-8.

Adds an excludedRegionsList field on TenantDefaultConfig (mirroring preferredRegionsList) and threads getExcludedRegionsList() into every Cosmos*RequestOptions constructed by the vanilla async/sync benchmark workloads (read, write, query, readMany, bulk).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jeet1995 jeet1995 marked this pull request as ready for review May 29, 2026 15:23
Copilot AI review requested due to automatic review settings May 29, 2026 15:23
@jeet1995 jeet1995 requested review from a team and kirankumarkolli as code owners May 29, 2026 15:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Wires the existing excludedRegionsList benchmark config field into per-request Cosmos*RequestOptions across vanilla async/sync workloads in azure-cosmos-benchmark. Excluded regions are a per-request SDK feature, so configuring this field previously had no effect.

Changes:

  • Add excludedRegionsList field, getter, and applyTo(...) inheritance in TenantDefaultConfig (mirroring preferredRegionsList).
  • Call setExcludedRegions(...) on CosmosItemRequestOptions, CosmosQueryRequestOptions, CosmosReadManyRequestOptions, and CosmosBulkExecutionOptions across the vanilla async/sync workloads.
  • Switch AsyncReadBenchmark and AsyncReadManyBenchmark to overloads that accept request options.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TenantDefaultConfig.java Adds excludedRegionsList field, comma-split getter, and inheritance in applyTo.
AsyncBenchmark.java Sets excluded regions on bulk pre-population options.
AsyncQueryBenchmark.java Sets excluded regions on per-call query options.
AsyncQuerySinglePartitionMultiple.java Sets excluded regions on constructor-level query options.
AsyncReadBenchmark.java Switches to readItem options overload and sets excluded regions.
AsyncReadManyBenchmark.java Switches to readMany options overload and sets excluded regions.
AsyncWriteBenchmark.java Sets excluded regions on item options for both create branches.
SyncBenchmark.java Sets excluded regions on bulk pre-population options.
SyncReadBenchmark.java Hoists item options to local and sets excluded regions.
SyncWriteBenchmark.java Sets excluded regions on item options for both create branches.

Copy link
Copy Markdown
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeet1995 jeet1995 enabled auto-merge (squash) May 29, 2026 15:56
@jeet1995 jeet1995 merged commit eb81eb2 into Azure:main May 29, 2026
19 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants