Revert "feat(stats): combine free and go usage (#43577)"

This reverts commit 394b5ac5fd.
This commit is contained in:
Dax Raad 2026-08-20 00:49:46 -04:00
parent 394b5ac5fd
commit 393b43a881
4 changed files with 6 additions and 10 deletions

View file

@ -93,7 +93,7 @@ export class GeoStatRepo extends Context.Service<GeoStatRepo, GeoStatRepo.Servic
eq(geoStat.grain, "day"),
eq(geoStat.client, "all"),
eq(geoStat.source, "all"),
inArray(geoStat.tier, ["Free", "free", "Go", "go"]),
inArray(geoStat.tier, ["Go", "go"]),
scope,
),
)

View file

@ -215,7 +215,7 @@ async function listModelDaily(): Promise<ModelStatMetric[]> {
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<ModelStatMetric[]> {
async function listProviderDaily(): Promise<ProviderStatMetric[]> {
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<T extends { periodStart: number; tier: string }>(
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"

View file

@ -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"]),
)
}

View file

@ -69,7 +69,7 @@ export class ProviderStatRepo extends Context.Service<ProviderStatRepo, Provider
eq(providerStat.grain, "day"),
eq(providerStat.client, "all"),
eq(providerStat.source, "all"),
inArray(providerStat.tier, ["Free", "free", "Go", "go"]),
inArray(providerStat.tier, ["Go", "go"]),
),
)
.orderBy(asc(providerStat.period_key)),