@mark1russell7/capacity 0.0.0-stage → 0.1.1

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1110 -2
  3. package/build/index.d.ts +858 -0
  4. package/build/index.d.ts.map +1 -0
  5. package/build/index.js +1713 -0
  6. package/build/index.js.map +1 -0
  7. package/build/instance-check-Bt-SI8va.js +1732 -0
  8. package/build/instance-check-Bt-SI8va.js.map +1 -0
  9. package/build/instance-sZmVOOvz.d.ts +801 -0
  10. package/build/instance-sZmVOOvz.d.ts.map +1 -0
  11. package/build/schema.d.ts +69 -0
  12. package/build/schema.d.ts.map +1 -0
  13. package/build/schema.js +325 -0
  14. package/build/schema.js.map +1 -0
  15. package/limits/alerts-routes.line.json +78 -0
  16. package/limits/alerts-scale.limits.json +10 -0
  17. package/limits/alerts-start-gate.limits.json +1149 -0
  18. package/limits/alerts-start-routes-limit-home.bracket.json +543 -0
  19. package/limits/alerts-start-routes-limit-mid.bracket.json +464 -0
  20. package/limits/alerts-start-routes-limit.bracket.json +579 -0
  21. package/limits/alerts-tail-gate.limits.json +610 -0
  22. package/package.json +85 -3
  23. package/src/app-check.ts +477 -0
  24. package/src/app-metrics.ts +105 -0
  25. package/src/app.ts +239 -0
  26. package/src/check.ts +253 -0
  27. package/src/composition.ts +680 -0
  28. package/src/demand.ts +312 -0
  29. package/src/fit.ts +153 -0
  30. package/src/forms.ts +358 -0
  31. package/src/gate.ts +237 -0
  32. package/src/index.ts +143 -0
  33. package/src/instance-check.ts +122 -0
  34. package/src/instance.ts +84 -0
  35. package/src/knee.ts +606 -0
  36. package/src/law.ts +236 -0
  37. package/src/limit.ts +112 -0
  38. package/src/names.ts +19 -0
  39. package/src/observe.ts +74 -0
  40. package/src/program.ts +74 -0
  41. package/src/scale.ts +617 -0
  42. package/src/schema.ts +263 -0
  43. package/src/value.ts +206 -0
  44. package/src/workload-check.ts +130 -0
  45. package/src/workload.ts +88 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance-sZmVOOvz.d.ts","names":[],"sources":["../src/law.ts","../src/value.ts","../src/workload.ts","../src/app.ts","../src/demand.ts","../src/composition.ts","../src/instance.ts"],"mappings":";;;;cAIa;;cAGA;;KAGD;;;;;;;;UASK;WACN;WACA;;;;;;UAOM;WACN;WACA;WACA;WACA;WACA,OAAO;;;UAID;WACN;WACA;;;;;;UAOM;WACN;WACA,SAAS;;;KAIR,6CAA6C;;;;;KAM7C;;UAGK;WACN;WACA;;;UAIM;WACN;WACA,OAAO;;;;;;UAOD;WACN;WACA,UAAU;WACV;WACA,iBAAiB;;;UAIX;WACN;WACA;WACA;;;;;;UAOM;WACN,MAAM,SAAS;WACf;;WAEA;;WAEA;;;UAIM;WACN,eAAe;;;;;;UAOT;;;;;WAKN;;WAEA;;WAEA,eAAe;;;;;;UAOT;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,UAAU,SAAS,eAAe;;;;;;;;;;;;;;;UAgB5B;WACN,eAAe;WACf;WACA;WACA;WACA,SAAS;WACT,oBAAoB;WACpB,YAAY,SAAS,eAAe;WACpC,MAAM;WACN,oBAAoB;WACpB;WACA,KAAK;WACL,kBAAkB;WAClB,UAAU;WACV,OAAO;WACP,OAAO;;;KAIN;;UAuBK,QAAQ;WACd,MAAM;WACN;WACA;;;KAIC,aAAa,QAAQ;;cAGpB;;;;;cAMA,aAAc;;;;;cAMd,iBAAkB;;;;;;;cAYlB,cAAe;;KChOhB,YAAY,SAAS;;UAGhB;WACN;WACA;;;UAIM;WACN;;;;;;;;;;UAWM;WACN;WACA;WACA;WACA,UAAU;WACV,KAAK;WACL;;;UAIM;WACN;WACA;WACA;WACA,UAAU;;;;;;;;;;;;cAyIR,WAAY,KAAK,KAAK,OAAO,WAAW,UAAS,iBAAoB,OAAO,UAAU;;;;;cAetF,oBAAqB,KAAK,KAAK,UAAS,iBAAoB,gBAAgB,oBAAoB;;cC7LhG;;cA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IF;WACN;WACA;;;KAIC,UAAU,gBAAgB;;;;;UAMrB;WACN;;WAEA;WACA,SAAS;WACT;;;UAIM;WACN,eAAe;WACf;WACA;WACA,iBAAiB;;;KAIhB;;KAGA,kBAAkB,QAAQ;;KAG1B;;KAGA,eAAe,QAAQ"}
@@ -0,0 +1,69 @@
1
+ import { Vt as LawProblem, Z as AppProblem, _ as Composition, a as InstanceProblem, f as LimitSet, l as Limit, q as AppContract, s as InstanceType, u as LimitProblem, xt as WorkloadProblem, y as CompositionProblem, yt as Workload, zt as Law } from "./instance-sZmVOOvz.js";
2
+ import { Result } from "@mark1russell7/optional";
3
+ import { z } from "zod";
4
+ /**
5
+ * This schema accepts the shape of a law file: each field with its type, and no other field. It
6
+ * does not examine what the fields mean. The function `checkLaw` does that.
7
+ */
8
+ export declare const lawSchema: z.ZodType<Law>;
9
+ /**
10
+ * This function reads a law from the data of a law file. It gives the law when the data has the
11
+ * shape of a law and `checkLaw` finds no problem. If not, it gives each problem.
12
+ */
13
+ export declare const readLaw: (data: unknown) => Result<Law, readonly LawProblem[]>;
14
+ /**
15
+ * This schema accepts the shape of a composition file: each field with its type, and no other
16
+ * field. It does not examine what the fields mean. The function `checkComposition` does that.
17
+ */
18
+ export declare const compositionSchema: z.ZodType<Composition>;
19
+ /**
20
+ * This function reads a composition from the data of a composition file. It gives the composition
21
+ * when the data has the shape of one and `checkComposition` finds no problem. If not, it gives each
22
+ * problem.
23
+ */
24
+ export declare const readComposition: (data: unknown) => Result<Composition, readonly CompositionProblem[]>;
25
+ /**
26
+ * This schema accepts the shape of a workload file: each field with its type, and no other field.
27
+ * It does not examine what the fields mean. The function `checkWorkload` does that.
28
+ */
29
+ export declare const workloadSchema: z.ZodType<Workload>;
30
+ /**
31
+ * This function reads a workload from the data of a workload file. It gives the workload when the
32
+ * data has the shape of a workload and `checkWorkload` finds no problem. If not, it gives each
33
+ * problem.
34
+ */
35
+ export declare const readWorkload: (data: unknown) => Result<Workload, readonly WorkloadProblem[]>;
36
+ /**
37
+ * This schema accepts the shape of an instance file: each field with its type, and no other field.
38
+ * It does not examine what the fields mean. The function `checkInstance` does that.
39
+ */
40
+ export declare const instanceSchema: z.ZodType<InstanceType>;
41
+ /**
42
+ * This function reads an instance type from the data of an instance file. It gives the instance
43
+ * type when the data has the shape of one and `checkInstance` finds no problem. If not, it gives
44
+ * each problem.
45
+ */
46
+ export declare const readInstance: (data: unknown) => Result<InstanceType, readonly InstanceProblem[]>;
47
+ /** This schema accepts the shape of one limit: each field with its type, and no other field. */
48
+ export declare const limitSchema: z.ZodType<Limit>;
49
+ /**
50
+ * This schema accepts the shape of a limits file: each field with its type, and no other field.
51
+ * It does not examine what the fields mean. The function `checkLimits` does that.
52
+ */
53
+ export declare const limitsSchema: z.ZodType<LimitSet>;
54
+ /**
55
+ * This function reads a limit set from the data of a limits file. It gives the limit set when the
56
+ * data has the shape of one and `checkLimits` finds no problem. If not, it gives each problem.
57
+ */
58
+ export declare const readLimits: (data: unknown) => Result<LimitSet, readonly LimitProblem[]>;
59
+ /**
60
+ * This schema accepts the shape of the contract file of an app: each field with its type, and no other
61
+ * field. It does not examine what the fields mean. The function `checkApp` does that.
62
+ */
63
+ export declare const appSchema: z.ZodType<AppContract>;
64
+ /**
65
+ * This function reads the contract of an app from the data of a contract file. It gives the contract when
66
+ * the data has the shape of one and `checkApp` finds no problem. If not, it gives each problem.
67
+ */
68
+ export declare const readApp: (data: unknown) => Result<AppContract, readonly AppProblem[]>;
69
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;;qBAmDa,WAAW,EAAE,QAAQ;;;;;qBAkCrB,UAAU,kBAAkB,OAAO,cAAc;;;;;qBAQjD,mBAAmB,EAAE,QAAQ;;;;;;qBAyB7B,kBAAkB,kBAAkB,OAAO,sBAAsB;;;;;qBAYjE,gBAAgB,EAAE,QAAQ;;;;;;qBAiB1B,eAAe,kBAAkB,OAAO,mBAAmB;;;;;qBAM3D,gBAAgB,EAAE,QAAQ;;;;;;qBAY1B,eAAe,kBAAkB,OAAO,uBAAuB;;qBAG/D,aAAa,EAAE,QAAQ;;;;;qBAcvB,cAAc,EAAE,QAAQ;;;;;qBAWxB,aAAa,kBAAkB,OAAO,mBAAmB;;;;;qBAkBzD,WAAW,EAAE,QAAQ;;;;;qBAmDrB,UAAU,kBAAkB,OAAO,sBAAsB"}
@@ -0,0 +1,325 @@
1
+ import { B as WORKLOAD_FORMAT, E as checkApp, F as checkWorkload, G as checkLaw, K as LAW_DOMAINS, N as APP_FORMAT, P as APP_LINE_KINDS, l as COMPOSITION_FORMAT, n as checkLimits, nt as LAW_FORMAT, o as INSTANCE_FORMAT, s as LIMITS_FORMAT, t as checkInstance, u as checkComposition } from "./instance-check-Bt-SI8va.js";
2
+ import { parse } from "@mark1russell7/vex";
3
+ import { err, ok } from "@mark1russell7/optional";
4
+ import { z } from "zod";
5
+ // src/schema.ts
6
+ /** This function tells if a value from JSON is a Vex expression. */
7
+ const isProgram = (value) => {
8
+ const text = JSON.stringify(value);
9
+ return text !== void 0 && parse(text, LAW_DOMAINS).ok;
10
+ };
11
+ /**
12
+ * This function makes the reader of a record. The reader examines the shape of the data with the
13
+ * schema, then it examines the meaning with `check`. It gives the record, or each problem.
14
+ */
15
+ const reader = (schema, check) => (data) => {
16
+ const shape = schema.safeParse(data);
17
+ if (!shape.success) return err(shape.error.issues.map((issue) => ({
18
+ code: "shape",
19
+ path: issue.path.join("."),
20
+ message: issue.message
21
+ })));
22
+ const problems = check(shape.data);
23
+ return problems.length > 0 ? err(problems) : ok(shape.data);
24
+ };
25
+ const fitErrorSchema = z.strictObject({
26
+ mae: z.number(),
27
+ rmse: z.number()
28
+ });
29
+ const runSchema = z.strictObject({
30
+ url: z.string(),
31
+ commit: z.string(),
32
+ date: z.string()
33
+ });
34
+ /**
35
+ * This schema accepts the shape of a law file: each field with its type, and no other field. It
36
+ * does not examine what the fields mean. The function `checkLaw` does that.
37
+ */
38
+ const lawSchema = z.strictObject({
39
+ format: z.literal(LAW_FORMAT),
40
+ id: z.string(),
41
+ title: z.string(),
42
+ subject: z.string(),
43
+ measure: z.strictObject({
44
+ id: z.string(),
45
+ unit: z.string()
46
+ }),
47
+ variables: z.array(z.strictObject({
48
+ id: z.string(),
49
+ unit: z.string(),
50
+ min: z.number(),
51
+ max: z.number(),
52
+ scale: z.enum(["linear", "log"])
53
+ })),
54
+ conditions: z.record(z.string(), z.union([
55
+ z.string(),
56
+ z.number(),
57
+ z.boolean(),
58
+ z.strictObject({
59
+ value: z.number(),
60
+ unit: z.string()
61
+ })
62
+ ])),
63
+ form: z.strictObject({
64
+ id: z.string(),
65
+ program: z.custom(isProgram, "The program is not a Vex expression.")
66
+ }),
67
+ constants: z.array(z.strictObject({
68
+ id: z.string(),
69
+ value: z.number()
70
+ })),
71
+ replicates: z.array(z.array(z.number())),
72
+ fit: z.strictObject({
73
+ method: z.string(),
74
+ residual: z.enum(["absolute", "relative"]),
75
+ residuals: z.array(z.number()),
76
+ losers: z.array(z.strictObject({
77
+ form: z.string(),
78
+ error: fitErrorSchema
79
+ }))
80
+ }),
81
+ points: z.array(z.strictObject({
82
+ load: z.record(z.string(), z.number()),
83
+ value: z.number(),
84
+ run: z.number(),
85
+ job: z.string()
86
+ })).exactOptional(),
87
+ evidence: z.strictObject({ runs: z.array(runSchema) }),
88
+ noise: z.strictObject({
89
+ floor: z.number(),
90
+ cpu: z.string(),
91
+ runs: z.array(runSchema)
92
+ }),
93
+ idle: z.strictObject({
94
+ load: z.string(),
95
+ cpu: z.string(),
96
+ bases: z.number(),
97
+ runs: z.number(),
98
+ measures: z.record(z.string(), z.strictObject({
99
+ value: z.number(),
100
+ unit: z.string()
101
+ }))
102
+ }).exactOptional()
103
+ });
104
+ /**
105
+ * This function reads a law from the data of a law file. It gives the law when the data has the
106
+ * shape of a law and `checkLaw` finds no problem. If not, it gives each problem.
107
+ */
108
+ const readLaw = reader(lawSchema, checkLaw);
109
+ const factorSchema = z.number().optional();
110
+ /**
111
+ * This schema accepts the shape of a composition file: each field with its type, and no other
112
+ * field. It does not examine what the fields mean. The function `checkComposition` does that.
113
+ */
114
+ const compositionSchema = z.strictObject({
115
+ format: z.literal(COMPOSITION_FORMAT),
116
+ id: z.string(),
117
+ title: z.string(),
118
+ subject: z.string(),
119
+ measure: z.strictObject({
120
+ id: z.string(),
121
+ unit: z.string()
122
+ }),
123
+ terms: z.array(z.union([z.strictObject({
124
+ law: z.string(),
125
+ over: z.union([
126
+ z.literal("instance"),
127
+ z.literal("each"),
128
+ z.array(z.string())
129
+ ]),
130
+ load: z.enum(["class", "total"]).optional(),
131
+ factor: factorSchema,
132
+ base: z.lazy(() => amountsSchema).optional()
133
+ }), z.strictObject({
134
+ composition: z.string(),
135
+ factor: factorSchema
136
+ })]))
137
+ });
138
+ /**
139
+ * This function reads a composition from the data of a composition file. It gives the composition
140
+ * when the data has the shape of one and `checkComposition` finds no problem. If not, it gives each
141
+ * problem.
142
+ */
143
+ const readComposition = reader(compositionSchema, checkComposition);
144
+ const amountSchema = z.strictObject({
145
+ value: z.number(),
146
+ unit: z.string()
147
+ });
148
+ const amountsSchema = z.record(z.string(), amountSchema);
149
+ /**
150
+ * This schema accepts the shape of a workload file: each field with its type, and no other field.
151
+ * It does not examine what the fields mean. The function `checkWorkload` does that.
152
+ */
153
+ const workloadSchema = z.strictObject({
154
+ format: z.literal(WORKLOAD_FORMAT),
155
+ id: z.string(),
156
+ title: z.string(),
157
+ classes: z.array(z.strictObject({
158
+ id: z.string(),
159
+ of: z.string().optional(),
160
+ rate: amountSchema,
161
+ request: amountsSchema
162
+ })),
163
+ levels: amountsSchema,
164
+ source: z.discriminatedUnion("kind", [z.strictObject({
165
+ kind: z.literal("plan"),
166
+ note: z.string()
167
+ }), z.strictObject({
168
+ kind: z.literal("metrics"),
169
+ origin: z.string(),
170
+ from: z.string(),
171
+ to: z.string()
172
+ })])
173
+ });
174
+ /**
175
+ * This function reads a workload from the data of a workload file. It gives the workload when the
176
+ * data has the shape of a workload and `checkWorkload` finds no problem. If not, it gives each
177
+ * problem.
178
+ */
179
+ const readWorkload = reader(workloadSchema, checkWorkload);
180
+ /**
181
+ * This schema accepts the shape of an instance file: each field with its type, and no other field.
182
+ * It does not examine what the fields mean. The function `checkInstance` does that.
183
+ */
184
+ const instanceSchema = z.strictObject({
185
+ format: z.literal(INSTANCE_FORMAT),
186
+ id: z.string(),
187
+ title: z.string(),
188
+ resources: amountsSchema
189
+ });
190
+ /**
191
+ * This function reads an instance type from the data of an instance file. It gives the instance
192
+ * type when the data has the shape of one and `checkInstance` finds no problem. If not, it gives
193
+ * each problem.
194
+ */
195
+ const readInstance = reader(instanceSchema, checkInstance);
196
+ /** This schema accepts the shape of one limit: each field with its type, and no other field. */
197
+ const limitSchema = z.strictObject({
198
+ id: z.string(),
199
+ measure: z.string(),
200
+ ceiling: z.discriminatedUnion("kind", [z.strictObject({
201
+ kind: z.literal("amount"),
202
+ amount: amountSchema
203
+ }), z.strictObject({
204
+ kind: z.literal("resource"),
205
+ resource: z.string()
206
+ })]),
207
+ headroom: z.number()
208
+ });
209
+ /**
210
+ * This schema accepts the shape of a limits file: each field with its type, and no other field.
211
+ * It does not examine what the fields mean. The function `checkLimits` does that.
212
+ */
213
+ const limitsSchema = z.strictObject({
214
+ format: z.literal(LIMITS_FORMAT),
215
+ id: z.string(),
216
+ title: z.string(),
217
+ limits: z.array(limitSchema)
218
+ });
219
+ /**
220
+ * This function reads a limit set from the data of a limits file. It gives the limit set when the
221
+ * data has the shape of one and `checkLimits` finds no problem. If not, it gives each problem.
222
+ */
223
+ const readLimits = reader(limitsSchema, checkLimits);
224
+ const scaleSchema = z.enum(["linear", "log"]);
225
+ const rangeFields = {
226
+ unit: z.string(),
227
+ min: z.number(),
228
+ max: z.number(),
229
+ scale: scaleSchema
230
+ };
231
+ const commandFields = {
232
+ argv: z.array(z.string()),
233
+ cwd: z.string(),
234
+ env: z.record(z.string(), z.string())
235
+ };
236
+ const commandSchema = z.strictObject(commandFields);
237
+ const processSchema = z.strictObject({
238
+ ...commandFields,
239
+ ready: z.discriminatedUnion("kind", [z.strictObject({
240
+ kind: z.literal("line"),
241
+ text: z.string()
242
+ }), z.strictObject({
243
+ kind: z.literal("http"),
244
+ path: z.string()
245
+ })])
246
+ });
247
+ /**
248
+ * This schema accepts the shape of the contract file of an app: each field with its type, and no other
249
+ * field. It does not examine what the fields mean. The function `checkApp` does that.
250
+ */
251
+ const appSchema = z.strictObject({
252
+ format: z.literal(APP_FORMAT),
253
+ id: z.string(),
254
+ title: z.string(),
255
+ repository: z.string(),
256
+ variables: z.array(z.strictObject({
257
+ id: z.string(),
258
+ title: z.string(),
259
+ kind: z.enum([
260
+ "request",
261
+ "level",
262
+ "store",
263
+ "run"
264
+ ]),
265
+ ...rangeFields
266
+ })),
267
+ classes: z.array(z.strictObject({
268
+ id: z.string(),
269
+ title: z.string(),
270
+ rate: z.strictObject(rangeFields),
271
+ request: z.array(z.string()),
272
+ entry: z.discriminatedUnion("kind", [z.strictObject({
273
+ kind: z.literal("http"),
274
+ method: z.enum([
275
+ "GET",
276
+ "POST",
277
+ "PUT",
278
+ "PATCH",
279
+ "DELETE"
280
+ ]),
281
+ path: z.string(),
282
+ body: z.string().optional()
283
+ }), z.strictObject({
284
+ kind: z.literal("service"),
285
+ service: z.string()
286
+ })])
287
+ })),
288
+ start: z.strictObject({
289
+ install: commandSchema.optional(),
290
+ check: commandSchema.optional(),
291
+ seed: commandSchema.optional(),
292
+ run: processSchema.extend({ lines: z.array(z.strictObject({
293
+ kind: z.enum(APP_LINE_KINDS),
294
+ ev: z.string(),
295
+ title: z.string()
296
+ })).optional() })
297
+ }),
298
+ services: z.array(z.strictObject({
299
+ id: z.string(),
300
+ title: z.string(),
301
+ fake: processSchema
302
+ })),
303
+ metrics: z.array(z.strictObject({
304
+ id: z.string(),
305
+ kind: z.enum(["counter", "gauge"]),
306
+ unit: z.string(),
307
+ of: z.union([
308
+ z.strictObject({ rate: z.string() }),
309
+ z.strictObject({ level: z.string() }),
310
+ z.strictObject({
311
+ total: z.string(),
312
+ class: z.string()
313
+ }),
314
+ z.strictObject({ measure: z.string() })
315
+ ])
316
+ }))
317
+ });
318
+ /**
319
+ * This function reads the contract of an app from the data of a contract file. It gives the contract when
320
+ * the data has the shape of one and `checkApp` finds no problem. If not, it gives each problem.
321
+ */
322
+ const readApp = reader(appSchema, checkApp);
323
+ export { appSchema, compositionSchema, instanceSchema, lawSchema, limitSchema, limitsSchema, readApp, readComposition, readInstance, readLaw, readLimits, readWorkload, workloadSchema };
324
+
325
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { err, ok, type Result } from \"@mark1russell7/optional\";\nimport { parse, type Expr } from \"@mark1russell7/vex\";\nimport { z } from \"zod\";\nimport { checkApp } from \"./app-check.ts\";\nimport { APP_FORMAT, APP_LINE_KINDS, type AppContract, type AppProblem } from \"./app.ts\";\nimport { checkLaw } from \"./check.ts\";\nimport { COMPOSITION_FORMAT, checkComposition, type Composition, type CompositionProblem } from \"./composition.ts\";\nimport { checkInstance, checkLimits } from \"./instance-check.ts\";\nimport {\n INSTANCE_FORMAT,\n LIMITS_FORMAT,\n type InstanceProblem,\n type InstanceType,\n type Limit,\n type LimitProblem,\n type LimitSet,\n} from \"./instance.ts\";\nimport { LAW_FORMAT, type Law, type LawProblem, type Problem } from \"./law.ts\";\nimport { LAW_DOMAINS } from \"./program.ts\";\nimport { checkWorkload } from \"./workload-check.ts\";\nimport { WORKLOAD_FORMAT, type Workload, type WorkloadProblem } from \"./workload.ts\";\n\n/** This function tells if a value from JSON is a Vex expression. */\nconst isProgram = (value: unknown): boolean => {\n const text = JSON.stringify(value);\n return text !== undefined && parse(text, LAW_DOMAINS).ok;\n};\n\n/**\n * This function makes the reader of a record. The reader examines the shape of the data with the\n * schema, then it examines the meaning with `check`. It gives the record, or each problem.\n */\nconst reader =\n <T, Code extends string>(schema: z.ZodType<T>, check: (record: T) => readonly Problem<Code>[]) =>\n (data: unknown): Result<T, readonly Problem<Code | \"shape\">[]> => {\n const shape = schema.safeParse(data);\n if (!shape.success) {\n return err(shape.error.issues.map((issue) => ({ code: \"shape\", path: issue.path.join(\".\"), message: issue.message })));\n }\n const problems = check(shape.data);\n return problems.length > 0 ? err(problems) : ok(shape.data);\n };\n\nconst fitErrorSchema = z.strictObject({ mae: z.number(), rmse: z.number() });\n\nconst runSchema = z.strictObject({ url: z.string(), commit: z.string(), date: z.string() });\n\n/**\n * This schema accepts the shape of a law file: each field with its type, and no other field. It\n * does not examine what the fields mean. The function `checkLaw` does that.\n */\nexport const lawSchema: z.ZodType<Law> = z.strictObject({\n format: z.literal(LAW_FORMAT),\n id: z.string(),\n title: z.string(),\n subject: z.string(),\n measure: z.strictObject({ id: z.string(), unit: z.string() }),\n variables: z.array(\n z.strictObject({ id: z.string(), unit: z.string(), min: z.number(), max: z.number(), scale: z.enum([\"linear\", \"log\"]) }),\n ),\n conditions: z.record(\n z.string(),\n z.union([z.string(), z.number(), z.boolean(), z.strictObject({ value: z.number(), unit: z.string() })]),\n ),\n form: z.strictObject({ id: z.string(), program: z.custom<Expr>(isProgram, \"The program is not a Vex expression.\") }),\n constants: z.array(z.strictObject({ id: z.string(), value: z.number() })),\n replicates: z.array(z.array(z.number())),\n fit: z.strictObject({\n method: z.string(),\n residual: z.enum([\"absolute\", \"relative\"]),\n residuals: z.array(z.number()),\n losers: z.array(z.strictObject({ form: z.string(), error: fitErrorSchema })),\n }),\n points: z.array(z.strictObject({ load: z.record(z.string(), z.number()), value: z.number(), run: z.number(), job: z.string() })).exactOptional(),\n evidence: z.strictObject({ runs: z.array(runSchema) }),\n noise: z.strictObject({ floor: z.number(), cpu: z.string(), runs: z.array(runSchema) }),\n idle: z\n .strictObject({ load: z.string(), cpu: z.string(), bases: z.number(), runs: z.number(), measures: z.record(z.string(), z.strictObject({ value: z.number(), unit: z.string() })) })\n .exactOptional(),\n});\n\n/**\n * This function reads a law from the data of a law file. It gives the law when the data has the\n * shape of a law and `checkLaw` finds no problem. If not, it gives each problem.\n */\nexport const readLaw: (data: unknown) => Result<Law, readonly LawProblem[]> = reader(lawSchema, checkLaw);\n\nconst factorSchema = z.number().optional();\n\n/**\n * This schema accepts the shape of a composition file: each field with its type, and no other\n * field. It does not examine what the fields mean. The function `checkComposition` does that.\n */\nexport const compositionSchema: z.ZodType<Composition> = z.strictObject({\n format: z.literal(COMPOSITION_FORMAT),\n id: z.string(),\n title: z.string(),\n subject: z.string(),\n measure: z.strictObject({ id: z.string(), unit: z.string() }),\n terms: z.array(\n z.union([\n z.strictObject({\n law: z.string(),\n over: z.union([z.literal(\"instance\"), z.literal(\"each\"), z.array(z.string())]),\n load: z.enum([\"class\", \"total\"]).optional(),\n factor: factorSchema,\n base: z.lazy(() => amountsSchema).optional(),\n }),\n z.strictObject({ composition: z.string(), factor: factorSchema }),\n ]),\n ),\n});\n\n/**\n * This function reads a composition from the data of a composition file. It gives the composition\n * when the data has the shape of one and `checkComposition` finds no problem. If not, it gives each\n * problem.\n */\nexport const readComposition: (data: unknown) => Result<Composition, readonly CompositionProblem[]> = reader(\n compositionSchema,\n checkComposition,\n);\n\nconst amountSchema = z.strictObject({ value: z.number(), unit: z.string() });\nconst amountsSchema = z.record(z.string(), amountSchema);\n\n/**\n * This schema accepts the shape of a workload file: each field with its type, and no other field.\n * It does not examine what the fields mean. The function `checkWorkload` does that.\n */\nexport const workloadSchema: z.ZodType<Workload> = z.strictObject({\n format: z.literal(WORKLOAD_FORMAT),\n id: z.string(),\n title: z.string(),\n classes: z.array(z.strictObject({ id: z.string(), of: z.string().optional(), rate: amountSchema, request: amountsSchema })),\n levels: amountsSchema,\n source: z.discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"plan\"), note: z.string() }),\n z.strictObject({ kind: z.literal(\"metrics\"), origin: z.string(), from: z.string(), to: z.string() }),\n ]),\n});\n\n/**\n * This function reads a workload from the data of a workload file. It gives the workload when the\n * data has the shape of a workload and `checkWorkload` finds no problem. If not, it gives each\n * problem.\n */\nexport const readWorkload: (data: unknown) => Result<Workload, readonly WorkloadProblem[]> = reader(workloadSchema, checkWorkload);\n\n/**\n * This schema accepts the shape of an instance file: each field with its type, and no other field.\n * It does not examine what the fields mean. The function `checkInstance` does that.\n */\nexport const instanceSchema: z.ZodType<InstanceType> = z.strictObject({\n format: z.literal(INSTANCE_FORMAT),\n id: z.string(),\n title: z.string(),\n resources: amountsSchema,\n});\n\n/**\n * This function reads an instance type from the data of an instance file. It gives the instance\n * type when the data has the shape of one and `checkInstance` finds no problem. If not, it gives\n * each problem.\n */\nexport const readInstance: (data: unknown) => Result<InstanceType, readonly InstanceProblem[]> = reader(instanceSchema, checkInstance);\n\n/** This schema accepts the shape of one limit: each field with its type, and no other field. */\nexport const limitSchema: z.ZodType<Limit> = z.strictObject({\n id: z.string(),\n measure: z.string(),\n ceiling: z.discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"amount\"), amount: amountSchema }),\n z.strictObject({ kind: z.literal(\"resource\"), resource: z.string() }),\n ]),\n headroom: z.number(),\n});\n\n/**\n * This schema accepts the shape of a limits file: each field with its type, and no other field.\n * It does not examine what the fields mean. The function `checkLimits` does that.\n */\nexport const limitsSchema: z.ZodType<LimitSet> = z.strictObject({\n format: z.literal(LIMITS_FORMAT),\n id: z.string(),\n title: z.string(),\n limits: z.array(limitSchema),\n});\n\n/**\n * This function reads a limit set from the data of a limits file. It gives the limit set when the\n * data has the shape of one and `checkLimits` finds no problem. If not, it gives each problem.\n */\nexport const readLimits: (data: unknown) => Result<LimitSet, readonly LimitProblem[]> = reader(limitsSchema, checkLimits);\n\nconst scaleSchema = z.enum([\"linear\", \"log\"]);\nconst rangeFields = { unit: z.string(), min: z.number(), max: z.number(), scale: scaleSchema };\nconst commandFields = { argv: z.array(z.string()), cwd: z.string(), env: z.record(z.string(), z.string()) };\nconst commandSchema = z.strictObject(commandFields);\nconst processSchema = z.strictObject({\n ...commandFields,\n ready: z.discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"line\"), text: z.string() }),\n z.strictObject({ kind: z.literal(\"http\"), path: z.string() }),\n ]),\n});\n\n/**\n * This schema accepts the shape of the contract file of an app: each field with its type, and no other\n * field. It does not examine what the fields mean. The function `checkApp` does that.\n */\nexport const appSchema: z.ZodType<AppContract> = z.strictObject({\n format: z.literal(APP_FORMAT),\n id: z.string(),\n title: z.string(),\n repository: z.string(),\n variables: z.array(z.strictObject({ id: z.string(), title: z.string(), kind: z.enum([\"request\", \"level\", \"store\", \"run\"]), ...rangeFields })),\n classes: z.array(\n z.strictObject({\n id: z.string(),\n title: z.string(),\n rate: z.strictObject(rangeFields),\n request: z.array(z.string()),\n entry: z.discriminatedUnion(\"kind\", [\n z.strictObject({\n kind: z.literal(\"http\"),\n method: z.enum([\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"]),\n path: z.string(),\n body: z.string().optional(),\n }),\n z.strictObject({ kind: z.literal(\"service\"), service: z.string() }),\n ]),\n }),\n ),\n start: z.strictObject({\n install: commandSchema.optional(),\n check: commandSchema.optional(),\n seed: commandSchema.optional(),\n run: processSchema.extend({\n lines: z.array(z.strictObject({ kind: z.enum(APP_LINE_KINDS), ev: z.string(), title: z.string() })).optional(),\n }),\n }),\n services: z.array(z.strictObject({ id: z.string(), title: z.string(), fake: processSchema })),\n metrics: z.array(\n z.strictObject({\n id: z.string(),\n kind: z.enum([\"counter\", \"gauge\"]),\n unit: z.string(),\n of: z.union([\n z.strictObject({ rate: z.string() }),\n z.strictObject({ level: z.string() }),\n z.strictObject({ total: z.string(), class: z.string() }),\n z.strictObject({ measure: z.string() }),\n ]),\n }),\n ),\n});\n\n/**\n * This function reads the contract of an app from the data of a contract file. It gives the contract when\n * the data has the shape of one and `checkApp` finds no problem. If not, it gives each problem.\n */\nexport const readApp: (data: unknown) => Result<AppContract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,EAAE,QAAQ,SAAS;GAAG,SAAS,EAAE,OAAO;EAAE,CAAC,CACpE,CAAC;CACH,CAAC,CACH;CACA,OAAO,EAAE,aAAa;EACpB,SAAS,cAAc,SAAS;EAChC,OAAO,cAAc,SAAS;EAC9B,MAAM,cAAc,SAAS;EAC7B,KAAK,cAAc,OAAO,EACxB,OAAO,EAAE,MAAM,EAAE,aAAa;GAAE,MAAM,EAAE,KAAK,cAAc;GAAG,IAAI,EAAE,OAAO;GAAG,OAAO,EAAE,OAAO;EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAC/G,CAAC;CACH,CAAC;CACD,UAAU,EAAE,MAAM,EAAE,aAAa;EAAE,IAAI,EAAE,OAAO;EAAG,OAAO,EAAE,OAAO;EAAG,MAAM;CAAc,CAAC,CAAC;CAC5F,SAAS,EAAE,MACT,EAAE,aAAa;EACb,IAAI,EAAE,OAAO;EACb,MAAM,EAAE,KAAK,CAAC,WAAW,OAAO,CAAC;EACjC,MAAM,EAAE,OAAO;EACf,IAAI,EAAE,MAAM;GACV,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;GACnC,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;GACpC,EAAE,aAAa;IAAE,OAAO,EAAE,OAAO;IAAG,OAAO,EAAE,OAAO;GAAE,CAAC;GACvD,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;EACxC,CAAC;CACH,CAAC,CACH;AACF,CAAC;;;;;AAMD,MAAa,UAAyE,OAAO,WAAW,QAAQ"}
@@ -0,0 +1,78 @@
1
+ {
2
+ "format": "capacity-line/1",
3
+ "id": "alerts-routes",
4
+ "title": "The routes line of alerts: the largest routes that start with the heap headroom, at each heap limit",
5
+ "brackets": [
6
+ "alerts-start-routes-limit",
7
+ "alerts-start-routes-limit-mid",
8
+ "alerts-start-routes-limit-home"
9
+ ],
10
+ "limits": "alerts-scale",
11
+ "limit": "heap",
12
+ "variable": {
13
+ "id": "routes",
14
+ "unit": "{route}"
15
+ },
16
+ "measure": {
17
+ "id": "heapPeak",
18
+ "unit": "B"
19
+ },
20
+ "unit": "B",
21
+ "headroom": 0.2,
22
+ "points": [
23
+ {
24
+ "plan": "alerts-start-routes-limit",
25
+ "ceiling": 556269568,
26
+ "cpus": [
27
+ "AMD EPYC 7763 64-Core Processor",
28
+ "AMD EPYC 9V45 96-Core Processor",
29
+ "AMD EPYC 9V74 80-Core Processor",
30
+ "INTEL(R) XEON(R) PLATINUM 8573C",
31
+ "Intel(R) Xeon(R) 6975P-C"
32
+ ],
33
+ "hold": 60480,
34
+ "held": "persons-60-incidents-1000",
35
+ "fail": 68000,
36
+ "failed": [
37
+ "persons-1000-incidents-60",
38
+ "persons-70-incidents-1000"
39
+ ]
40
+ },
41
+ {
42
+ "plan": "alerts-start-routes-limit-mid",
43
+ "ceiling": 1174405120,
44
+ "cpus": [
45
+ "AMD EPYC 7763 64-Core Processor",
46
+ "AMD EPYC 9V45 96-Core Processor",
47
+ "AMD EPYC 9V74 80-Core Processor",
48
+ "Intel(R) Xeon(R) 6975P-C"
49
+ ],
50
+ "hold": 183000,
51
+ "held": "persons-1000-incidents-175",
52
+ "fail": 201600,
53
+ "failed": [
54
+ "persons-1000-incidents-200",
55
+ "persons-200-incidents-1000"
56
+ ]
57
+ },
58
+ {
59
+ "plan": "alerts-start-routes-limit-home",
60
+ "ceiling": 2348810240,
61
+ "cpus": [
62
+ "AMD EPYC 7763 64-Core Processor",
63
+ "AMD EPYC 9V45 96-Core Processor",
64
+ "INTEL(R) XEON(R) PLATINUM 8573C",
65
+ "Intel(R) Xeon(R) 6975P-C",
66
+ "Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz"
67
+ ],
68
+ "hold": 408000,
69
+ "held": "persons-1000-incidents-400",
70
+ "fail": 458000,
71
+ "failed": [
72
+ "persons-1000-incidents-450",
73
+ "persons-1000-incidents-500",
74
+ "persons-500-incidents-1000"
75
+ ]
76
+ }
77
+ ]
78
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "format": "capacity-limits/1",
3
+ "id": "alerts-scale",
4
+ "title": "The limits of one copy of alerts for its scale rule",
5
+ "limits": [
6
+ { "id": "cpu", "measure": "cpu", "ceiling": { "kind": "resource", "resource": "cpu" }, "headroom": 0.3 },
7
+ { "id": "memory", "measure": "memory", "ceiling": { "kind": "resource", "resource": "memory" }, "headroom": 0.2 },
8
+ { "id": "heap", "measure": "heap", "ceiling": { "kind": "resource", "resource": "heap" }, "headroom": 0.2 }
9
+ ]
10
+ }