Skip to content

feat(stats): Add a Seer usage tab to Stats & Usage - #131502

Merged
vaind merged 18 commits into
masterfrom
ivan/seer-cost-stats-tab
Nov 23, 2026
Merged

vaind merged 18 commits into
masterfrom
ivan/seer-cost-stats-tab

Conversation

@vaind

@vaind vaind commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Orgs on token-billed Seer can't see which Seer features use their credits. The Seer wallet only shows a balance.

This adds a Seer tab to Stats & Usage. It shows a stacked bar chart of the Seer credits used per interval and a table of totals for the selected date range. The chart groups the billed feature tags into Autofix and Agent, and puts unknown tags under Other so new billed features still show up. The interval follows the same rules as the Usage tab. The tab rounds credits to whole numbers, because one credit bills one cent and the endpoint returns them unrounded.

Rollout: merge only after https://github.com/getsentry/getsentry/pull/23373 is deployed. Until then the tab would fail to load for flagged orgs.

Refs CW-3105

Billing members of orgs on token-billed Seer can see what each Seer product costs: a stacked bar chart per interval and a table of totals for the selected date range. The page lives in gsApp because getsentry's LLM cost stats endpoint serves its data, so sentry gains a routes:stats hook for it.

Refs CW-3105
@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

CW-3105

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 17, 2026
@vaind
vaind marked this pull request as ready for review November 17, 2026 20:19
@vaind
vaind requested review from a team as code owners November 17, 2026 20:19
knip flags exports that nothing imports.
The tab is already titled Seer, so the product name needs no Seer prefix.

Refs CW-3105
The LLM cost stats endpoint now returns Seer credits instead of US dollars, the unit customers are billed in.
The endpoint is now LLM usage stats and returns Seer credits, so the view, its API URL and the names around them say usage.
@vaind vaind changed the title feat(stats): Add a Seer cost tab to Stats & Usage feat(stats): Add a Seer usage tab to Stats & Usage Nov 18, 2026
getsentry renamed llm-usage-stats/ to seer-usage-stats/, because it reports Seer credits.

Refs CW-3105
The axis labels round to whole credits, so fractional ticks showed repeated labels for small values.

Refs CW-3105
Charts color series by position, so a product changed color when an earlier product had no usage in the range. Each product now keeps its palette slot. Usage below half a credit shows as <1 instead of 0, and the UTC rule comes from the Usage tab's isDisplayUtc.

Refs CW-3105
@billyvg

billyvg commented Nov 19, 2026

Copy link
Copy Markdown
Member

Screenshots of the Seer tab, taken on a local getsentry devserver.

Posted by an AI agent (Claude Code) on behalf of Billy Vong.

Local stack

  • sentry: this PR's head merged with 1345c97b, the sentry commit getsentry#23373 pins. That commit includes feat(snuba): Add referrer for getsentry's Seer usage stats endpoint #131751's Snuba referrer.
  • getsentry: getsentry#23373's head, which includes getsentry#23434.
  • A local org on am3 Business with billing.platform.package.seer_credits.enabled on, provisioned onto the billing platform. token-billed-seer-enabled resolves through the real entitlement handler. Snuba holds 45 days of synthetic llm_proxy_cost_raw rows for the billed Autofix and Agent features.

14 days, hourly buckets

Seer tab with 14 days of hourly Seer credits

90 days, daily buckets. The total matches the seeded LLM cost at one credit per cent.

Seer tab with 90 days of daily Seer credits

A date range with no usage

Seer tab showing no credits used in the date range

A member without billing access opening /stats/seer/. The Seer tab is hidden, and the page doesn't request the usage endpoint.

Seer tab URL opened by a member without billing access

An org without token-billed-seer-enabled that opens /stats/seer/ lands on /stats/ and sees no Seer tab.

The other Stats & Usage tabs don't need billing access, so the Seer tab now shows to every member of a token-billed Seer org.

Refs CW-3105
vaind and others added 2 commits November 20, 2026 07:08
…ost-stats-tab

# Conflicts:
#	static/app/router/routes.tsx
#	static/app/views/organizationStats/header.tsx
vaind and others added 2 commits November 20, 2026 07:17
The pre-commit autofix expanded them, and the format hook rejects that. The content matches master.
vaind added a commit that referenced this pull request Nov 20, 2026
On every frontend pull request, the `pre-commit lint` workflow runs
`pnpm run lint:suppressions --prune` and the bot commits the result as
"apply pre-commit fixes". Since #131758 set oxfmt's `objectWrap` to
`collapse`, that commit expands every `{"count": N}` in the three
`oxlint-suppressions.json` files onto three lines, with identical JSON
content. The next run's `format` hook collapses them again and fails,
and restoring the files only triggers the bot again (seen on #131502).

The prune serialized budgets with `JSON.stringify(_, null, 2)`. We now
pipe each written asset through the oxfmt CLI with `--stdin-filepath`,
so it picks up the same `.oxfmtrc.json` and ignore patterns as the
`format` hook. Pruning master now leaves the files byte-identical.
Excluding the files from oxfmt would also stop the loop, but the next
prune would re-expand them and they would become the only unformatted
JSON in the repo.

Budget comparisons and the temporary root asset still use the plain
`JSON.stringify` output, because only committed files need the hook's
format.
…ost-stats-tab

# Conflicts:
#	static/app/oxlint-suppressions.json
@vaind
vaind merged commit 3aa149b into master Nov 23, 2026
80 checks passed
@vaind
vaind deleted the ivan/seer-cost-stats-tab branch November 23, 2026 12:04

This branch was successfully deployed

1 active deployment
Preview — 87b9302e Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants