feat: improve Cosmos DB RU and operation diagnostics (ARO-29599) #6929
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6929"
general
weight: 0.35
stevekuznetsov
Jira: https://redhat.atlassian.net/browse/ARO-29599
Why
CI Cosmos platform metrics show throughput pressure, but not which controllers, informers, or calling services are responsible. Once an ephemeral test environment is gone, that missing attribution makes expensive reconciliation, relists, polling, and charged errors difficult to diagnose.
This adds client-side RU attribution and adds three targeted cost/throttling views to the existing gather-observability artifacts, on top of the three pre-existing Azure platform views (left untouched). It does not change controller reconciliation behavior or attempt to optimize the expensive controllers the charts reveal.
What
x-ms-request-chargeonce per HTTP attempt through a shared Azure SDK per-retry policy, including retries, charged failures, query pages, and changefeed responses, incosmos_request_units_total.cosmos_requests_total. A429is typically rejected before Cosmos DB does any work and usually reports a zero or absent charge, so RU cost alone cannot answer "how often was this source throttled"; the count counter can.unattributed. Preserve list/watch cancellation and deadlines and distinguish ActiveOperations from AllOperations.429-count drivers per container. Ranking spans controller/informer/unattributed together in one chart rather than splitting per kind, so the actual top contributor is visible without already knowing which kind dominates.topkwhose lookback is resolved (inpromql.go, via a__REPORT_RANGE__placeholder) to the report's exact[start,end]duration in milliseconds, not a hardcoded window — so a spike anywhere in the report surfaces its source, without ever looking further back than the report's own start.manifests-mc-*containers; give each container group its own chart and legend; always retain explicitcalling_servicelabels, distinct from the actual Cosmoscosmosdb_containermetric label.Testing
Passed locally:
cosmos_requests_totalcounts each throttled retry once even whencosmos_request_units_totalreports ~0 for it), concurrent attribution, malformed/missing charges, response/error preservation, request classification, real informer pagination/relist/changefeed contexts, and the__REPORT_RANGE__placeholder resolving to an exact millisecond-precision duration (not rounded up past the report's start).TestLoadQueriesConfigEmbeddedparses the real embeddedqueries.yamland asserts structural invariants (unique/non-empty panel titles, non-empty query lists, no CosmosDB panel split) rather than pinning specific chart titles, so it doesn't need updating on every legitimate chart edit.Visual evidence
Outstanding. The dashboard design changed substantially after the initial review pass (consolidated from eight per-source-kind views down to three unified ones; added the count counter and its throttling view; fixed the ranking window), and the Chromium/PNG capture done for the earlier eight-view design no longer reflects what's in this PR. Fresh screenshots of the current three views, plus the untouched three platform views, are needed before merge per the repo's screenshot requirement for dashboard/metrics changes.
The PR is currently ready, not draft.
Special notes for your reviewer
calling_servicenaming are query/presentation behavior only.cosmos_request_units_totalis charged cost, not request count, error rate, or provisioned throughput;cosmos_requests_totalis a plain per-attempt count for when cost isn't the right lens (e.g. throttling). SDK background partition-range refreshes remain explicitly unattributed on both.PR Checklist