console: [SAS-128] Add per-account/per-cluster cost breakdown to the billing page#37286
Draft
rjimeno-mz wants to merge 3 commits into
Draft
console: [SAS-128] Add per-account/per-cluster cost breakdown to the billing page#37286rjimeno-mz wants to merge 3 commits into
rjimeno-mz wants to merge 3 commits into
Conversation
Contributor
|
Reassigning to @leedqin |
…billing page
Add a "Spend by account & cluster" section to Usage → Overview, driven by
GET /api/costs/breakdown. A parent org sees itself plus each child account;
a child or standalone org sees a single account.
- Render each account as a collapsible group, reusing SpendBreakdown's
ResourceGroup / SafariSafeCollapse / caret disclosure pattern (shared
baseCellStyles and resourceTypePaddingLeft moved to constants.ts), with
indented cluster child rows.
- Region-qualify each cluster row ("aws/us-east-1 / quickstart.r1",
"aws/us-east-1 / Storage") to match the daily "Spend between …" table and
give storage rows a readable label instead of the raw environment id.
Consumes the new CostBreakdownCluster.region field from the backend
(cloud SAS-136).
- Tests cover parent / child / standalone rendering and the region-qualified
cluster and storage rows.
…table disclosure pattern
c9ca34f to
03947e4
Compare
def-
requested changes
Jun 30, 2026
| * surfaced as "Storage". | ||
| */ | ||
| function clusterLabel(cluster: CostBreakdownCluster): string { | ||
| return `${cluster.region} / ${cluster.cluster_grouping_key || "Storage"}`; |
Contributor
There was a problem hiding this comment.
This seems wrong. We should check price-storage and price-egress and separate them
Contributor
Author
|
I'm reverting this PR to draft while I implement some requested changes. |
Consume the new CostBreakdownCluster.category field: non-compute rows (empty cluster_grouping_key) now label from `category`, so storage and egress render as distinct "<region> / Storage" and "<region> / Egress" rows instead of both falling back to "Storage" (addresses def-'s review). Fall back to "Other" only when neither key nor category is set — e.g. a backend that predates the field. Splice the `category` field into the generated global-api types; add egress and "Other"-fallback test coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Phase 1 of Orb account-hierarchy support in the console (Linear: SAS-128). Today the billing page shows only an org-wide spend total. With sub-accounts, a parent org needs to see how spend breaks down across its own and its child accounts, per cluster — driven by the new
GET /api/costs/breakdownendpoint.Description
GET /api/costs/breakdown(newgetCostsBreakdownincloudGlobalApi.ts+useCostsBreakdowninqueries.ts). A parent org sees itself plus each child account; a child or standalone org sees a single account. This augments the existing daily chart andSpendBreakdownsparklines rather than replacing them — the hybrid two-call approach (/costs/dailyfor the chart,/costs/breakdownfor the new section). Legacy chart removal is tracked in SAS-138.SpendBreakdown'sResourceGroup/SafariSafeCollapse/ caret disclosure pattern; sharedbaseCellStylesandresourceTypePaddingLeftwere moved toconstants.tsso both tables share them (no duplication of the Safari subgrid workaround). Cluster rows are indented children.aws/us-east-1 / quickstart.r1,aws/us-east-1 / Storage— matching the daily "Spend between …" table and giving storage/egress rows a readable label instead of a raw environment id. This consumes the newCostBreakdownCluster.regionfield from cloud SAS-136.regionfield — are spliced into the committedglobal-apitypes rather than a fullyarn gen:apire-sync, because the console's committed spec has drifted from cloud (regions / self-managed-subscription). On a clean rebase once the cloud spec lands,yarn gen:apireproduces these.Verification
yarn test run src/platform/billing/UsagePage.test.tsx— covers parent / child / standalone rendering, the region-qualified cluster rows (aws/us-east-1 / quickstart.r1), and the storage row (aws/us-east-1 / Storage). Typecheck + lint clean.rjimeno.dev) wired to the cloud SAS-136 backend, logged in to a root/leaf Orb hierarchy (+mock-root@/+mock-leaf@). Confirmed parent + child account groups and region-qualified cluster/storage rows from live Orb data.Linear: SAS-128