@ericminassian/platform-core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/api.d.ts +942 -45
  2. package/dist/api.js +372 -13
  3. package/dist/api.js.map +1 -1
  4. package/dist/auth.js +5 -2
  5. package/dist/auth.js.map +1 -1
  6. package/dist/base64url.d.ts +3 -0
  7. package/dist/base64url.js +15 -0
  8. package/dist/base64url.js.map +1 -0
  9. package/dist/bindings.d.ts +62 -12
  10. package/dist/bindings.js +1 -1
  11. package/dist/bindings.js.map +1 -1
  12. package/dist/cloudfront-function.d.ts +5 -1
  13. package/dist/cloudfront-function.js +64 -2
  14. package/dist/cloudfront-function.js.map +1 -1
  15. package/dist/compute.d.ts +52 -0
  16. package/dist/compute.js +65 -0
  17. package/dist/compute.js.map +1 -0
  18. package/dist/config.d.ts +18 -0
  19. package/dist/config.js +9 -0
  20. package/dist/config.js.map +1 -1
  21. package/dist/constants.d.ts +56 -1
  22. package/dist/constants.js +56 -1
  23. package/dist/constants.js.map +1 -1
  24. package/dist/email.d.ts +84 -0
  25. package/dist/email.js +111 -0
  26. package/dist/email.js.map +1 -0
  27. package/dist/fingerprint.d.ts +9 -0
  28. package/dist/fingerprint.js +19 -0
  29. package/dist/fingerprint.js.map +1 -0
  30. package/dist/index.d.ts +6 -0
  31. package/dist/index.js +6 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/jobs.d.ts +111 -0
  34. package/dist/jobs.js +214 -0
  35. package/dist/jobs.js.map +1 -0
  36. package/dist/manifest.d.ts +270 -29
  37. package/dist/manifest.js +190 -22
  38. package/dist/manifest.js.map +1 -1
  39. package/dist/naming.d.ts +83 -7
  40. package/dist/naming.js +89 -8
  41. package/dist/naming.js.map +1 -1
  42. package/dist/platform-api.d.ts +3733 -1278
  43. package/dist/platform-api.js +120 -8
  44. package/dist/platform-api.js.map +1 -1
  45. package/dist/realtime.d.ts +139 -0
  46. package/dist/realtime.js +201 -0
  47. package/dist/realtime.js.map +1 -0
  48. package/dist/router/decide.d.ts +2 -0
  49. package/dist/router/decide.js +38 -6
  50. package/dist/router.d.ts +35 -13
  51. package/dist/router.js +36 -0
  52. package/dist/router.js.map +1 -1
  53. package/dist/runtime-config.d.ts +57 -0
  54. package/dist/runtime-config.js +12 -0
  55. package/dist/runtime-config.js.map +1 -1
  56. package/dist/storage.d.ts +55 -0
  57. package/dist/storage.js +112 -0
  58. package/dist/storage.js.map +1 -0
  59. package/dist/telemetry.d.ts +124 -19
  60. package/dist/telemetry.js +97 -21
  61. package/dist/telemetry.js.map +1 -1
  62. package/dist/web-compute.d.ts +191 -0
  63. package/dist/web-compute.js +257 -0
  64. package/dist/web-compute.js.map +1 -0
  65. package/package.json +19 -7
  66. package/src/api.ts +445 -15
  67. package/src/auth.ts +6 -2
  68. package/src/base64url.ts +13 -0
  69. package/src/bindings.ts +67 -6
  70. package/src/cloudfront-function.ts +64 -2
  71. package/src/compute.ts +86 -0
  72. package/src/config.ts +31 -1
  73. package/src/constants.ts +64 -1
  74. package/src/email.ts +168 -0
  75. package/src/fingerprint.ts +20 -0
  76. package/src/index.ts +6 -0
  77. package/src/jobs.ts +281 -0
  78. package/src/manifest.ts +415 -45
  79. package/src/naming.ts +93 -9
  80. package/src/platform-api.ts +134 -8
  81. package/src/realtime.ts +298 -0
  82. package/src/router/decide.d.ts +2 -0
  83. package/src/router/decide.js +38 -6
  84. package/src/router.ts +33 -13
  85. package/src/runtime-config.ts +70 -0
  86. package/src/storage.ts +120 -0
  87. package/src/telemetry.ts +104 -21
  88. package/src/web-compute.ts +342 -0
@@ -4,9 +4,13 @@
4
4
  * filter forwards the interesting kinds to the telemetry processor, which
5
5
  * aggregates rollups into the telemetry table. Logs Insights covers the rest
6
6
  * (search, traces) on demand. No CloudWatch custom metrics are ever created.
7
+ *
8
+ * CloudWatch Logs bills every byte ingested, so lines leave out what a reader
9
+ * can tell without it (a `path` equal to its `route`, a first `attempt`), and
10
+ * most requests and jobs fold their spans into a count (`traceSampled`).
7
11
  */
8
12
  import { Schema } from 'effect';
9
- export declare const TelemetryKind: Schema.Literals<readonly ["req", "err", "job", "span", "log", "metric", "env"]>;
13
+ export declare const TelemetryKind: Schema.Literals<readonly ["req", "err", "job", "span", "log", "metric", "limit", "env"]>;
10
14
  export type TelemetryKind = typeof TelemetryKind.Type;
11
15
  export declare const RequestEvent: Schema.Struct<{
12
16
  readonly _p: Schema.Literal<1>;
@@ -17,11 +21,14 @@ export declare const RequestEvent: Schema.Struct<{
17
21
  readonly trace: Schema.optional<Schema.String>;
18
22
  readonly span: Schema.optional<Schema.String>;
19
23
  readonly parent: Schema.optional<Schema.String>;
24
+ readonly calls: Schema.optional<Schema.Finite>;
25
+ readonly callMs: Schema.optional<Schema.Finite>;
20
26
  readonly t: Schema.Literal<"req">;
21
27
  readonly method: Schema.String;
22
- /** Route pattern when known (`/api/todos/:id`), else the raw path. */
28
+ /** Route pattern when known (`/api/todos/:id`), else the raw path with ids as `:id`. */
23
29
  readonly route: Schema.String;
24
- readonly path: Schema.String;
30
+ /** The raw path, when it isn't `route`. */
31
+ readonly path: Schema.optional<Schema.String>;
25
32
  readonly status: Schema.Finite;
26
33
  /** Duration in ms. */
27
34
  readonly dur: Schema.Finite;
@@ -42,7 +49,8 @@ export declare const ErrorEvent: Schema.Struct<{
42
49
  readonly span: Schema.optional<Schema.String>;
43
50
  readonly parent: Schema.optional<Schema.String>;
44
51
  readonly t: Schema.Literal<"err">;
45
- readonly source: Schema.Literals<readonly ["http", "job", "unhandled", "log"]>;
52
+ /** `service`: a long-running service's `run` failed (it is rerun after a backoff). */
53
+ readonly source: Schema.Literals<readonly ["http", "job", "unhandled", "log", "service"]>;
46
54
  readonly name: Schema.String;
47
55
  readonly message: Schema.String;
48
56
  readonly stack: Schema.optional<Schema.String>;
@@ -51,6 +59,11 @@ export declare const ErrorEvent: Schema.Struct<{
51
59
  readonly fingerprint: Schema.String;
52
60
  }>;
53
61
  export type ErrorEvent = typeof ErrorEvent.Type;
62
+ /**
63
+ * One unit of work. `service` jobs come from long-running services: `<service>`
64
+ * is a run of the service that ended (it is rerun; `dur` is how long it ran),
65
+ * `<service>/<unit>` a unit of work it marked with `traced`.
66
+ */
54
67
  export declare const JobEvent: Schema.Struct<{
55
68
  readonly _p: Schema.Literal<1>;
56
69
  readonly ts: Schema.Finite;
@@ -60,14 +73,23 @@ export declare const JobEvent: Schema.Struct<{
60
73
  readonly trace: Schema.optional<Schema.String>;
61
74
  readonly span: Schema.optional<Schema.String>;
62
75
  readonly parent: Schema.optional<Schema.String>;
76
+ readonly calls: Schema.optional<Schema.Finite>;
77
+ readonly callMs: Schema.optional<Schema.Finite>;
63
78
  readonly t: Schema.Literal<"job">;
64
- readonly kind: Schema.Literals<readonly ["queue", "event", "cron", "invoke"]>;
79
+ readonly kind: Schema.Literals<readonly ["queue", "event", "cron", "invoke", "service"]>;
65
80
  readonly name: Schema.String;
66
81
  readonly status: Schema.Literals<readonly ["ok", "error"]>;
67
82
  readonly dur: Schema.Finite;
83
+ /** A queue message's, event's or cron run's attempt, when it isn't the first. */
68
84
  readonly attempt: Schema.optional<Schema.Finite>;
85
+ /** What happens after a failed run: tried again later, or moved to the dead-letter queue. */
86
+ readonly next: Schema.optional<Schema.Literals<readonly ["retry", "dead"]>>;
69
87
  }>;
70
88
  export type JobEvent = typeof JobEvent.Type;
89
+ /**
90
+ * A call a request or job made, written only when its request or job keeps its
91
+ * spans (`TRACE_SAMPLE_RATE`); `parent` is that request's or job's `span`.
92
+ */
71
93
  export declare const SpanEvent: Schema.Struct<{
72
94
  readonly _p: Schema.Literal<1>;
73
95
  readonly ts: Schema.Finite;
@@ -117,6 +139,23 @@ export declare const MetricEvent: Schema.Struct<{
117
139
  readonly unit: Schema.optional<Schema.String>;
118
140
  }>;
119
141
  export type MetricEvent = typeof MetricEvent.Type;
142
+ /** One `RateLimits` check, and whether the limit let it through. */
143
+ export declare const LimitEvent: Schema.Struct<{
144
+ readonly _p: Schema.Literal<1>;
145
+ readonly ts: Schema.Finite;
146
+ readonly app: Schema.String;
147
+ readonly stage: Schema.String;
148
+ readonly rev: Schema.String;
149
+ readonly trace: Schema.optional<Schema.String>;
150
+ readonly span: Schema.optional<Schema.String>;
151
+ readonly parent: Schema.optional<Schema.String>;
152
+ readonly t: Schema.Literal<"limit">;
153
+ /** The limit's name (`signups`). Its key (whom it counts) is never sent: it can be a client address. */
154
+ readonly name: Schema.String;
155
+ readonly ok: Schema.Boolean;
156
+ }>;
157
+ export type LimitEvent = typeof LimitEvent.Type;
158
+ /** A runtime process starting or stopping (`service`: a container of a long-running service). */
120
159
  export declare const EnvEvent: Schema.Struct<{
121
160
  readonly _p: Schema.Literal<1>;
122
161
  readonly ts: Schema.Finite;
@@ -128,7 +167,16 @@ export declare const EnvEvent: Schema.Struct<{
128
167
  readonly parent: Schema.optional<Schema.String>;
129
168
  readonly t: Schema.Literal<"env">;
130
169
  readonly event: Schema.Literals<readonly ["start", "stop"]>;
131
- readonly runtime: Schema.Literals<readonly ["web", "worker"]>;
170
+ readonly runtime: Schema.Literals<readonly ["web", "worker", "service"]>;
171
+ /**
172
+ * How a deployed server runs (`runtime: 'web'`): `request`, a function per
173
+ * request, or `instance`, a Web Function environment. Absent under `plat dev`.
174
+ */
175
+ readonly compute: Schema.optional<Schema.Literals<readonly ["request", "instance"]>>;
176
+ /** The service's name (`runtime: 'service'`). */
177
+ readonly name: Schema.optional<Schema.String>;
178
+ /** Why it stopped, e.g. `SIGTERM`. */
179
+ readonly reason: Schema.optional<Schema.String>;
132
180
  readonly initMs: Schema.optional<Schema.Finite>;
133
181
  }>;
134
182
  export type EnvEvent = typeof EnvEvent.Type;
@@ -142,11 +190,14 @@ export declare const TelemetryEvent: Schema.Union<readonly [Schema.Struct<{
142
190
  readonly trace: Schema.optional<Schema.String>;
143
191
  readonly span: Schema.optional<Schema.String>;
144
192
  readonly parent: Schema.optional<Schema.String>;
193
+ readonly calls: Schema.optional<Schema.Finite>;
194
+ readonly callMs: Schema.optional<Schema.Finite>;
145
195
  readonly t: Schema.Literal<"req">;
146
196
  readonly method: Schema.String;
147
- /** Route pattern when known (`/api/todos/:id`), else the raw path. */
197
+ /** Route pattern when known (`/api/todos/:id`), else the raw path with ids as `:id`. */
148
198
  readonly route: Schema.String;
149
- readonly path: Schema.String;
199
+ /** The raw path, when it isn't `route`. */
200
+ readonly path: Schema.optional<Schema.String>;
150
201
  readonly status: Schema.Finite;
151
202
  /** Duration in ms. */
152
203
  readonly dur: Schema.Finite;
@@ -165,7 +216,8 @@ export declare const TelemetryEvent: Schema.Union<readonly [Schema.Struct<{
165
216
  readonly span: Schema.optional<Schema.String>;
166
217
  readonly parent: Schema.optional<Schema.String>;
167
218
  readonly t: Schema.Literal<"err">;
168
- readonly source: Schema.Literals<readonly ["http", "job", "unhandled", "log"]>;
219
+ /** `service`: a long-running service's `run` failed (it is rerun after a backoff). */
220
+ readonly source: Schema.Literals<readonly ["http", "job", "unhandled", "log", "service"]>;
169
221
  readonly name: Schema.String;
170
222
  readonly message: Schema.String;
171
223
  readonly stack: Schema.optional<Schema.String>;
@@ -181,12 +233,17 @@ export declare const TelemetryEvent: Schema.Union<readonly [Schema.Struct<{
181
233
  readonly trace: Schema.optional<Schema.String>;
182
234
  readonly span: Schema.optional<Schema.String>;
183
235
  readonly parent: Schema.optional<Schema.String>;
236
+ readonly calls: Schema.optional<Schema.Finite>;
237
+ readonly callMs: Schema.optional<Schema.Finite>;
184
238
  readonly t: Schema.Literal<"job">;
185
- readonly kind: Schema.Literals<readonly ["queue", "event", "cron", "invoke"]>;
239
+ readonly kind: Schema.Literals<readonly ["queue", "event", "cron", "invoke", "service"]>;
186
240
  readonly name: Schema.String;
187
241
  readonly status: Schema.Literals<readonly ["ok", "error"]>;
188
242
  readonly dur: Schema.Finite;
243
+ /** A queue message's, event's or cron run's attempt, when it isn't the first. */
189
244
  readonly attempt: Schema.optional<Schema.Finite>;
245
+ /** What happens after a failed run: tried again later, or moved to the dead-letter queue. */
246
+ readonly next: Schema.optional<Schema.Literals<readonly ["retry", "dead"]>>;
190
247
  }>, Schema.Struct<{
191
248
  readonly _p: Schema.Literal<1>;
192
249
  readonly ts: Schema.Finite;
@@ -229,6 +286,19 @@ export declare const TelemetryEvent: Schema.Union<readonly [Schema.Struct<{
229
286
  readonly name: Schema.String;
230
287
  readonly value: Schema.Finite;
231
288
  readonly unit: Schema.optional<Schema.String>;
289
+ }>, Schema.Struct<{
290
+ readonly _p: Schema.Literal<1>;
291
+ readonly ts: Schema.Finite;
292
+ readonly app: Schema.String;
293
+ readonly stage: Schema.String;
294
+ readonly rev: Schema.String;
295
+ readonly trace: Schema.optional<Schema.String>;
296
+ readonly span: Schema.optional<Schema.String>;
297
+ readonly parent: Schema.optional<Schema.String>;
298
+ readonly t: Schema.Literal<"limit">;
299
+ /** The limit's name (`signups`). Its key (whom it counts) is never sent: it can be a client address. */
300
+ readonly name: Schema.String;
301
+ readonly ok: Schema.Boolean;
232
302
  }>, Schema.Struct<{
233
303
  readonly _p: Schema.Literal<1>;
234
304
  readonly ts: Schema.Finite;
@@ -240,12 +310,36 @@ export declare const TelemetryEvent: Schema.Union<readonly [Schema.Struct<{
240
310
  readonly parent: Schema.optional<Schema.String>;
241
311
  readonly t: Schema.Literal<"env">;
242
312
  readonly event: Schema.Literals<readonly ["start", "stop"]>;
243
- readonly runtime: Schema.Literals<readonly ["web", "worker"]>;
313
+ readonly runtime: Schema.Literals<readonly ["web", "worker", "service"]>;
314
+ /**
315
+ * How a deployed server runs (`runtime: 'web'`): `request`, a function per
316
+ * request, or `instance`, a Web Function environment. Absent under `plat dev`.
317
+ */
318
+ readonly compute: Schema.optional<Schema.Literals<readonly ["request", "instance"]>>;
319
+ /** The service's name (`runtime: 'service'`). */
320
+ readonly name: Schema.optional<Schema.String>;
321
+ /** Why it stopped, e.g. `SIGTERM`. */
322
+ readonly reason: Schema.optional<Schema.String>;
244
323
  readonly initMs: Schema.optional<Schema.Finite>;
245
324
  }>]>;
246
325
  export type TelemetryEvent = typeof TelemetryEvent.Type;
247
326
  /** Account-level subscription filter: only aggregate-worthy kinds reach the processor. */
248
- export declare const TELEMETRY_FILTER_PATTERN = "{ ($._p = 1) && (($.t = \"req\") || ($.t = \"err\") || ($.t = \"job\") || ($.t = \"metric\") || ($.t = \"env\")) }";
327
+ export declare const TELEMETRY_FILTER_PATTERN = "{ ($._p = 1) && (($.t = \"req\") || ($.t = \"err\") || ($.t = \"job\") || ($.t = \"metric\") || ($.t = \"limit\") || ($.t = \"env\")) }";
328
+ /**
329
+ * A request or job writes its spans when it fails (a 5xx, a failed job, or an
330
+ * `err` line while it runs), takes `SLOW_TRACE_MS` or longer, or its trace is
331
+ * in this share of traces (`traceSampled`). The rest write only their own
332
+ * line, with the spans counted on it (`calls`, `callMs`).
333
+ */
334
+ export declare const TRACE_SAMPLE_RATE: number;
335
+ /** A request or job that takes this long (ms) or longer writes its spans. */
336
+ export declare const SLOW_TRACE_MS = 1000;
337
+ /**
338
+ * Whether `trace` is one of the sampled traces. It depends on the trace id
339
+ * alone, so every hop of a trace (server → queue → worker) makes the same
340
+ * choice. Any string works: a client can send its own `x-platform-trace`.
341
+ */
342
+ export declare function traceSampled(trace: string): boolean;
249
343
  export declare function isTelemetryEvent(v: unknown): v is TelemetryEvent;
250
344
  /** Upper bounds in ms; the last bucket is open-ended. */
251
345
  export declare const LATENCY_BUCKETS_MS: readonly [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 30000];
@@ -263,26 +357,37 @@ export declare function bucketStart(ts: number, res: Resolution): number;
263
357
  * resolution; `sk` starts with the bucket time so a Query with `BETWEEN`
264
358
  * returns a time range.
265
359
  *
266
- * - `m#<app>#<stage>#<res>` sk `<iso>` whole-stage HTTP: req, s2xx, s3xx, s4xx, s5xx, lat[], cold
360
+ * - `m#<app>#<stage>#<res>` sk `<iso>` whole-stage HTTP: req, s2xx, s3xx, s4xx, s5xx, lat[], cold,
361
+ * dur (ms handling them, summed), and process starts:
362
+ * webStarts (webInits of them reported webInitMs, summed),
363
+ * workerStarts, serviceStarts
267
364
  * - `r#<app>#<stage>#<res>` sk `<iso>#<route>` per-route HTTP (same fields, plus method)
268
- * - `j#<app>#<stage>#<res>` sk `<iso>#<kind>:<name>` jobs: ok, error, lat[]
269
- * - `c#<app>#<stage>#<res>` sk `<iso>#<metric>` custom metrics: count, sum, min, max
365
+ * - `j#<app>#<stage>#<res>` sk `<iso>#<kind>:<name>` jobs: ok, error, lat[]; `service:<name>` rows also
366
+ * count `starts` (containers of that service starting)
367
+ * - `c#<app>#<stage>#<res>` sk `<iso>#<metric>` custom metrics: count, sum (and the unit)
368
+ * - `l#<app>#<stage>#<res>` sk `<iso>#<limit>` rate limit checks: allowed, denied
270
369
  * - `e#<app>#<stage>` sk `<fingerprint>` error groups: count, firstSeen, lastSeen, sample, status
271
- * - `u#<app>#<stage>` sk `<iso>` uptime checks: ok, status, ms
370
+ * - `u#<app>#<stage>` sk `<iso>` uptime: ok, source (`traffic`: req, s5xx; `check`, or none on
371
+ * rows before traffic counted: status, ms)
272
372
  */
273
373
  export declare const telemetryKeys: {
274
374
  readonly stage: (app: string, stage: string, res: Resolution) => string;
275
375
  readonly route: (app: string, stage: string, res: Resolution) => string;
276
376
  readonly job: (app: string, stage: string, res: Resolution) => string;
277
377
  readonly metric: (app: string, stage: string, res: Resolution) => string;
378
+ readonly limit: (app: string, stage: string, res: Resolution) => string;
278
379
  readonly errors: (app: string, stage: string) => string;
279
380
  readonly uptime: (app: string, stage: string) => string;
381
+ /**
382
+ * Email usage: sk `YYYY-MM-DD` (UTC), `n` recipients sent. The SDK writes it
383
+ * with the stage role, whose IAM grant covers only this partition.
384
+ */
385
+ readonly email: (app: string, stage: string) => string;
280
386
  readonly time: (ts: number) => string;
281
387
  };
282
- /** Normalize volatile parts (ids, numbers, quoted values) so similar errors group together. */
388
+ /** Normalize volatile parts (ARNs, ids, numbers, quoted values) so similar errors group together. */
283
389
  export declare function normalizeErrorMessage(message: string): string;
284
390
  /** First stack frame that is app code (not node internals or node_modules). */
285
391
  export declare function topFrame(stack: string | undefined): string;
286
- /** Stable short hash (FNV-1a 32-bit, hex) — no crypto dependency so the SDK stays tiny. */
287
- export declare function fingerprint(parts: readonly string[]): string;
392
+ export { fingerprint } from './fingerprint.ts';
288
393
  export declare function errorFingerprint(name: string, message: string, stack?: string): string;
package/dist/telemetry.js CHANGED
@@ -4,9 +4,14 @@
4
4
  * filter forwards the interesting kinds to the telemetry processor, which
5
5
  * aggregates rollups into the telemetry table. Logs Insights covers the rest
6
6
  * (search, traces) on demand. No CloudWatch custom metrics are ever created.
7
+ *
8
+ * CloudWatch Logs bills every byte ingested, so lines leave out what a reader
9
+ * can tell without it (a `path` equal to its `route`, a first `attempt`), and
10
+ * most requests and jobs fold their spans into a count (`traceSampled`).
7
11
  */
8
12
  import { Schema } from 'effect';
9
- export const TelemetryKind = Schema.Literals(['req', 'err', 'job', 'span', 'log', 'metric', 'env']);
13
+ import { fingerprint, fnv1a } from './fingerprint.js';
14
+ export const TelemetryKind = Schema.Literals(['req', 'err', 'job', 'span', 'log', 'metric', 'limit', 'env']);
10
15
  const base = {
11
16
  /** Marker so the subscription filter only matches platform lines. */
12
17
  _p: Schema.Literal(1),
@@ -20,13 +25,23 @@ const base = {
20
25
  span: Schema.optional(Schema.String),
21
26
  parent: Schema.optional(Schema.String),
22
27
  };
28
+ /**
29
+ * On a `req` or `job` line: the spans it made (SDK calls, `fetch`es, `traced`
30
+ * units) that weren't written as `span` lines, how many and their total ms.
31
+ * Absent when every span was written. See `TRACE_SAMPLE_RATE`.
32
+ */
33
+ const unwrittenSpans = {
34
+ calls: Schema.optional(Schema.Finite),
35
+ callMs: Schema.optional(Schema.Finite),
36
+ };
23
37
  export const RequestEvent = Schema.Struct({
24
38
  ...base,
25
39
  t: Schema.Literal('req'),
26
40
  method: Schema.String,
27
- /** Route pattern when known (`/api/todos/:id`), else the raw path. */
41
+ /** Route pattern when known (`/api/todos/:id`), else the raw path with ids as `:id`. */
28
42
  route: Schema.String,
29
- path: Schema.String,
43
+ /** The raw path, when it isn't `route`. */
44
+ path: Schema.optional(Schema.String),
30
45
  status: Schema.Finite,
31
46
  /** Duration in ms. */
32
47
  dur: Schema.Finite,
@@ -35,11 +50,13 @@ export const RequestEvent = Schema.Struct({
35
50
  /** Hashed user id when signed in. */
36
51
  user: Schema.optional(Schema.String),
37
52
  cold: Schema.optional(Schema.Boolean),
53
+ ...unwrittenSpans,
38
54
  });
39
55
  export const ErrorEvent = Schema.Struct({
40
56
  ...base,
41
57
  t: Schema.Literal('err'),
42
- source: Schema.Literals(['http', 'job', 'unhandled', 'log']),
58
+ /** `service`: a long-running service's `run` failed (it is rerun after a backoff). */
59
+ source: Schema.Literals(['http', 'job', 'unhandled', 'log', 'service']),
43
60
  name: Schema.String,
44
61
  message: Schema.String,
45
62
  stack: Schema.optional(Schema.String),
@@ -47,15 +64,28 @@ export const ErrorEvent = Schema.Struct({
47
64
  job: Schema.optional(Schema.String),
48
65
  fingerprint: Schema.String,
49
66
  });
67
+ /**
68
+ * One unit of work. `service` jobs come from long-running services: `<service>`
69
+ * is a run of the service that ended (it is rerun; `dur` is how long it ran),
70
+ * `<service>/<unit>` a unit of work it marked with `traced`.
71
+ */
50
72
  export const JobEvent = Schema.Struct({
51
73
  ...base,
52
74
  t: Schema.Literal('job'),
53
- kind: Schema.Literals(['queue', 'event', 'cron', 'invoke']),
75
+ kind: Schema.Literals(['queue', 'event', 'cron', 'invoke', 'service']),
54
76
  name: Schema.String,
55
77
  status: Schema.Literals(['ok', 'error']),
56
78
  dur: Schema.Finite,
79
+ /** A queue message's, event's or cron run's attempt, when it isn't the first. */
57
80
  attempt: Schema.optional(Schema.Finite),
81
+ /** What happens after a failed run: tried again later, or moved to the dead-letter queue. */
82
+ next: Schema.optional(Schema.Literals(['retry', 'dead'])),
83
+ ...unwrittenSpans,
58
84
  });
85
+ /**
86
+ * A call a request or job made, written only when its request or job keeps its
87
+ * spans (`TRACE_SAMPLE_RATE`); `parent` is that request's or job's `span`.
88
+ */
59
89
  export const SpanEvent = Schema.Struct({
60
90
  ...base,
61
91
  t: Schema.Literal('span'),
@@ -81,11 +111,29 @@ export const MetricEvent = Schema.Struct({
81
111
  value: Schema.Finite,
82
112
  unit: Schema.optional(Schema.String),
83
113
  });
114
+ /** One `RateLimits` check, and whether the limit let it through. */
115
+ export const LimitEvent = Schema.Struct({
116
+ ...base,
117
+ t: Schema.Literal('limit'),
118
+ /** The limit's name (`signups`). Its key (whom it counts) is never sent: it can be a client address. */
119
+ name: Schema.String,
120
+ ok: Schema.Boolean,
121
+ });
122
+ /** A runtime process starting or stopping (`service`: a container of a long-running service). */
84
123
  export const EnvEvent = Schema.Struct({
85
124
  ...base,
86
125
  t: Schema.Literal('env'),
87
126
  event: Schema.Literals(['start', 'stop']),
88
- runtime: Schema.Literals(['web', 'worker']),
127
+ runtime: Schema.Literals(['web', 'worker', 'service']),
128
+ /**
129
+ * How a deployed server runs (`runtime: 'web'`): `request`, a function per
130
+ * request, or `instance`, a Web Function environment. Absent under `plat dev`.
131
+ */
132
+ compute: Schema.optional(Schema.Literals(['request', 'instance'])),
133
+ /** The service's name (`runtime: 'service'`). */
134
+ name: Schema.optional(Schema.String),
135
+ /** Why it stopped, e.g. `SIGTERM`. */
136
+ reason: Schema.optional(Schema.String),
89
137
  initMs: Schema.optional(Schema.Finite),
90
138
  });
91
139
  /** One telemetry line, as the SDK writes it and the telemetry processor reads it. */
@@ -96,10 +144,33 @@ export const TelemetryEvent = Schema.Union([
96
144
  SpanEvent,
97
145
  LogEvent,
98
146
  MetricEvent,
147
+ LimitEvent,
99
148
  EnvEvent,
100
149
  ]);
101
150
  /** Account-level subscription filter: only aggregate-worthy kinds reach the processor. */
102
- export const TELEMETRY_FILTER_PATTERN = '{ ($._p = 1) && (($.t = "req") || ($.t = "err") || ($.t = "job") || ($.t = "metric") || ($.t = "env")) }';
151
+ export const TELEMETRY_FILTER_PATTERN = '{ ($._p = 1) && (($.t = "req") || ($.t = "err") || ($.t = "job") || ($.t = "metric") || ($.t = "limit") || ($.t = "env")) }';
152
+ // ---------------------------------------------------------------------------
153
+ // Span sampling
154
+ // ---------------------------------------------------------------------------
155
+ /**
156
+ * A request or job writes its spans when it fails (a 5xx, a failed job, or an
157
+ * `err` line while it runs), takes `SLOW_TRACE_MS` or longer, or its trace is
158
+ * in this share of traces (`traceSampled`). The rest write only their own
159
+ * line, with the spans counted on it (`calls`, `callMs`).
160
+ */
161
+ export const TRACE_SAMPLE_RATE = 1 / 20;
162
+ /** A request or job that takes this long (ms) or longer writes its spans. */
163
+ export const SLOW_TRACE_MS = 1_000;
164
+ /**
165
+ * Whether `trace` is one of the sampled traces. It depends on the trace id
166
+ * alone, so every hop of a trace (server → queue → worker) makes the same
167
+ * choice. Any string works: a client can send its own `x-platform-trace`.
168
+ */
169
+ export function traceSampled(trace) {
170
+ // Comparing the hash with a threshold (not `% 20`) keeps a trace sampled at
171
+ // one rate sampled at any higher rate.
172
+ return fnv1a(trace) < TRACE_SAMPLE_RATE * 2 ** 32;
173
+ }
103
174
  export function isTelemetryEvent(v) {
104
175
  return (typeof v === 'object' &&
105
176
  v !== null &&
@@ -146,28 +217,41 @@ export function bucketStart(ts, res) {
146
217
  * resolution; `sk` starts with the bucket time so a Query with `BETWEEN`
147
218
  * returns a time range.
148
219
  *
149
- * - `m#<app>#<stage>#<res>` sk `<iso>` whole-stage HTTP: req, s2xx, s3xx, s4xx, s5xx, lat[], cold
220
+ * - `m#<app>#<stage>#<res>` sk `<iso>` whole-stage HTTP: req, s2xx, s3xx, s4xx, s5xx, lat[], cold,
221
+ * dur (ms handling them, summed), and process starts:
222
+ * webStarts (webInits of them reported webInitMs, summed),
223
+ * workerStarts, serviceStarts
150
224
  * - `r#<app>#<stage>#<res>` sk `<iso>#<route>` per-route HTTP (same fields, plus method)
151
- * - `j#<app>#<stage>#<res>` sk `<iso>#<kind>:<name>` jobs: ok, error, lat[]
152
- * - `c#<app>#<stage>#<res>` sk `<iso>#<metric>` custom metrics: count, sum, min, max
225
+ * - `j#<app>#<stage>#<res>` sk `<iso>#<kind>:<name>` jobs: ok, error, lat[]; `service:<name>` rows also
226
+ * count `starts` (containers of that service starting)
227
+ * - `c#<app>#<stage>#<res>` sk `<iso>#<metric>` custom metrics: count, sum (and the unit)
228
+ * - `l#<app>#<stage>#<res>` sk `<iso>#<limit>` rate limit checks: allowed, denied
153
229
  * - `e#<app>#<stage>` sk `<fingerprint>` error groups: count, firstSeen, lastSeen, sample, status
154
- * - `u#<app>#<stage>` sk `<iso>` uptime checks: ok, status, ms
230
+ * - `u#<app>#<stage>` sk `<iso>` uptime: ok, source (`traffic`: req, s5xx; `check`, or none on
231
+ * rows before traffic counted: status, ms)
155
232
  */
156
233
  export const telemetryKeys = {
157
234
  stage: (app, stage, res) => `m#${app}#${stage}#${res}`,
158
235
  route: (app, stage, res) => `r#${app}#${stage}#${res}`,
159
236
  job: (app, stage, res) => `j#${app}#${stage}#${res}`,
160
237
  metric: (app, stage, res) => `c#${app}#${stage}#${res}`,
238
+ limit: (app, stage, res) => `l#${app}#${stage}#${res}`,
161
239
  errors: (app, stage) => `e#${app}#${stage}`,
162
240
  uptime: (app, stage) => `u#${app}#${stage}`,
241
+ /**
242
+ * Email usage: sk `YYYY-MM-DD` (UTC), `n` recipients sent. The SDK writes it
243
+ * with the stage role, whose IAM grant covers only this partition.
244
+ */
245
+ email: (app, stage) => `mail#${app}#${stage}`,
163
246
  time: (ts) => new Date(ts).toISOString(),
164
247
  };
165
248
  // ---------------------------------------------------------------------------
166
249
  // Error fingerprinting (Sentry-style grouping)
167
250
  // ---------------------------------------------------------------------------
168
- /** Normalize volatile parts (ids, numbers, quoted values) so similar errors group together. */
251
+ /** Normalize volatile parts (ARNs, ids, numbers, quoted values) so similar errors group together. */
169
252
  export function normalizeErrorMessage(message) {
170
253
  return message
254
+ .replace(/\barn:aws[\w-]*:[^\s"'`,()]+/g, '<arn>')
171
255
  .replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, '<uuid>')
172
256
  .replace(/\b[0-9a-f]{16,}\b/gi, '<hex>')
173
257
  .replace(/(["'`]).*?\1/g, '<str>')
@@ -188,15 +272,7 @@ export function topFrame(stack) {
188
272
  }
189
273
  return '';
190
274
  }
191
- /** Stable short hash (FNV-1a 32-bit, hex) — no crypto dependency so the SDK stays tiny. */
192
- export function fingerprint(parts) {
193
- let h = 0x811c9dc5;
194
- for (const ch of parts.join('|')) {
195
- h ^= ch.codePointAt(0);
196
- h = Math.imul(h, 0x01000193) >>> 0;
197
- }
198
- return h.toString(16).padStart(8, '0');
199
- }
275
+ export { fingerprint } from './fingerprint.js';
200
276
  export function errorFingerprint(name, message, stack) {
201
277
  return fingerprint([name, normalizeErrorMessage(message), topFrame(stack)]);
202
278
  }
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAGpG,MAAM,IAAI,GAAG;IACX,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,MAAM,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