Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d158482
Add Cosmos hedging detection API to driver
Jul 27, 2026
a33d7df
Surface hedging through Cosmos observability handlers
Jul 27, 2026
f861e99
Fix hedge-race region attribution + observability consistency
NaluTripician Jul 27, 2026
a47bc86
Make hedge observability surfaces consistent for both-transient→failover
NaluTripician Jul 27, 2026
d9f1881
Fix broken links in hedging detection API spec
Jul 27, 2026
eb79114
Documentation cleanups from round-3 review
NaluTripician Jul 27, 2026
d9ab7b8
Align hedge_diagnostics() docstring with hedging_started()
NaluTripician Jul 27, 2026
df8b9df
Merge main; materialize hedge region history
Jul 28, 2026
b81bf39
Report hedge fan-out consistently across observability
Jul 28, 2026
87e305a
Fix broken intra-doc link in metrics handler
Jul 28, 2026
9bad803
Add fanouts and undercount to cosmos cspell dictionary
Jul 28, 2026
42e63bd
bound materialized hedge region histories
Jul 28, 2026
472f8f5
Merge remote-tracking branch 'upstream/main' into nalutripician-cauti…
Jul 28, 2026
0c83f91
Merge upstream/main into cosmos-hedge-obs
Jul 29, 2026
59b0fab
Merge upstream/main into cosmos-hedge-obs
Jul 31, 2026
10249e5
Preserve hedge-loser diagnostics and true dispatch order
Jul 31, 2026
2cb3a00
Merge upstream/main into cosmos-hedge-obs
Jul 31, 2026
04f4740
Stop using deprecated ExecutionContext::Retry in tests
Copilot Jul 31, 2026
8504652
fix(cosmos): define SDK-owned RequestedRegion types
Aug 4, 2026
8cd3811
Remove ExecutionContext::Retry and collapse RequestedRegionReason int…
Aug 4, 2026
98a6cde
Remove issue links from spec and CHANGELOG
Aug 4, 2026
5ab7a3d
Resolve PR #4871 merge conflicts
Aug 4, 2026
8ab150f
Resolve remaining PR #4871 merge conflicts
Aug 4, 2026
d9dfadc
Drop workflow-file deltas from merge
Aug 4, 2026
0c29475
Build hedged counter in Instruments::new
Aug 4, 2026
a2d4581
Use US spelling of finalization in region docs
Aug 4, 2026
120a9c0
Merge main into Cosmos hedging work
Aug 4, 2026
d1af5e3
Remove unrelated workflow changes
Aug 4, 2026
1d7ab14
Merge branch 'main' into cosmos-hedge-obs
analogrelay Aug 6, 2026
2b444e2
Merge branch 'main' into cosmos-hedge-obs
analogrelay Aug 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/cosmos/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"failback",
"failovers",
"fanout",
"fanouts",
"Fatalf",
"fieldless",
"FILETIME",
Expand Down Expand Up @@ -330,6 +331,7 @@
"uncollapsed",
"uncontended",
"undecoded",
"undercount",
"underspecified",
"undrained",
"unfaulted",
Expand Down
4 changes: 4 additions & 0 deletions sdk/cosmos/azure_data_cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@
- Added an SDK-generated `x-ms-client-id` header that remains stable for each `CosmosClient`. ([#4844](https://github.com/Azure/azure-sdk-for-rust/pull/4844))
- Added opt-in Cosmos binary JSON encoding for item operations (`create`/`read`/`replace`/`upsert`). Enable it via `CosmosClientBuilder::with_binary_encoding_options` (or the `AZURE_COSMOS_BINARY_ENCODING_ENABLED` environment-variable fallback). Off by default; when disabled, requests and responses are byte-for-byte unchanged. ([#4671](https://github.com/Azure/azure-sdk-for-rust/pull/4671))
- Added `FeedOptions::max_fan_out` (and `FeedOptions::with_max_fan_out`) to cap how many physical partitions a cross-partition query or change feed may fan out to. Applies to `ContainerClient::query_items` and `ContainerClient::query_change_feed`. The cap is enforced only at initial query setup; a partition that splits mid-execution and pushes the fan-out higher does not abort the operation. ([#4855](https://github.com/Azure/azure-sdk-for-rust/pull/4855))
- Surfaced the Hedging Detection API through `DiagnosticsContext`: `hedging_started()`, `requested_regions()`, `responded_regions()`, and the exact-count `total_requested_regions()` / `total_responded_regions()`, and re-exported the `RequestedRegion` / `RequestedRegionReason` types (mirroring the existing `DiagnosticsContext` re-export). ([#4410](https://github.com/Azure/azure-sdk-for-rust/issues/4410), [#4871](https://github.com/Azure/azure-sdk-for-rust/pull/4871))
- Added a pluggable client-side diagnostics emission layer — the `DiagnosticsHandler` trait and ordered `DiagnosticsHandlerChain` (registered via `CosmosClientBuilder::with_diagnostics_handler`) — invoked once per operation (singleton and paginated, on success and failure) with the completed `DiagnosticsContext` plus an SDK-supplied `CosmosOperationContext`; the empty default chain is a zero-overhead no-op. ([#4789](https://github.com/Azure/azure-sdk-for-rust/pull/4789))
- Added the `metrics`-gated `CosmosMetricsHandler` (with `MetricsOptions`), emitting the stable `db.client.operation.duration` histogram plus per-signal opt-in metrics (`with_request_charge_metric`, `with_returned_rows_metric`) and an opt-in extended attribute set (`with_extended_attributes`); a no-op when no meter provider is registered. ([#4789](https://github.com/Azure/azure-sdk-for-rust/pull/4789))
- Added `MetricsOptions::with_active_instance_metric`, an opt-in `azure.cosmosdb.client.active_instance.count` up-down counter reporting the number of live `CosmosClient` instances per account endpoint, keyed on `server.address` (plus `server.port` for a non-default port). ([#4874](https://github.com/Azure/azure-sdk-for-rust/pull/4874))
- Added `DiagnosticsHandler::on_client_created`, a defaulted hook that lets a handler observe client construction (`CosmosClientInfo`) and return a `ClientLifetimeToken` dropped with the client, for handlers that need to track client lifetime. ([#4874](https://github.com/Azure/azure-sdk-for-rust/pull/4874))
- Added composable tail-sampled emission handlers — a `TracingLogHandler` leaf that writes a compact `tracing` line and a `SamplingLogHandler` wrapper (holding an `Arc<dyn DiagnosticsHandler>`) that applies the sampling gate plus a shared per-window rate limit, defaulting to wrap a `TracingLogHandler` — and the `distributed_tracing`-gated `CosmosTracingHandler` (backdated span tree), also rate-limited so an error storm can't overwhelm exporters. All emit only for operations which fail or breach a configurable `DiagnosticsThresholds`, and stamp *why* they were sampled (a failure, or which threshold) on the emitted line and span. ([#4789](https://github.com/Azure/azure-sdk-for-rust/pull/4789))
- Surfaced hedging through the observability handlers, reusing the Hedging Detection API. When a cross-region hedge fans out, `CosmosTracingHandler` adds `azure.cosmosdb.operation.{hedging_started,hedge_region,hedge_terminal_state}` plus `requested_regions`/`responded_regions` (`string[]`, bounded by the driver's `max_request_diagnostics`, with a `*_total` companion attribute emitted only when a retry storm truncated the history) to the sampled operation span and tags the hedge-leg child span (`azure.cosmosdb.request.hedge`); `SamplingLogHandler` adds `hedging_started` / `hedge_region` / `hedge_terminal_state` fields to the sampled log line; and `CosmosMetricsHandler` gains an opt-in `azure.cosmosdb.client.operation.hedged` counter (`MetricsOptions::with_hedged_metric`) carrying the low-cardinality `hedge_terminal_state`, with the higher-cardinality `hedge_region` dimension added only under `with_extended_attributes`. All three surfaces decide fan-out from `hedging_started()`, so a hedge whose race ended both-transient and was then resolved by a failover attempt is still reported; the per-outcome `hedge_region` / `hedge_terminal_state` fields are omitted there (the counter's dimension carries the `unresolved` sentinel so its attribute schema stays uniform). ([#4410](https://github.com/Azure/azure-sdk-for-rust/issues/4410), [#4871](https://github.com/Azure/azure-sdk-for-rust/pull/4871))
Comment thread
NaluTripician marked this conversation as resolved.
Outdated
- Added the non-default `control_plane` feature that gates the control-plane APIs (database and container CRUD, and throughput/offer management). It is intentionally independent of `key_auth` so these APIs are not tied to key-based authentication. ([#4854](https://github.com/Azure/azure-sdk-for-rust/pull/4854))

### Breaking Changes
Comment thread
NaluTripician marked this conversation as resolved.

- Serialized `DiagnosticsContext` output (the diagnostics JSON surfaced to consumers, and the sampled diagnostics log line) now serializes driver-generated operation retries with `execution_context` = `"operation_retry"` instead of `"retry"`, following the driver's `ExecutionContext::Retry` → `OperationRetry` rename. This is additive to the enum (the deprecated `Retry` variant still serializes as `"retry"`), but the wire value emitted for operation retries changes; telemetry/log parsers that match the literal `"retry"` execution context must update. ([#4410](https://github.com/Azure/azure-sdk-for-rust/issues/4410), [#4871](https://github.com/Azure/azure-sdk-for-rust/pull/4871))
- Control-plane APIs are now gated behind the new `control_plane` feature, which is **not** enabled by default. Code using database or container management (`CosmosClient::create_database`/`query_databases`, `DatabaseClient::read`/`create_container`/`query_containers`/`delete`, `ContainerClient::replace`/`delete`), throughput management (`read_throughput`/`begin_replace_throughput`, `ThroughputPoller`), or the associated model and options types (`DatabaseProperties`, `ThroughputProperties`, and the container create/replace/delete/query, database, and throughput option types) must now enable the `control_plane` feature. Reading container properties via `ContainerClient::read()` — along with `ContainerProperties`, `IndexingPolicy`, `ResourceResponse`, and `ReadContainerOptions` — remains available without the feature, since it works with Entra ID authentication and mirrors the metadata read the SDK already performs internally. ([#4854](https://github.com/Azure/azure-sdk-for-rust/pull/4854))
- Fresh cross-partition queries and change feed reads now fail with a `BadRequest` error if they would fan out to more than 100 physical partitions. Raise `FeedOptions::max_fan_out` to run a broader operation. The limit is checked only at initial query setup — resuming from a continuation token is unaffected, and a partition split that raises the fan-out mid-execution does not abort the operation. ([#4855](https://github.com/Azure/azure-sdk-for-rust/pull/4855))

### Bugs Fixed

- The Cosmos tracing span's operation label now prefers the caller-facing `CosmosOperationContext` identity over the driver-recorded name, matching how the `db.operation.name` metric attribute is resolved. Previously an aggregate whose surfaced sub-operation differed from the caller's operation — such as a PATCH that fails during its internal read — could label the span `read_item` while the metric reported `patch_item`. Attempt spans now carry the operation that issued them, so a PATCH's attempts report `db.operation.name` of `patch_read_item` / `patch_replace_item` while its operation span and metric stay `patch_item`; attempts of every other operation continue to inherit the operation's own name. ([#4874](https://github.com/Azure/azure-sdk-for-rust/pull/4874))
- Fixed hedged operations under-reporting diagnostics for the leg that lost the race. Cancelling the loser previously discarded every attempt it had already completed, so a leg that received a `429` and was retrying when it lost contributed nothing to the surfaced `DiagnosticsContext` — omitting its region from `regions_contacted()`/`responded_regions()` and under-reporting `total_request_charge()` against RU the account was actually billed. Attempts observed by a cancelled leg are now retained. ([#4871](https://github.com/Azure/azure-sdk-for-rust/pull/4871))

### Other Changes

Expand Down
Loading
Loading