From 393b43a881aa0e504cf9e39a2704938daedfd6c7 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Thu, 20 Aug 2026 00:49:46 -0400 Subject: [PATCH] Revert "feat(stats): combine free and go usage (#43577)" This reverts commit 394b5ac5fdd0a177363b4fcc7ec09fb3aceb2ac1. --- packages/stats/core/src/domain/geo.ts | 2 +- packages/stats/core/src/domain/home.ts | 10 +++------- packages/stats/core/src/domain/model.ts | 2 +- packages/stats/core/src/domain/provider.ts | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/stats/core/src/domain/geo.ts b/packages/stats/core/src/domain/geo.ts index 9da03b54ca8..b75e08a34b2 100644 --- a/packages/stats/core/src/domain/geo.ts +++ b/packages/stats/core/src/domain/geo.ts @@ -93,7 +93,7 @@ export class GeoStatRepo extends Context.Service { await queryRows(`select period_key, updated_at, tier, provider, model, sessions, unique_users, input_tokens, output_tokens, reasoning_tokens, cache_read_tokens, total_tokens, input_cost_microcents, output_cost_microcents, total_cost_microcents from model_stat where grain = 'day' and client = 'all' and source = 'all' - and tier in ('Free', 'free', 'Go', 'go') order by period_key`) + and tier in ('Go', 'go') order by period_key`) ).map((row) => ({ periodKey: stringValue(row.period_key), updatedAt: dateValue(row.updated_at), @@ -238,8 +238,7 @@ async function listModelDaily(): Promise { async function listProviderDaily(): Promise { return ( await queryRows(`select period_key, updated_at, tier, provider, total_tokens from provider_stat - where grain = 'day' and client = 'all' and source = 'all' - and tier in ('Free', 'free', 'Go', 'go') order by period_key`) + where grain = 'day' and client = 'all' and source = 'all' and tier in ('Go', 'go') order by period_key`) ).map((row) => ({ periodKey: stringValue(row.period_key), updatedAt: dateValue(row.updated_at), @@ -260,8 +259,7 @@ async function listGeoDaily(opts?: { provider?: string; model?: string }): Promi return ( await queryRows( `select period_key, updated_at, tier, provider, model, country, continent, total_tokens from geo_stat - where grain = 'day' and client = 'all' and source = 'all' - and tier in ('Free', 'free', 'Go', 'go') ${scope} order by period_key`, + where grain = 'day' and client = 'all' and source = 'all' and tier in ('Go', 'go') ${scope} order by period_key`, params, ) ).map((row) => ({ @@ -737,7 +735,6 @@ function rowsForProduct( end: number, ) { const windowRows = rows.filter((row) => row.periodStart >= start && row.periodStart < end) - if (product === "Go") return windowRows.filter((row) => row.tier === "Free" || row.tier === "Go") if (product !== "All Users") return windowRows.filter((row) => row.tier === product) const allRows = windowRows.filter((row) => row.tier === "all") @@ -950,7 +947,6 @@ function normalizeGeoRow(row: GeoStatMetric): GeoMetricRow[] { function normalizeTier(value: string) { const normalized = value.toLowerCase() if (normalized === "paid" || normalized === "zen") return "Zen" - if (normalized === "free") return "Free" if (normalized === "go") return "Go" if (normalized === "enterprise") return "Enterprise" if (normalized === "all") return "all" diff --git a/packages/stats/core/src/domain/model.ts b/packages/stats/core/src/domain/model.ts index b5d5abd4067..ebaf93e1c82 100644 --- a/packages/stats/core/src/domain/model.ts +++ b/packages/stats/core/src/domain/model.ts @@ -211,7 +211,7 @@ function modelDailyScope() { eq(modelStat.grain, "day"), eq(modelStat.client, "all"), eq(modelStat.source, "all"), - inArray(modelStat.tier, ["Free", "free", "Go", "go"]), + inArray(modelStat.tier, ["Go", "go"]), ) } diff --git a/packages/stats/core/src/domain/provider.ts b/packages/stats/core/src/domain/provider.ts index 4c891a685cc..1b177e8e830 100644 --- a/packages/stats/core/src/domain/provider.ts +++ b/packages/stats/core/src/domain/provider.ts @@ -69,7 +69,7 @@ export class ProviderStatRepo extends Context.Service