@ericminassian/platform-core 0.4.0 → 0.5.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.
- package/dist/api.d.ts +367 -226
- package/dist/api.js +148 -92
- package/dist/api.js.map +1 -1
- package/dist/config.d.ts +0 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +0 -17
- package/dist/constants.js +0 -17
- package/dist/constants.js.map +1 -1
- package/dist/explore.d.ts +367 -0
- package/dist/explore.js +440 -0
- package/dist/explore.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +1 -1
- package/dist/jobs.js +1 -1
- package/dist/manifest.d.ts +10 -47
- package/dist/manifest.js +7 -15
- package/dist/manifest.js.map +1 -1
- package/dist/naming.d.ts +7 -23
- package/dist/naming.js +7 -23
- package/dist/naming.js.map +1 -1
- package/dist/platform-api.d.ts +3511 -2211
- package/dist/platform-api.js +117 -36
- package/dist/platform-api.js.map +1 -1
- package/dist/runtime-config.d.ts +0 -20
- package/dist/runtime-config.js.map +1 -1
- package/dist/storage.d.ts +10 -0
- package/dist/storage.js +10 -0
- package/dist/storage.js.map +1 -1
- package/dist/telemetry.d.ts +52 -27
- package/dist/telemetry.js +67 -19
- package/dist/telemetry.js.map +1 -1
- package/dist/web-compute.js +2 -1
- package/dist/web-compute.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +176 -110
- package/src/config.ts +0 -2
- package/src/constants.ts +0 -19
- package/src/explore.ts +504 -0
- package/src/index.ts +1 -1
- package/src/jobs.ts +1 -1
- package/src/manifest.ts +15 -48
- package/src/naming.ts +7 -25
- package/src/platform-api.ts +140 -38
- package/src/runtime-config.ts +0 -21
- package/src/storage.ts +11 -0
- package/src/telemetry.ts +69 -19
- package/src/web-compute.ts +3 -1
- package/dist/compute.d.ts +0 -52
- package/dist/compute.js +0 -65
- package/dist/compute.js.map +0 -1
- package/src/compute.ts +0 -86
package/dist/telemetry.js
CHANGED
|
@@ -55,8 +55,7 @@ export const RequestEvent = Schema.Struct({
|
|
|
55
55
|
export const ErrorEvent = Schema.Struct({
|
|
56
56
|
...base,
|
|
57
57
|
t: Schema.Literal('err'),
|
|
58
|
-
|
|
59
|
-
source: Schema.Literals(['http', 'job', 'unhandled', 'log', 'service']),
|
|
58
|
+
source: Schema.Literals(['http', 'job', 'unhandled', 'log']),
|
|
60
59
|
name: Schema.String,
|
|
61
60
|
message: Schema.String,
|
|
62
61
|
stack: Schema.optional(Schema.String),
|
|
@@ -64,15 +63,11 @@ export const ErrorEvent = Schema.Struct({
|
|
|
64
63
|
job: Schema.optional(Schema.String),
|
|
65
64
|
fingerprint: Schema.String,
|
|
66
65
|
});
|
|
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
|
-
*/
|
|
66
|
+
/** One unit of work. */
|
|
72
67
|
export const JobEvent = Schema.Struct({
|
|
73
68
|
...base,
|
|
74
69
|
t: Schema.Literal('job'),
|
|
75
|
-
kind: Schema.Literals(['queue', 'event', 'cron', 'invoke'
|
|
70
|
+
kind: Schema.Literals(['queue', 'event', 'cron', 'invoke']),
|
|
76
71
|
name: Schema.String,
|
|
77
72
|
status: Schema.Literals(['ok', 'error']),
|
|
78
73
|
dur: Schema.Finite,
|
|
@@ -119,21 +114,17 @@ export const LimitEvent = Schema.Struct({
|
|
|
119
114
|
name: Schema.String,
|
|
120
115
|
ok: Schema.Boolean,
|
|
121
116
|
});
|
|
122
|
-
/** A runtime process starting or stopping
|
|
117
|
+
/** A runtime process starting or stopping. */
|
|
123
118
|
export const EnvEvent = Schema.Struct({
|
|
124
119
|
...base,
|
|
125
120
|
t: Schema.Literal('env'),
|
|
126
121
|
event: Schema.Literals(['start', 'stop']),
|
|
127
|
-
runtime: Schema.Literals(['web', 'worker'
|
|
122
|
+
runtime: Schema.Literals(['web', 'worker']),
|
|
128
123
|
/**
|
|
129
124
|
* How a deployed server runs (`runtime: 'web'`): `request`, a function per
|
|
130
125
|
* request, or `instance`, a Web Function environment. Absent under `plat dev`.
|
|
131
126
|
*/
|
|
132
127
|
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),
|
|
137
128
|
initMs: Schema.optional(Schema.Finite),
|
|
138
129
|
});
|
|
139
130
|
/** One telemetry line, as the SDK writes it and the telemetry processor reads it. */
|
|
@@ -217,18 +208,31 @@ export function bucketStart(ts, res) {
|
|
|
217
208
|
* resolution; `sk` starts with the bucket time so a Query with `BETWEEN`
|
|
218
209
|
* returns a time range.
|
|
219
210
|
*
|
|
211
|
+
* Every rollup family is written at `1m`, `1h` and `1d` (`RESOLUTION_TTL_DAYS`).
|
|
212
|
+
* Route, job, custom metric and rate limit rows have had minute buckets only
|
|
213
|
+
* since November 2026; before, they started at `1h`.
|
|
214
|
+
*
|
|
220
215
|
* - `m#<app>#<stage>#<res>` sk `<iso>` whole-stage HTTP: req, s2xx, s3xx, s4xx, s5xx, lat[], cold,
|
|
221
216
|
* dur (ms handling them, summed), and process starts:
|
|
222
217
|
* webStarts (webInits of them reported webInitMs, summed),
|
|
223
|
-
* workerStarts
|
|
224
|
-
* - `r#<app>#<stage>#<res>` sk `<iso>#<route>`
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* - `
|
|
218
|
+
* workerStarts
|
|
219
|
+
* - `r#<app>#<stage>#<res>` sk `<iso>#<METHOD> <route>` per-route HTTP: req, s2xx, s3xx, s4xx, s5xx, lat[],
|
|
220
|
+
* cold, method, route. Rows from before November 2026 have no
|
|
221
|
+
* s2xx, s3xx or cold: their req − s4xx − s5xx were 2xx
|
|
222
|
+
* - `j#<app>#<stage>#<res>` sk `<iso>#<kind>:<name>` jobs: ok, error, lat[]
|
|
223
|
+
* - `c#<app>#<stage>#<res>` sk `<iso>#<metric>` custom metrics: count, sum, max (and the unit); rows from
|
|
224
|
+
* before November 2026 have no max
|
|
228
225
|
* - `l#<app>#<stage>#<res>` sk `<iso>#<limit>` rate limit checks: allowed, denied
|
|
226
|
+
* - `v#<app>#<stage>#<res>` sk `<iso>` edge traffic from the router's access log, every
|
|
227
|
+
* request to the stage's host (files, server,
|
|
228
|
+
* stores) but health checks: req, s2xx, s3xx,
|
|
229
|
+
* s4xx, s5xx, and pages (`isPageView`). Since
|
|
230
|
+
* November 2026; written up to an hour late
|
|
229
231
|
* - `e#<app>#<stage>` sk `<fingerprint>` error groups: count, firstSeen, lastSeen, sample, status
|
|
230
232
|
* - `u#<app>#<stage>` sk `<iso>` uptime: ok, source (`traffic`: req, s5xx; `check`, or none on
|
|
231
233
|
* rows before traffic counted: status, ms)
|
|
234
|
+
* - `a#<app>#<stage>` sk `<iso>#<ruleId>` alert rule state changes (`AlertEvent` fields but `ts`),
|
|
235
|
+
* kept `ALERT_HISTORY_DAYS`
|
|
232
236
|
*/
|
|
233
237
|
export const telemetryKeys = {
|
|
234
238
|
stage: (app, stage, res) => `m#${app}#${stage}#${res}`,
|
|
@@ -236,8 +240,10 @@ export const telemetryKeys = {
|
|
|
236
240
|
job: (app, stage, res) => `j#${app}#${stage}#${res}`,
|
|
237
241
|
metric: (app, stage, res) => `c#${app}#${stage}#${res}`,
|
|
238
242
|
limit: (app, stage, res) => `l#${app}#${stage}#${res}`,
|
|
243
|
+
edge: (app, stage, res) => `v#${app}#${stage}#${res}`,
|
|
239
244
|
errors: (app, stage) => `e#${app}#${stage}`,
|
|
240
245
|
uptime: (app, stage) => `u#${app}#${stage}`,
|
|
246
|
+
alerts: (app, stage) => `a#${app}#${stage}`,
|
|
241
247
|
/**
|
|
242
248
|
* Email usage: sk `YYYY-MM-DD` (UTC), `n` recipients sent. The SDK writes it
|
|
243
249
|
* with the stage role, whose IAM grant covers only this partition.
|
|
@@ -246,6 +252,48 @@ export const telemetryKeys = {
|
|
|
246
252
|
time: (ts) => new Date(ts).toISOString(),
|
|
247
253
|
};
|
|
248
254
|
// ---------------------------------------------------------------------------
|
|
255
|
+
// Edge traffic (the router's access log)
|
|
256
|
+
// ---------------------------------------------------------------------------
|
|
257
|
+
/**
|
|
258
|
+
* The fields the router's access log carries (CloudFront standard logging,
|
|
259
|
+
* delivered to `platformNames.edgeLogGroup` as one JSON object per request,
|
|
260
|
+
* every value a string). Enough to count requests and page views per host;
|
|
261
|
+
* never the client's address. Each field costs bytes ingested, but CloudFront
|
|
262
|
+
* includes 750 bytes of log delivery per request, which these stay well under.
|
|
263
|
+
*/
|
|
264
|
+
export const EDGE_LOG_FIELDS = [
|
|
265
|
+
'timestamp(ms)',
|
|
266
|
+
'x-host-header',
|
|
267
|
+
'cs-method',
|
|
268
|
+
'cs-uri-stem',
|
|
269
|
+
'sc-status',
|
|
270
|
+
'sc-content-type',
|
|
271
|
+
];
|
|
272
|
+
/** One access log record, as `EDGE_LOG_FIELDS` deliver it. */
|
|
273
|
+
export const EdgeLogRecord = Schema.Struct({
|
|
274
|
+
'timestamp(ms)': Schema.String,
|
|
275
|
+
'x-host-header': Schema.String,
|
|
276
|
+
'cs-method': Schema.String,
|
|
277
|
+
'cs-uri-stem': Schema.String,
|
|
278
|
+
'sc-status': Schema.String,
|
|
279
|
+
'sc-content-type': Schema.optional(Schema.String),
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* Whether a request loaded a page: a GET answered with an HTML document, or
|
|
283
|
+
* a 304 for a path that names no file (a page the browser had cached, whose
|
|
284
|
+
* revalidation carries no content type). Assets, API calls and errors aren't.
|
|
285
|
+
*/
|
|
286
|
+
export function isPageView(method, uri, status, contentType) {
|
|
287
|
+
if (method !== 'GET')
|
|
288
|
+
return false;
|
|
289
|
+
if (status >= 200 && status < 300)
|
|
290
|
+
return (contentType ?? '').toLowerCase().startsWith('text/html');
|
|
291
|
+
if (status !== 304)
|
|
292
|
+
return false;
|
|
293
|
+
const last = uri.slice(uri.lastIndexOf('/') + 1);
|
|
294
|
+
return !last.includes('.') || last.endsWith('.html');
|
|
295
|
+
}
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
249
297
|
// Error fingerprinting (Sentry-style grouping)
|
|
250
298
|
// ---------------------------------------------------------------------------
|
|
251
299
|
/** Normalize volatile parts (ARNs, ids, numbers, quoted values) so similar errors group together. */
|
package/dist/telemetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAG7G,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,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,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@
|
|
|
16
16
|
* mode (and back) by `simulateWebCompute`.
|
|
17
17
|
*/
|
|
18
18
|
import { base64url, fromBase64url } from './base64url.js';
|
|
19
|
-
import { HOURS_PER_MONTH } from './compute.js';
|
|
20
19
|
import { PROD_STAGE } from './constants.js';
|
|
20
|
+
/** Hours AWS bills a month of always-on capacity for. */
|
|
21
|
+
const HOURS_PER_MONTH = 730;
|
|
21
22
|
export const WEB_COMPUTE = ['request', 'instance'];
|
|
22
23
|
/** `web.compute` in plat.config.ts. */
|
|
23
24
|
export const WEB_COMPUTE_SETTINGS = ['auto', ...WEB_COMPUTE];
|
package/dist/web-compute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-compute.js","sourceRoot":"","sources":["../src/web-compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"web-compute.js","sourceRoot":"","sources":["../src/web-compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,yDAAyD;AACzD,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,CAAU,CAAC;AAG5D,uCAAuC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,GAAG,WAAW,CAAU,CAAC;AAGtE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAW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AC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC"}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Schema, SchemaGetter } from 'effect';
|
|
11
11
|
import { MemberRole } from './config.ts';
|
|
12
|
+
import { QueryResolution } from './explore.ts';
|
|
12
13
|
import { ResolvedManifest } from './manifest.ts';
|
|
13
14
|
import { Resolution, TelemetryEvent } from './telemetry.ts';
|
|
14
15
|
import { WEB_COMPUTE, WEB_COMPUTE_SETTINGS } from './web-compute.ts';
|
|
@@ -19,10 +20,19 @@ const optional = Schema.optional;
|
|
|
19
20
|
// Records
|
|
20
21
|
// ---------------------------------------------------------------------------
|
|
21
22
|
|
|
23
|
+
/** A GitHub repository's visibility, as its Actions OIDC tokens state it. */
|
|
24
|
+
export const RepoVisibility = Schema.Literals(['public', 'private', 'internal']);
|
|
25
|
+
export type RepoVisibility = typeof RepoVisibility.Type;
|
|
26
|
+
|
|
22
27
|
export const AppRecord = Schema.Struct({
|
|
23
28
|
name: Schema.String,
|
|
24
29
|
/** GitHub `owner/name` allowed to deploy this app from CI. */
|
|
25
30
|
repo: Schema.String,
|
|
31
|
+
/**
|
|
32
|
+
* The repo's visibility at its last CI deploy (absent before one): the
|
|
33
|
+
* public directory links a public repo. Changing `repo` forgets it.
|
|
34
|
+
*/
|
|
35
|
+
repoVisibility: optional(RepoVisibility),
|
|
26
36
|
description: optional(Schema.String),
|
|
27
37
|
/** GitHub usernames who can manage the app (admins can manage everything). */
|
|
28
38
|
owners: Schema.Array(Schema.String),
|
|
@@ -195,21 +205,63 @@ export const AppSummary = Schema.Struct({
|
|
|
195
205
|
health: Schema.NullOr(AppHealth),
|
|
196
206
|
costMonthToDateUsd: optional(Schema.Finite),
|
|
197
207
|
lastDeployment: optional(DeploymentRecord),
|
|
208
|
+
/** Prod's requests in each of the last 24 hours, oldest first (absent without a prod stage). */
|
|
209
|
+
traffic: optional(Schema.Array(Schema.Finite)),
|
|
210
|
+
/** The app's alert rules on every stage: how many there are and how many are firing. */
|
|
211
|
+
alerts: optional(Schema.Struct({ total: Schema.Finite, alarm: Schema.Finite })),
|
|
212
|
+
/** Whether the public directory lists prod: its live deployment's `listed` (absent without one). */
|
|
213
|
+
listed: optional(Schema.Boolean),
|
|
198
214
|
});
|
|
199
215
|
export type AppSummary = typeof AppSummary.Type;
|
|
200
216
|
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
// Public directory
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
|
|
221
|
+
/** Days of traffic the public directory gives each app. */
|
|
222
|
+
export const PUBLIC_DIRECTORY_DAYS = 30;
|
|
223
|
+
|
|
224
|
+
/** An app in the public directory: its prod stage, as anyone may see it. */
|
|
225
|
+
export const PublicApp = Schema.Struct({
|
|
226
|
+
name: Schema.String,
|
|
227
|
+
/** The live deployment's `description` in plat.config.ts, else the app's own. */
|
|
228
|
+
description: optional(Schema.String),
|
|
229
|
+
url: Schema.String,
|
|
230
|
+
/** The GitHub repository's page, when the repo is public. */
|
|
231
|
+
source: optional(Schema.String),
|
|
232
|
+
/** When prod was first deployed. */
|
|
233
|
+
liveSince: Schema.String,
|
|
234
|
+
/** When the deployment prod serves went live (a compute switch keeps its build's time). */
|
|
235
|
+
lastDeployedAt: Schema.String,
|
|
236
|
+
/** Whether prod was up at the uptime pinger's last result; null before its first. */
|
|
237
|
+
up: Schema.NullOr(Schema.Boolean),
|
|
238
|
+
/** Pages the router served for prod's host on each of `days` (`isPageView`); today's so far. */
|
|
239
|
+
pageViews: Schema.Array(Schema.Finite),
|
|
240
|
+
/** Every request the router served for it on each of `days`: files, server and stores. */
|
|
241
|
+
requests: Schema.Array(Schema.Finite),
|
|
242
|
+
});
|
|
243
|
+
export type PublicApp = typeof PublicApp.Type;
|
|
244
|
+
|
|
245
|
+
/** Every app whose live prod deployment is `listed` (the default), by name. */
|
|
246
|
+
export const PublicAppsResponse = Schema.Struct({
|
|
247
|
+
generatedAt: Schema.String,
|
|
248
|
+
/** The UTC days the counts cover (`YYYY-MM-DD`), oldest first, ending today (so far). */
|
|
249
|
+
days: Schema.Array(Schema.String),
|
|
250
|
+
/**
|
|
251
|
+
* The first UTC day the router's access log counted (`YYYY-MM-DD`): days
|
|
252
|
+
* before it have no counts, rather than no traffic. Absent where the
|
|
253
|
+
* platform has no access log (`plat dev`).
|
|
254
|
+
*/
|
|
255
|
+
countingSince: optional(Schema.String),
|
|
256
|
+
apps: Schema.Array(PublicApp),
|
|
257
|
+
});
|
|
258
|
+
export type PublicAppsResponse = typeof PublicAppsResponse.Type;
|
|
259
|
+
|
|
201
260
|
// ---------------------------------------------------------------------------
|
|
202
261
|
// Stages and deployments
|
|
203
262
|
// ---------------------------------------------------------------------------
|
|
204
263
|
|
|
205
|
-
|
|
206
|
-
export const ArtifactFile = Schema.Literals([
|
|
207
|
-
'manifest.json',
|
|
208
|
-
'server.zip',
|
|
209
|
-
'worker.zip',
|
|
210
|
-
'static.zip',
|
|
211
|
-
'services.zip',
|
|
212
|
-
]);
|
|
264
|
+
export const ArtifactFile = Schema.Literals(['manifest.json', 'server.zip', 'worker.zip', 'static.zip']);
|
|
213
265
|
export type ArtifactFile = typeof ArtifactFile.Type;
|
|
214
266
|
|
|
215
267
|
export const PresignedPost = Schema.Struct({
|
|
@@ -243,7 +295,6 @@ export const CreateDeploymentResponse = Schema.Struct({
|
|
|
243
295
|
'server.zip': optional(PresignedPost),
|
|
244
296
|
'worker.zip': optional(PresignedPost),
|
|
245
297
|
'static.zip': optional(PresignedPost),
|
|
246
|
-
'services.zip': optional(PresignedPost),
|
|
247
298
|
}),
|
|
248
299
|
});
|
|
249
300
|
export type CreateDeploymentResponse = typeof CreateDeploymentResponse.Type;
|
|
@@ -305,7 +356,7 @@ export const RouteStats = Schema.Struct({
|
|
|
305
356
|
});
|
|
306
357
|
export type RouteStats = typeof RouteStats.Type;
|
|
307
358
|
|
|
308
|
-
export const JobKind = Schema.Literals(['queue', 'event', 'cron', 'invoke'
|
|
359
|
+
export const JobKind = Schema.Literals(['queue', 'event', 'cron', 'invoke']);
|
|
309
360
|
export type JobKind = typeof JobKind.Type;
|
|
310
361
|
|
|
311
362
|
export const JobStats = Schema.Struct({
|
|
@@ -553,7 +604,7 @@ export type ErrorGroup = typeof ErrorGroup.Type;
|
|
|
553
604
|
export const UpdateErrorRequest = Schema.Struct({ status: ErrorStatus });
|
|
554
605
|
export type UpdateErrorRequest = typeof UpdateErrorRequest.Type;
|
|
555
606
|
|
|
556
|
-
/** Log stream of a line: `web
|
|
607
|
+
/** Log stream of a line: `web` or `worker`. */
|
|
557
608
|
export const LogStream = Schema.String;
|
|
558
609
|
export type LogStream = typeof LogStream.Type;
|
|
559
610
|
|
|
@@ -579,6 +630,120 @@ export const TraceResponse = Schema.Struct({
|
|
|
579
630
|
});
|
|
580
631
|
export type TraceResponse = typeof TraceResponse.Type;
|
|
581
632
|
|
|
633
|
+
/** Lines around one line of a stream, oldest first; `anchor` is that line's index. */
|
|
634
|
+
export const LogContextResponse = Schema.Struct({
|
|
635
|
+
lines: Schema.Array(LogLine),
|
|
636
|
+
anchor: Schema.Finite,
|
|
637
|
+
});
|
|
638
|
+
export type LogContextResponse = typeof LogContextResponse.Type;
|
|
639
|
+
|
|
640
|
+
/** How many lines of a range have a value of a field. */
|
|
641
|
+
export const FacetCount = Schema.Struct({ value: Schema.String, count: Schema.Finite });
|
|
642
|
+
export type FacetCount = typeof FacetCount.Type;
|
|
643
|
+
|
|
644
|
+
/** Lines per bucket by level, and counts of each field's commonest values, for the range and filters. */
|
|
645
|
+
export const LogStatsResponse = Schema.Struct({
|
|
646
|
+
res: QueryResolution,
|
|
647
|
+
timestamps: Schema.Array(Schema.String),
|
|
648
|
+
levels: Schema.Struct({
|
|
649
|
+
error: Schema.Array(Schema.Finite),
|
|
650
|
+
warn: Schema.Array(Schema.Finite),
|
|
651
|
+
info: Schema.Array(Schema.Finite),
|
|
652
|
+
debug: Schema.Array(Schema.Finite),
|
|
653
|
+
system: Schema.Array(Schema.Finite),
|
|
654
|
+
}),
|
|
655
|
+
total: Schema.Finite,
|
|
656
|
+
facets: Schema.Struct({
|
|
657
|
+
level: Schema.Array(FacetCount),
|
|
658
|
+
stream: Schema.Array(FacetCount),
|
|
659
|
+
route: Schema.Array(FacetCount),
|
|
660
|
+
status: Schema.Array(FacetCount),
|
|
661
|
+
rev: Schema.Array(FacetCount),
|
|
662
|
+
}),
|
|
663
|
+
});
|
|
664
|
+
export type LogStatsResponse = typeof LogStatsResponse.Type;
|
|
665
|
+
|
|
666
|
+
/** A request or job that started a trace (its root line). */
|
|
667
|
+
export const TraceSummary = Schema.Struct({
|
|
668
|
+
trace: Schema.String,
|
|
669
|
+
/** When it started, ISO. */
|
|
670
|
+
ts: Schema.String,
|
|
671
|
+
kind: Schema.Literals(['req', 'job']),
|
|
672
|
+
/** `GET /api/items/:id` or `queue refresh`. */
|
|
673
|
+
name: Schema.String,
|
|
674
|
+
/** The HTTP status of a request. */
|
|
675
|
+
status: optional(Schema.Finite),
|
|
676
|
+
/** A 5xx request or a failed job. */
|
|
677
|
+
failed: Schema.Boolean,
|
|
678
|
+
dur: Schema.Finite,
|
|
679
|
+
/** Its spans were written (it failed, was slow, or its trace was sampled). */
|
|
680
|
+
recorded: Schema.Boolean,
|
|
681
|
+
/** Calls it made that weren't written. */
|
|
682
|
+
calls: optional(Schema.Finite),
|
|
683
|
+
rev: optional(Schema.String),
|
|
684
|
+
});
|
|
685
|
+
export type TraceSummary = typeof TraceSummary.Type;
|
|
686
|
+
|
|
687
|
+
export const TracesResponse = Schema.Struct({
|
|
688
|
+
traces: Schema.Array(TraceSummary),
|
|
689
|
+
/** More matched than `limit`; narrow the range or filters to see the rest. */
|
|
690
|
+
truncated: Schema.Boolean,
|
|
691
|
+
});
|
|
692
|
+
export type TracesResponse = typeof TracesResponse.Type;
|
|
693
|
+
|
|
694
|
+
export const InsightsRequest = Schema.Struct({
|
|
695
|
+
stage: optional(Schema.String),
|
|
696
|
+
/**
|
|
697
|
+
* A Logs Insights query (the Logs Insights language only). It runs on the
|
|
698
|
+
* stage's own log groups; one that picks its own (`SOURCE`) is refused.
|
|
699
|
+
*/
|
|
700
|
+
query: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(10_000)),
|
|
701
|
+
from: optional(Schema.String),
|
|
702
|
+
to: optional(Schema.String),
|
|
703
|
+
range: optional(Schema.String),
|
|
704
|
+
});
|
|
705
|
+
export type InsightsRequest = typeof InsightsRequest.Type;
|
|
706
|
+
|
|
707
|
+
export const InsightsResponse = Schema.Struct({
|
|
708
|
+
/** Result fields in the order the query produced them (hidden `@ptr` left out). */
|
|
709
|
+
columns: Schema.Array(Schema.String),
|
|
710
|
+
rows: Schema.Array(Schema.Array(Schema.NullOr(Schema.String))),
|
|
711
|
+
recordsMatched: Schema.Finite,
|
|
712
|
+
recordsScanned: Schema.Finite,
|
|
713
|
+
bytesScanned: Schema.Finite,
|
|
714
|
+
});
|
|
715
|
+
export type InsightsResponse = typeof InsightsResponse.Type;
|
|
716
|
+
|
|
717
|
+
/** An error group's events per bucket, and the deployments they happened on (Logs Insights). */
|
|
718
|
+
export const ErrorOccurrencesResponse = Schema.Struct({
|
|
719
|
+
res: QueryResolution,
|
|
720
|
+
timestamps: Schema.Array(Schema.String),
|
|
721
|
+
counts: Schema.Array(Schema.Finite),
|
|
722
|
+
revs: Schema.Array(FacetCount),
|
|
723
|
+
});
|
|
724
|
+
export type ErrorOccurrencesResponse = typeof ErrorOccurrencesResponse.Type;
|
|
725
|
+
|
|
726
|
+
/** One line of a series answer: a group's values (key `all` when ungrouped), one per timestamp. */
|
|
727
|
+
export const SeriesLine = Schema.Struct({
|
|
728
|
+
key: Schema.String,
|
|
729
|
+
values: Schema.Array(Schema.NullOr(Schema.Finite)),
|
|
730
|
+
});
|
|
731
|
+
export type SeriesLine = typeof SeriesLine.Type;
|
|
732
|
+
|
|
733
|
+
export const SeriesResponse = Schema.Struct({
|
|
734
|
+
res: QueryResolution,
|
|
735
|
+
/** Bucket start times, ISO, oldest first. */
|
|
736
|
+
timestamps: Schema.Array(Schema.String),
|
|
737
|
+
/** `count`, `per_second`, `percent`, `ms`, or a custom metric's own unit. */
|
|
738
|
+
unit: Schema.String,
|
|
739
|
+
series: Schema.Array(SeriesLine),
|
|
740
|
+
/** `stat: histogram`: per timestamp, the count in each latency bucket (`LATENCY_BUCKETS_MS`, then the overflow). */
|
|
741
|
+
histogram: optional(Schema.Array(Schema.Array(Schema.Finite))),
|
|
742
|
+
/** Why the answer differs from what was asked (coarser buckets past minute data's 3 days, groups cut to the top 10). */
|
|
743
|
+
note: optional(Schema.String),
|
|
744
|
+
});
|
|
745
|
+
export type SeriesResponse = typeof SeriesResponse.Type;
|
|
746
|
+
|
|
582
747
|
/** A GET of the stage's health path, for a stage that served nothing lately or has no server. */
|
|
583
748
|
export const UptimeCheck = Schema.Struct({
|
|
584
749
|
ts: Schema.String,
|
|
@@ -603,28 +768,6 @@ export type UptimeTraffic = typeof UptimeTraffic.Type;
|
|
|
603
768
|
export const UptimePoint = Schema.Union([UptimeCheck, UptimeTraffic]);
|
|
604
769
|
export type UptimePoint = typeof UptimePoint.Type;
|
|
605
770
|
|
|
606
|
-
/** Monthly cost of one container if it runs all month (`estimateContainerCost`). */
|
|
607
|
-
export const MonthlyContainerCost = Schema.Struct({
|
|
608
|
-
computeUsd: Schema.Finite,
|
|
609
|
-
publicIpv4Usd: Schema.Finite,
|
|
610
|
-
totalUsd: Schema.Finite,
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Something billed for as long as it runs, estimated from its size because
|
|
615
|
-
* Cost Explorer lags a day and doesn't attribute every part of it to the
|
|
616
|
-
* app (a container's public IPv4 address).
|
|
617
|
-
*/
|
|
618
|
-
export const AlwaysOnCost = Schema.Struct({
|
|
619
|
-
stage: Schema.String,
|
|
620
|
-
kind: Schema.Literal('service'),
|
|
621
|
-
name: Schema.String,
|
|
622
|
-
/** `0.25 vCPU · 512 MB · Spot`. */
|
|
623
|
-
detail: Schema.String,
|
|
624
|
-
monthly: MonthlyContainerCost,
|
|
625
|
-
});
|
|
626
|
-
export type AlwaysOnCost = typeof AlwaysOnCost.Type;
|
|
627
|
-
|
|
628
771
|
/** A non-preview stage's server: how it runs, and (prod) what each mode would cost. */
|
|
629
772
|
export const StageCompute = Schema.Struct({
|
|
630
773
|
stage: Schema.String,
|
|
@@ -641,8 +784,6 @@ export const CostResponse = Schema.Struct({
|
|
|
641
784
|
currency: Schema.Literal('USD'),
|
|
642
785
|
days: Schema.Array(Schema.Struct({ date: Schema.String, usd: Schema.Finite })),
|
|
643
786
|
monthToDateUsd: Schema.Finite,
|
|
644
|
-
/** Services of the app's non-preview stages (previews run theirs for minutes after a deploy). */
|
|
645
|
-
alwaysOn: optional(Schema.Array(AlwaysOnCost)),
|
|
646
787
|
/** Servers of the app's non-preview stages (previews run request mode). */
|
|
647
788
|
compute: optional(Schema.Array(StageCompute)),
|
|
648
789
|
});
|
|
@@ -715,80 +856,6 @@ export const UrlResponse = Schema.Struct({ url: Schema.String });
|
|
|
715
856
|
export type UrlResponse = typeof UrlResponse.Type;
|
|
716
857
|
|
|
717
858
|
export const CronRunResponse = Schema.Struct({ started: Schema.String });
|
|
718
|
-
|
|
719
|
-
// ---------------------------------------------------------------------------
|
|
720
|
-
// Long-running services
|
|
721
|
-
// ---------------------------------------------------------------------------
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* - `running`: every desired task is up and the latest rollout finished
|
|
725
|
-
* - `starting`: a rollout or replacement is under way
|
|
726
|
-
* - `failing`: tasks keep stopping before they settle, or the last rollout failed
|
|
727
|
-
* - `stopped`: scaled to zero (a preview past its minutes, or `plat services stop`)
|
|
728
|
-
*/
|
|
729
|
-
export const ServiceState = Schema.Literals(['running', 'starting', 'failing', 'stopped']);
|
|
730
|
-
export type ServiceState = typeof ServiceState.Type;
|
|
731
|
-
|
|
732
|
-
export const ServiceInfo = Schema.Struct({
|
|
733
|
-
name: Schema.String,
|
|
734
|
-
/** Size and capacity the live deployment declares. */
|
|
735
|
-
cpu: Schema.Finite,
|
|
736
|
-
memoryMb: Schema.Finite,
|
|
737
|
-
spot: Schema.Boolean,
|
|
738
|
-
state: ServiceState,
|
|
739
|
-
desired: Schema.Finite,
|
|
740
|
-
running: Schema.Finite,
|
|
741
|
-
pending: Schema.Finite,
|
|
742
|
-
/** Deployment whose build the service runs. */
|
|
743
|
-
deployment: optional(Schema.String),
|
|
744
|
-
/** When the current task started. */
|
|
745
|
-
startedAt: optional(Schema.String),
|
|
746
|
-
/** When a preview's stop schedule scales it to zero. */
|
|
747
|
-
stopsAt: optional(Schema.String),
|
|
748
|
-
/** The task that stopped most recently (ECS keeps stopped tasks for about an hour). */
|
|
749
|
-
lastStop: optional(
|
|
750
|
-
Schema.Struct({ at: Schema.String, reason: Schema.String, exitCode: optional(Schema.Finite) }),
|
|
751
|
-
),
|
|
752
|
-
/** Recent ECS service events, newest first. */
|
|
753
|
-
events: Schema.Array(Schema.Struct({ at: Schema.String, message: Schema.String })),
|
|
754
|
-
/** Containers started in the range: deploys, crashes, Spot replacements. */
|
|
755
|
-
starts: Schema.Finite,
|
|
756
|
-
/** Runs of `run` that failed and were rerun in the same container, in the range. */
|
|
757
|
-
failedRuns: Schema.Finite,
|
|
758
|
-
/** CPU and memory use, % of the task's size (ECS's per-service CloudWatch metrics). */
|
|
759
|
-
points: Schema.Array(
|
|
760
|
-
Schema.Struct({
|
|
761
|
-
ts: Schema.String,
|
|
762
|
-
cpu: Schema.NullOr(Schema.Finite),
|
|
763
|
-
memory: Schema.NullOr(Schema.Finite),
|
|
764
|
-
}),
|
|
765
|
-
),
|
|
766
|
-
/** If it ran all month. */
|
|
767
|
-
monthly: MonthlyContainerCost,
|
|
768
|
-
});
|
|
769
|
-
export type ServiceInfo = typeof ServiceInfo.Type;
|
|
770
|
-
|
|
771
|
-
export const ServicesResponse = Schema.Struct({
|
|
772
|
-
app: Schema.String,
|
|
773
|
-
stage: Schema.String,
|
|
774
|
-
res: Resolution,
|
|
775
|
-
services: Schema.Array(ServiceInfo),
|
|
776
|
-
});
|
|
777
|
-
export type ServicesResponse = typeof ServicesResponse.Type;
|
|
778
|
-
|
|
779
|
-
export const StartServiceRequest = Schema.Struct({
|
|
780
|
-
/** Stop it again after this many minutes. Previews default to the service's `previewMinutes`. */
|
|
781
|
-
minutes: optional(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 1440 }))),
|
|
782
|
-
});
|
|
783
|
-
export type StartServiceRequest = typeof StartServiceRequest.Encoded;
|
|
784
|
-
|
|
785
|
-
export const ServiceActionResponse = Schema.Struct({
|
|
786
|
-
name: Schema.String,
|
|
787
|
-
/** Tasks the service now asks for (1 running, 0 stopped). */
|
|
788
|
-
desired: Schema.Finite,
|
|
789
|
-
stopsAt: optional(Schema.String),
|
|
790
|
-
});
|
|
791
|
-
export type ServiceActionResponse = typeof ServiceActionResponse.Type;
|
|
792
859
|
export type CronRunResponse = typeof CronRunResponse.Type;
|
|
793
860
|
|
|
794
861
|
// ---------------------------------------------------------------------------
|
|
@@ -803,7 +870,6 @@ export const AdminOverview = Schema.Struct({
|
|
|
803
870
|
emailsPerDay: Schema.Finite,
|
|
804
871
|
edgeRequestsPerMinute: optional(Schema.Finite),
|
|
805
872
|
edgeFloorAt: optional(Schema.Finite),
|
|
806
|
-
servicesPerApp: Schema.Finite,
|
|
807
873
|
}),
|
|
808
874
|
apps: Schema.Finite,
|
|
809
875
|
stages: Schema.Finite,
|
package/src/config.ts
CHANGED
|
@@ -53,8 +53,6 @@ export interface PlatformConfig {
|
|
|
53
53
|
* this rate. Set both or neither; without them there is no floor.
|
|
54
54
|
*/
|
|
55
55
|
edgeFloorAt?: number;
|
|
56
|
-
/** Long-running services one stage's plat.config.ts may declare: the one resource billed while idle. */
|
|
57
|
-
servicesPerApp: number;
|
|
58
56
|
};
|
|
59
57
|
telemetry: { logRetentionDays: { prod: number; other: number } };
|
|
60
58
|
}
|