Skip to content

Fix partitionLevelCircuitBreakerCfg missing from CosmosDiagnostics clientCfgs#49734

Merged
jeet1995 merged 9 commits into
Azure:mainfrom
jeet1995:jeet1995/fix-ppcb-diagnostics-clientcfg
Jul 7, 2026
Merged

Fix partitionLevelCircuitBreakerCfg missing from CosmosDiagnostics clientCfgs#49734
jeet1995 merged 9 commits into
Azure:mainfrom
jeet1995:jeet1995/fix-ppcb-diagnostics-clientcfg

Conversation

@jeet1995

@jeet1995 jeet1995 commented Jul 6, 2026

Copy link
Copy Markdown
Member

Problem

The partitionLevelCircuitBreakerCfg field disappeared from the clientCfgs section of CosmosDiagnostics when a customer explicitly enabled Per-Partition Circuit Breaker (PPCB) client-side. Customers who previously relied on seeing this diagnostic entry (e.g. "partitionLevelCircuitBreakerCfg": "(cb: true, type: CONSECUTIVE_EXCEPTION_COUNT_BASED, rexcntt: 10, wexcntt: 5)") no longer saw it.

Root cause

The diagnostics write for the circuit breaker config was coupled to the Per-Partition Automatic Failover (PPAF) initialization path (initializePerPartitionFailover). As a result, the field was only populated when the service mandated PPAF — not when PPCB was configured client-side.

Fix

Move the diagnostics write into initializePerPartitionCircuitBreaker(), which is invoked unconditionally at client init. This ensures the partitionLevelCircuitBreakerCfg field appears in CosmosDiagnostics for every client build, independent of the PPAF path.

Tests

Both tests assert that all expected clientCfgs keys are present (including partitionLevelCircuitBreakerCfg) without setting any PPCB configuration, since the field must now be emitted for every client regardless of PPCB config. They fail without the fix and pass with it.

  • Unit test (unit group): RxDocumentClientImplTest#diagnosticsClientConfigContainsAllClientCfgKeysIncludingPartitionLevelCircuitBreaker builds a client, serializes the diagnostics client config, and asserts every clientCfgs key is present.
  • E2E test: PerPartitionCircuitBreakerE2ETests#partitionLevelCircuitBreakerConfigIsPresentInClientCfgsDiagnostics issues an operation, extracts clientCfgs from the resulting CosmosDiagnostics, and asserts every expected key is present against a live-style client.

Verification

  • azure-cosmos rebuilt successfully.
  • Unit regression test passes: Tests run: 1, Failures: 0, Errors: 0.
  • E2E test passes across all TestNG groups.

…ientCfgs

The partitionLevelCircuitBreakerCfg field disappeared from the clientCfgs
section of CosmosDiagnostics when a customer explicitly enabled Per-Partition
Circuit Breaker (PPCB) client-side.

Root cause: the diagnostics write was coupled to the Per-Partition Automatic
Failover (PPAF) initialization path, so the field was only populated when the
service mandated PPAF, not when PPCB was configured client-side.

Fix: move the diagnostics write into initializePerPartitionCircuitBreaker(),
which is invoked unconditionally at client init, so the field appears whenever
the circuit breaker is configured client-side.

Adds a CI-runnable regression test asserting all clientCfgs keys are present,
including partitionLevelCircuitBreakerCfg.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 restores partitionLevelCircuitBreakerCfg in CosmosDiagnostics client configuration output when Per-Partition Circuit Breaker (PPCB) is enabled client-side, by decoupling the diagnostics write from the Per-Partition Automatic Failover (PPAF) initialization path.

Changes:

  • Move partitionLevelCircuitBreakerCfg population into initializePerPartitionCircuitBreaker() so it is set during normal client initialization.
  • Add a unit regression test that enables PPCB via system property, serializes the diagnostics client config, and asserts expected clientCfgs keys (including partitionLevelCircuitBreakerCfg) and value.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java Relocates diagnostics population for PPCB config into the circuit breaker init path.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RxDocumentClientImplTest.java Adds a unit regression test validating diagnostics serialization includes partitionLevelCircuitBreakerCfg when PPCB is enabled.

jeet1995 and others added 8 commits July 6, 2026 15:28
…iagnostics-clientcfg

# Conflicts:
#	sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RxDocumentClientImplTest.java
…roperty

Remove trailing comma before closing brace in the COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG
JSON so the value is strictly valid and clearer as a customer reference.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…kerE2ETests

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… keys

The partitionLevelCircuitBreakerCfg field now appears in clientCfgs for every
client regardless of PPCB configuration, so the E2E test no longer sets the
COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG system property. It just builds a
plain client and asserts all expected clientCfgs keys (including
partitionLevelCircuitBreakerCfg) are present in CosmosDiagnostics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove PPCB System.setProperty/clearProperty and the value-specific
assertion; assert only that all clientCfgs keys are present, matching
the E2E test simplification.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…iagnostics-clientcfg

# Conflicts:
#	sdk/cosmos/azure-cosmos/CHANGELOG.md
@jeet1995

jeet1995 commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@jeet1995

jeet1995 commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - spark

@jeet1995

jeet1995 commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - kafka

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel FabianMeiswinkel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - Thanks

@jeet1995 jeet1995 merged commit deaeb6b into Azure:main Jul 7, 2026
135 checks passed
jeet1995 added a commit to jeet1995/azure-sdk-for-java that referenced this pull request Jul 9, 2026
Catches PR Azure#49725 up with PR Azure#49437. Resolved duplicate PPCB diagnostics
fix (both branches added it independently; kept probe-flow/Azure#49734 canonical
form for the comment and the regression test). Preserved kusto-sink's unique
eager HTTP/2 pre-warm and Kusto/ADX benchmark sink work.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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