Skip to content

Commit e0ff4fd

Browse files
committed
Revert "feat(stats): add user ids to inference metrics"
This reverts commit 428ae6d.
1 parent 428ae6d commit e0ff4fd

6 files changed

Lines changed: 10 additions & 62 deletions

File tree

‎infra/stats.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const inferenceEventTable = new aws.s3tables.Table(
5656
{ name: "error_cause2", type: "string", required: false },
5757
{ name: "api_key", type: "string", required: false },
5858
{ name: "workspace", type: "string", required: false },
59-
{ name: "user_id", type: "string", required: false },
6059
{ name: "is_subscription", type: "boolean", required: false },
6160
{ name: "subscription", type: "string", required: false },
6261
{ name: "response_length", type: "long", required: false },

‎packages/console/app/src/routes/zen/util/handler.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ export async function handler(
697697
logger.metric({
698698
api_key: data.apiKey,
699699
workspace: data.workspaceID,
700-
user_id: data.user.id,
701700
...(() => {
702701
if (data.billing.subscription)
703702
return {

‎packages/console/function/src/log-processor.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ function toLakeEvent(time: string, data: Record<string, unknown>) {
132132
error_cause2: string(data, "error.cause2"),
133133
api_key: string(data, "api_key"),
134134
workspace: string(data, "workspace"),
135-
user_id: string(data, "user_id"),
136135
is_subscription: boolean(data, "isSubscription"), // removed
137136
subscription: string(data, "subscription"),
138137
response_length: integer(data, "response_length"),

‎packages/stats/core/src/domain/inference.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ WITH normalized AS (
7575
session,
7676
COALESCE(NULLIF(workspace, ''), '') AS workspace,
7777
COALESCE(NULLIF(api_key, ''), '') AS api_key,
78-
COALESCE(NULLIF(user_id, ''), '') AS user_id,
7978
status,
8079
duration AS duration_ms,
8180
time_to_first_byte AS ttfb_ms,
@@ -117,7 +116,7 @@ WITH normalized AS (
117116
country,
118117
continent,
119118
session,
120-
COALESCE(NULLIF(user_id, ''), NULLIF(workspace, ''), NULLIF(api_key, '')) AS user_key,
119+
COALESCE(NULLIF(workspace, ''), NULLIF(api_key, '')) AS user_key,
121120
status,
122121
duration_ms,
123122
ttfb_ms,

‎packages/stats/core/src/honeycomb-backfill.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,7 @@ function baseAggregate(row: RawRow, grain: Grain, opts: ImportOptions): StatBase
454454
tier: tier(row),
455455
sessions: integer(row, "sessions", ["COUNT_DISTINCT(session)"]),
456456
requests: integer(row, "requests", ["COUNT", "COUNT()"]),
457-
unique_users: integer(row, "unique_users", [
458-
"COUNT_DISTINCT(user_id)",
459-
"COUNT_DISTINCT(workspace)",
460-
"COUNT_DISTINCT(api_key)",
461-
]),
457+
unique_users: integer(row, "unique_users", ["COUNT_DISTINCT(workspace)", "COUNT_DISTINCT(api_key)"]),
462458
input_tokens: integer(row, "input_tokens", ["SUM(tokens.input)", "SUM(tokens_input)"]),
463459
output_tokens: integer(row, "output_tokens", ["SUM(tokens.output)", "SUM(tokens_output)"]),
464460
reasoning_tokens: integer(row, "reasoning_tokens", ["SUM(tokens.reasoning)", "SUM(tokens_reasoning)"]),

‎sst-env.d.ts‎

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ declare module "sst" {
2626
"AuthApi": import("@cloudflare/workers-types").Service
2727
"AuthStorage": import("@cloudflare/workers-types").KVNamespace
2828
"Bucket": import("@cloudflare/workers-types").R2Bucket
29+
"CLOUDFLARE_API_TOKEN": {
30+
"type": "sst.sst.Secret"
31+
"value": string
32+
}
33+
"CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
34+
"type": "sst.sst.Secret"
35+
"value": string
36+
}
2937
"Console": {
3038
"type": "sst.cloudflare.SolidStart"
3139
"url": string
@@ -91,37 +99,6 @@ declare module "sst" {
9199
"type": "random.index/randomPassword.RandomPassword"
92100
"value": string
93101
}
94-
"InferenceEvent": {
95-
"catalog": string
96-
"database": string
97-
"region": string
98-
"table": string
99-
"tableBucket": string
100-
"type": "sst.sst.Linkable"
101-
"workgroup": string
102-
}
103-
"LakeIngest": {
104-
"secret": string
105-
"type": "sst.sst.Linkable"
106-
"url": string
107-
}
108-
"LakeIngestConfig": {
109-
"secret": string
110-
"streamName": string
111-
"type": "sst.sst.Linkable"
112-
}
113-
"LakeIngestSecret": {
114-
"type": "random.index/randomPassword.RandomPassword"
115-
"value": string
116-
}
117-
"LakeIngestService": {
118-
"service": string
119-
"type": "sst.aws.Service"
120-
"url": string
121-
}
122-
"LakeVpc": {
123-
"type": "sst.aws.Vpc"
124-
}
125102
"LogProcessor": import("@cloudflare/workers-types").Service
126103
"R2AccessKey": {
127104
"type": "sst.sst.Secret"
@@ -156,27 +133,6 @@ declare module "sst" {
156133
"value": string
157134
}
158135
"Stat": import("@cloudflare/workers-types").Service
159-
"Stats": {
160-
"type": "sst.cloudflare.SolidStart"
161-
"url": string
162-
}
163-
"StatsDatabase": {
164-
"database": string
165-
"host": string
166-
"password": string
167-
"port": number
168-
"type": "sst.sst.Linkable"
169-
"url": string
170-
"username": string
171-
}
172-
"StatsSyncConfig": {
173-
"dataset": string
174-
"type": "sst.sst.Linkable"
175-
}
176-
"StatsSyncService": {
177-
"service": string
178-
"type": "sst.aws.Service"
179-
}
180136
"Teams": {
181137
"type": "sst.cloudflare.SolidStart"
182138
"url": string

0 commit comments

Comments
 (0)