Summary
The ClickHouse revenue column is stored in minor units (cents), and most of the dashboard divides by 100 before display. Three render sites do not, so they show revenue 100x too high.
Observed on main at f72310c, and reproduced on the self-hosted :2 images.
Reproduction
- Enable
allowUnsafeRevenueTracking on a project.
- Send a revenue event of $2.00:
op.track('revenue', { __revenue: 200 }).
- Open the sessions list for that project.
Expected: $2.00
Actual: $200.00
The overview widgets, for the very same event, correctly show $2.00.
Affected sites
| File |
Renders |
apps/start/src/components/sessions/table/columns.tsx:261 |
${session.revenue.toFixed(2)} |
apps/start/src/routes/_app.$organizationId.$projectId.sessions_.$sessionId.tsx:282 |
`$${session.revenue}` |
apps/start/src/components/chat/tool-results/chat-profile-result.tsx:99 |
${metrics.revenue.toFixed(2)} |
Sites that handle it correctly
These all use number.currency(revenue / 100):
apps/start/src/components/overview/overview-widget-table.tsx (352, 487, 647)
apps/start/src/components/overview/overview-list-modal.tsx:228
apps/start/src/components/overview/overview-metric-card.tsx:194
apps/start/src/components/projects/project-card.tsx:144
apps/start/src/components/projects/project-chart.tsx:79
apps/start/src/components/events/table/columns.tsx (35, 53)
Why this is unambiguous
It is the same value from the same column in both cases. session-buffer.ts:257 accumulates the event's revenue into the session, and session.service.ts:149 passes it through untouched. Nothing in the query path scales it, so the only difference is the missing / 100 at the render site.
The cents convention is also stated in overview-metrics.tsx:185 ("Synthesize plausible-looking revenue (in cents)").
Suggested fix
Use the existing useNumber() helper at each of the three sites, matching the pattern already used in events/table/columns.tsx:
const number = useNumber();
// ...
{number.currency(session.revenue / 100)}
Note that in chat-profile-result.tsx the revenue row lives in SuccessCard, not Inner, so the hook belongs in the former.
Summary
The ClickHouse
revenuecolumn is stored in minor units (cents), and most of the dashboard divides by 100 before display. Three render sites do not, so they show revenue 100x too high.Observed on
mainatf72310c, and reproduced on the self-hosted:2images.Reproduction
allowUnsafeRevenueTrackingon a project.op.track('revenue', { __revenue: 200 }).Expected:
$2.00Actual:
$200.00The overview widgets, for the very same event, correctly show
$2.00.Affected sites
apps/start/src/components/sessions/table/columns.tsx:261${session.revenue.toFixed(2)}apps/start/src/routes/_app.$organizationId.$projectId.sessions_.$sessionId.tsx:282`$${session.revenue}`apps/start/src/components/chat/tool-results/chat-profile-result.tsx:99${metrics.revenue.toFixed(2)}Sites that handle it correctly
These all use
number.currency(revenue / 100):apps/start/src/components/overview/overview-widget-table.tsx(352, 487, 647)apps/start/src/components/overview/overview-list-modal.tsx:228apps/start/src/components/overview/overview-metric-card.tsx:194apps/start/src/components/projects/project-card.tsx:144apps/start/src/components/projects/project-chart.tsx:79apps/start/src/components/events/table/columns.tsx(35, 53)Why this is unambiguous
It is the same value from the same column in both cases.
session-buffer.ts:257accumulates the event'srevenueinto the session, andsession.service.ts:149passes it through untouched. Nothing in the query path scales it, so the only difference is the missing/ 100at the render site.The cents convention is also stated in
overview-metrics.tsx:185("Synthesize plausible-looking revenue (in cents)").Suggested fix
Use the existing
useNumber()helper at each of the three sites, matching the pattern already used inevents/table/columns.tsx:Note that in
chat-profile-result.tsxthe revenue row lives inSuccessCard, notInner, so the hook belongs in the former.