feat(stats): add geo breakdown (#30456)

This commit is contained in:
Adam
2026-06-03 07:02:37 -05:00
committed by GitHub
parent 56ec4b6912
commit 7af6eafb41
5 changed files with 462 additions and 5 deletions

View File

@@ -197,12 +197,12 @@ function buildMarketShare(rows: ProviderMetricRow[], range: UsageRange, window:
function buildCountryStats(rows: GeoMetricRow[], window: DateWindow) {
const countries = aggregateByCountry(rowsForProduct(rows, "All Users", window.start, window.end))
.filter((item) => item.tokens > 0)
.filter((item) => item.tokens > 0 && item.country !== "AQ")
.toSorted((a, b) => b.tokens - a.tokens)
const totalTokens = countries.reduce((sum, item) => sum + item.tokens, 0)
if (totalTokens === 0) return []
return countries.slice(0, 16).map((item, index) => ({
return countries.map((item, index) => ({
country: item.country,
continent: item.continent,
tokens: round(item.tokens / 1_000_000_000_000, 4),