Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions sdk/cosmos/azure_data_cosmos_driver/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Added a `.NET CosmosDiagnostics`-style top-level **`summary`** block to `DiagnosticsContext` (`DiagnosticsSummary`, reachable via `DiagnosticsContext::summary()`). It aggregates over the collected requests — `(status, sub-status)` histogram, total request charge, request/retry/throttle counts, regions contacted, final status, top error, total elapsed, and the client **`user_agent`** (SDK + runtime identity, via `DiagnosticsSummary::user_agent()`) — and is **computed lazily on first access** (never on the hot path) and cached via `OnceLock`, so a context whose diagnostics are never inspected pays nothing for it. Serialized as the first section of the diagnostics output; the `user_agent` is omitted when the driver did not supply one, so existing output is unchanged.
- Added a **`DiagnosticsEncoding`** client option on `DriverOptions` (`DriverOptionsBuilder::with_diagnostics_encoding` / `DriverOptions::diagnostics_encoding`) controlling how diagnostics render to a string via the new `DiagnosticsContext::encode(encoding)` and `CosmosResponse::diagnostics_string(encoding)`: `Json` (pretty, **default** — output unchanged), `Compact` (minified JSON), and `Encoded` (base64 of the compact JSON, decodable, for size-sensitive logging). Additive and non-breaking.
- Added serializable **wall-clock timestamps** (RFC 3339 / ISO 8601) to the diagnostics output. `DiagnosticsContext` (and its `summary`) now carry an operation `start_time`/`end_time`, and each `RequestDiagnostics` attempt carries a `start_time` plus an optional `end_time`, captured with `azure_core::time::OffsetDateTime` alongside the existing `Instant`-based durations. These absolute timestamps let diagnostics be correlated against server-side and external logs. Additive and non-breaking: the fields exist only when a context is built, durations are unchanged, and an in-flight attempt's `end_time` is omitted (`skip_serializing_if`).
- Added **retry-storm compaction** to the always-on `DiagnosticsContext`, giving a bounded-size guarantee under 4xx/5xx retry storms. When an operation accumulates more per-attempt records than the new configurable `DiagnosticsOptions::max_request_diagnostics` cap (`DiagnosticsOptionsBuilder::with_max_request_diagnostics`, env `AZURE_COSMOS_DIAGNOSTICS_MAX_REQUESTS`, default `512`, min `16`), runs of near-identical consecutive retries (same region / endpoint / status / sub-status / execution-context) are collapsed at operation finalization into first + last + a count, with an order-robust global key-bucket fallback that keeps the retained count within the cap even under a region ping-pong. The aggregate `summary` is computed from the full attempt list *before* compaction, so the `(status, sub-status)` histogram, retry/throttle counts, total RU and regions stay exact; `DiagnosticsContext::request_count()` still reports the true total, and new accessors `DiagnosticsContext::retained_request_count()` and `DiagnosticsContext::compaction()` (returning the new `CompactionInfo` / `CompactedRun`) expose the bounded retained count and a per-run rollup. Detailed JSON gains a top-level `compaction` object only when compaction fires (`skip_serializing_if`), so output stays byte-identical for normal operations. Additive and non-breaking.
- Restructured the client / runtime options layering on the driver. Two new nested option groups, a per-client overrides surface on `DriverOptionsBuilder`, and a single canonical `AZURE_COSMOS_PPCB_*` namespace for partition-failover environment variables. The driver now consumes partition-failover configuration once at construction (`CosmosDriver::new` no longer fabricates an `OperationOptionsView` outside any operation context) ([#4588](https://github.com/Azure/azure-sdk-for-rust/pull/4588)):
- Added new nested `OperationOptions::throughput_control` group (`ThroughputControlOptions` / `…Builder` / `…View`, mirroring the `ThrottlingRetryOptions` pattern). Exposes three layered fields ([#4588](https://github.com/Azure/azure-sdk-for-rust/pull/4588)):
- `group_name: Option<ThroughputControlGroupName>` — replaces the old top-level `OperationOptions::throughput_control_group`.
Expand Down
5 changes: 5 additions & 0 deletions sdk/cosmos/azure_data_cosmos_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ name = "multi_region_failover"
path = "tests/multi_region_failover.rs"
required-features = ["fault_injection"]

[[test]]
name = "live_storm_diagnostics"
path = "tests/live_storm_diagnostics.rs"
required-features = ["fault_injection"]

[[test]]
name = "gateway_query_plan_comparison"
path = "tests/gateway_query_plan_comparison.rs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pub use recorder::{AttemptRecord, DiagnosticsRecorder, HedgeOutcome};
// `crate::diagnostics` so the public boundary (`diagnostics::DiagnosticsContext`, consumed by the
// `azure_data_cosmos` SDK) is unchanged.
pub(crate) use model::DiagnosticsContextBuilder;
pub use model::{CompactedRun, CompactionInfo};
pub use model::{
DiagnosticsContext, DiagnosticsSummary, ExecutionContext, FailedTransportShardDiagnostics,
PipelineType, RequestDiagnostics, RequestEvent, RequestEventType, RequestHandle,
Expand Down
Loading