Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(mcp-analytics): add thousands separators to activity headline counts (#80528)

Mike Warrene4493eee7946
diff --git a/products/mcp_analytics/frontend/earlyData/activitySummary.ts b/products/mcp_analytics/frontend/earlyData/activitySummary.ts
index 10ce8d77a458..13d7379bf6ed 100644
--- a/products/mcp_analytics/frontend/earlyData/activitySummary.ts
+++ b/products/mcp_analytics/frontend/earlyData/activitySummary.ts
@@ -1,4 +1,4 @@
-import { humanFriendlyLargeNumber } from 'lib/utils/numbers'
+import { humanFriendlyLargeNumber, humanFriendlyNumber } from 'lib/utils/numbers'
export interface ActivitySummaryInput {
totalCalls: number
@@ -28,14 +28,15 @@ export function buildActivitySummary(input: ActivitySummaryInput): string {
const parts = [`${humanFriendlyLargeNumber(totalCalls)} tool calls`]
if (distinctClients > 0) {
- parts.push(`from ${distinctClients} client${distinctClients === 1 ? '' : 's'}`)
+ parts.push(`from ${humanFriendlyNumber(distinctClients)} client${distinctClients === 1 ? '' : 's'}`)
}
let summary = `${parts.join(' ')} so far`
if (topTool) {
summary += ` — ${topTool} is the favorite`
}
if (errorCalls > 0) {
- summary += `${topTool ? ',' : ' —'} ${errorCalls} failure${errorCalls === 1 ? '' : 's'} worth a look`
+ const failures = `${humanFriendlyNumber(errorCalls)} failure${errorCalls === 1 ? '' : 's'}`
+ summary += `${topTool ? ',' : ' —'} ${failures} worth a look`
}
return summary
}
diff --git a/products/mcp_analytics/frontend/earlyData/earlyData.test.ts b/products/mcp_analytics/frontend/earlyData/earlyData.test.ts
index 76c4fd8465a0..669df24025ee 100644
--- a/products/mcp_analytics/frontend/earlyData/earlyData.test.ts
+++ b/products/mcp_analytics/frontend/earlyData/earlyData.test.ts
@@ -22,6 +22,11 @@ describe('early data derivations', () => {
{ totalCalls: 42, distinctClients: 3, errorCalls: 4, topTool: 'search_docs' },
/^42 tool calls from 3 clients so far — search_docs is the favorite, 4 failures worth a look$/,
],
+ // Big client and failure counts get thousands separators, unlike the abbreviated call count.
+ [
+ { totalCalls: 21_700_000, distinctClients: 1051, errorCalls: 533_638, topTool: 'execute-sql' },
+ /^21\.7M tool calls from 1,051 clients so far — execute-sql is the favorite, 533,638 failures worth a look$/,
+ ],
// Failures read grammatically even without a favorite tool.
[
{ totalCalls: 42, distinctClients: 0, errorCalls: 1, topTool: null },