@substrat-run/control-plane-api 0.124.0 → 0.126.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/aggregate-reads.d.ts +67 -0
- package/dist/aggregate-reads.d.ts.map +1 -0
- package/dist/aggregate-reads.js +186 -0
- package/dist/aggregate-reads.js.map +1 -0
- package/dist/aggregate-source.d.ts +125 -0
- package/dist/aggregate-source.d.ts.map +1 -0
- package/dist/aggregate-source.js +134 -0
- package/dist/aggregate-source.js.map +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +63 -18
- package/dist/api.js.map +1 -1
- package/dist/cf-observability.d.ts +7 -0
- package/dist/cf-observability.d.ts.map +1 -1
- package/dist/cf-observability.js +316 -214
- package/dist/cf-observability.js.map +1 -1
- package/dist/cube-store-sql.d.ts +34 -0
- package/dist/cube-store-sql.d.ts.map +1 -0
- package/dist/cube-store-sql.js +74 -0
- package/dist/cube-store-sql.js.map +1 -0
- package/dist/deploy.d.ts +1 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +1 -1
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/observability.d.ts +16 -0
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js.map +1 -1
- package/dist/tenant-request-query.d.ts +21 -0
- package/dist/tenant-request-query.d.ts.map +1 -1
- package/dist/tenant-request-query.js +27 -0
- package/dist/tenant-request-query.js.map +1 -1
- package/dist/vertical-client.d.ts +6 -1
- package/dist/vertical-client.d.ts.map +1 -1
- package/dist/vertical-client.js +17 -3
- package/dist/vertical-client.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The aggregate reads, computed ONCE from cubes (#1877) — the request histogram, the
|
|
3
|
+
* facet counts and the log patterns, whatever source produced the cubes.
|
|
4
|
+
*
|
|
5
|
+
* Pure, so the semantics the routes promise are held here and nowhere else, and the
|
|
6
|
+
* contract suite can drive them over any `AggregateSource`:
|
|
7
|
+
*
|
|
8
|
+
* - **the tenant, and the scope when one is named, are applied first** — a cube carries
|
|
9
|
+
* every tenant of its service, and no other tenant's row may reach an answer;
|
|
10
|
+
* - a facet is counted with every OTHER filter applied and its own left out;
|
|
11
|
+
* - a line with no `level` is `unrecorded`, counted and never dropped;
|
|
12
|
+
* - a pattern's share is of every matching `ctx.log` line, not only the listed ones;
|
|
13
|
+
* - `estimated` is carried through from any sampled part of a cube.
|
|
14
|
+
*/
|
|
15
|
+
import { type AggregateSource, type Cube, type PatternCubeRow, type RequestCubeRow } from './aggregate-source.js';
|
|
16
|
+
import { type LogPatterns, type RequestFacetKey, type RequestFacets, type RequestVolume, type RequestWhere, type ObservabilityReader } from './observability.js';
|
|
17
|
+
/** Who and what a read is about — the tenant is the narrowing, never widened. */
|
|
18
|
+
export interface AggregateScope {
|
|
19
|
+
tenantId: string;
|
|
20
|
+
scopeId?: string | undefined;
|
|
21
|
+
where?: RequestWhere | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The width a histogram's bars are drawn at: the asked-for count over the window, never
|
|
25
|
+
* finer than the cube's grain, and a whole number of grains so no grain is split.
|
|
26
|
+
*/
|
|
27
|
+
export declare function barWidth(span: number, buckets: number, grainMs: number): number;
|
|
28
|
+
/** The request histogram: per-level counts per bar, bars with no requests left out. */
|
|
29
|
+
export declare function volumeFrom(cube: Cube<RequestCubeRow>, scope: AggregateScope & {
|
|
30
|
+
from: number;
|
|
31
|
+
to: number;
|
|
32
|
+
buckets: number;
|
|
33
|
+
grainMs: number;
|
|
34
|
+
}): RequestVolume;
|
|
35
|
+
/** Facet counts: each facet with every other filter applied and its own left out. */
|
|
36
|
+
export declare function facetsFrom(cube: Cube<RequestCubeRow>, scope: AggregateScope & {
|
|
37
|
+
keys?: readonly RequestFacetKey[] | undefined;
|
|
38
|
+
}): RequestFacets;
|
|
39
|
+
/** `ctx.log` lines grouped by template: count, share, level split, and a small histogram. */
|
|
40
|
+
export declare function patternsFrom(cube: Cube<PatternCubeRow>, scope: {
|
|
41
|
+
tenantId: string;
|
|
42
|
+
scopeId?: string | undefined;
|
|
43
|
+
from: number;
|
|
44
|
+
to: number;
|
|
45
|
+
buckets: number;
|
|
46
|
+
grainMs: number;
|
|
47
|
+
level?: readonly string[] | undefined;
|
|
48
|
+
operation?: readonly string[] | undefined;
|
|
49
|
+
}): LogPatterns;
|
|
50
|
+
/** Cubes for several services, as one — a tenant's app can be served by more than one. */
|
|
51
|
+
export declare function mergeCubes<R>(cubes: readonly Cube<R>[]): Cube<R>;
|
|
52
|
+
/** The window aligned outward to whole grains, so no grain is half in and half out. */
|
|
53
|
+
export declare function alignWindow(from: number, to: number, grainMs: number): {
|
|
54
|
+
from: number;
|
|
55
|
+
to: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The three aggregate reads of `ObservabilityReader`, over any source (#1877). An adapter
|
|
59
|
+
* binds its reads to this rather than computing them itself, so every source — the
|
|
60
|
+
* telemetry query, a cache of it, a future store — answers with the same semantics, and
|
|
61
|
+
* the contract suite holds one implementation to them.
|
|
62
|
+
*
|
|
63
|
+
* The histogram and the facet panel ask for the same cube (same window, same grain), so a
|
|
64
|
+
* cached source answers a page's two reads from one block of counts.
|
|
65
|
+
*/
|
|
66
|
+
export declare function aggregateReads(source: AggregateSource): Required<Pick<ObservabilityReader, 'tenantRequestVolume' | 'tenantRequestFacets' | 'tenantLogPatterns'>>;
|
|
67
|
+
//# sourceMappingURL=aggregate-reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-reads.d.ts","sourceRoot":"","sources":["../src/aggregate-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAY,KAAK,eAAe,EAAE,KAAK,IAAI,EAAE,KAAK,cAAc,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,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3C,GACA,WAAW,CA2Cb;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAEhE;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAEnG;AAcD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,eAAe,GACtB,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,mBAAmB,CAAC,CAAC,CA6B1G"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The aggregate reads, computed ONCE from cubes (#1877) — the request histogram, the
|
|
3
|
+
* facet counts and the log patterns, whatever source produced the cubes.
|
|
4
|
+
*
|
|
5
|
+
* Pure, so the semantics the routes promise are held here and nowhere else, and the
|
|
6
|
+
* contract suite can drive them over any `AggregateSource`:
|
|
7
|
+
*
|
|
8
|
+
* - **the tenant, and the scope when one is named, are applied first** — a cube carries
|
|
9
|
+
* every tenant of its service, and no other tenant's row may reach an answer;
|
|
10
|
+
* - a facet is counted with every OTHER filter applied and its own left out;
|
|
11
|
+
* - a line with no `level` is `unrecorded`, counted and never dropped;
|
|
12
|
+
* - a pattern's share is of every matching `ctx.log` line, not only the listed ones;
|
|
13
|
+
* - `estimated` is carried through from any sampled part of a cube.
|
|
14
|
+
*/
|
|
15
|
+
import { grainFor } from './aggregate-source.js';
|
|
16
|
+
import { LOG_PATTERN_TOP, REQUEST_FACET_KEYS, REQUEST_FACET_TOP, } from './observability.js';
|
|
17
|
+
/** The caller's rows: its tenant, and its scope when it named one. Applied before anything else. */
|
|
18
|
+
function own(rows, scope) {
|
|
19
|
+
return rows.filter((r) => r.tenantId === scope.tenantId && (!scope.scopeId || r.scopeId === scope.scopeId));
|
|
20
|
+
}
|
|
21
|
+
/** A request row's value for a facet, as a filter compares it (status as text). */
|
|
22
|
+
function facetValue(r, key) {
|
|
23
|
+
const v = r[key];
|
|
24
|
+
return v === null || v === undefined ? null : String(v);
|
|
25
|
+
}
|
|
26
|
+
/** Does a row pass every facet filter — except `omit`'s, when counting that facet? */
|
|
27
|
+
function passes(r, where, omit) {
|
|
28
|
+
for (const key of REQUEST_FACET_KEYS) {
|
|
29
|
+
if (key === omit)
|
|
30
|
+
continue;
|
|
31
|
+
const values = where?.[key];
|
|
32
|
+
if (!values || values.length === 0)
|
|
33
|
+
continue;
|
|
34
|
+
const v = facetValue(r, key);
|
|
35
|
+
if (v === null || !values.includes(v))
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The width a histogram's bars are drawn at: the asked-for count over the window, never
|
|
42
|
+
* finer than the cube's grain, and a whole number of grains so no grain is split.
|
|
43
|
+
*/
|
|
44
|
+
export function barWidth(span, buckets, grainMs) {
|
|
45
|
+
return Math.max(grainMs, Math.ceil(span / Math.max(1, buckets) / grainMs) * grainMs);
|
|
46
|
+
}
|
|
47
|
+
const levelOf = (v) => v === 'info' || v === 'warn' || v === 'error' ? v : 'unrecorded';
|
|
48
|
+
/** The request histogram: per-level counts per bar, bars with no requests left out. */
|
|
49
|
+
export function volumeFrom(cube, scope) {
|
|
50
|
+
const width = barWidth(scope.to - scope.from, scope.buckets, scope.grainMs);
|
|
51
|
+
const bars = new Map();
|
|
52
|
+
for (const r of own(cube.rows, scope)) {
|
|
53
|
+
if (!passes(r, scope.where))
|
|
54
|
+
continue;
|
|
55
|
+
const start = scope.from + Math.floor((r.bucket - scope.from) / width) * width;
|
|
56
|
+
const bar = bars.get(start) ?? { start: new Date(start).toISOString(), info: 0, warn: 0, error: 0, unrecorded: 0 };
|
|
57
|
+
bar[levelOf(r.level)] += r.count;
|
|
58
|
+
bars.set(start, bar);
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
bucketMs: width,
|
|
62
|
+
buckets: [...bars.entries()].sort(([a], [b]) => a - b).map(([, b]) => b),
|
|
63
|
+
estimated: cube.estimated,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Facet counts: each facet with every other filter applied and its own left out. */
|
|
67
|
+
export function facetsFrom(cube, scope) {
|
|
68
|
+
const rows = own(cube.rows, scope);
|
|
69
|
+
const total = rows.filter((r) => passes(r, scope.where)).reduce((n, r) => n + r.count, 0);
|
|
70
|
+
const facets = Object.fromEntries(REQUEST_FACET_KEYS.map((k) => [k, []]));
|
|
71
|
+
for (const key of scope.keys ?? REQUEST_FACET_KEYS) {
|
|
72
|
+
const counts = new Map();
|
|
73
|
+
for (const r of rows) {
|
|
74
|
+
if (!passes(r, scope.where, key))
|
|
75
|
+
continue;
|
|
76
|
+
const v = facetValue(r, key);
|
|
77
|
+
// A line with no value for this key is not a value anybody can filter on; the total
|
|
78
|
+
// above still counts it.
|
|
79
|
+
if (v === null || v === '')
|
|
80
|
+
continue;
|
|
81
|
+
counts.set(v, (counts.get(v) ?? 0) + r.count);
|
|
82
|
+
}
|
|
83
|
+
facets[key] = [...counts.entries()]
|
|
84
|
+
.map(([v, count]) => ({ value: key === 'status' ? Number(v) : v, count }))
|
|
85
|
+
.sort((a, b) => b.count - a.count || String(a.value).localeCompare(String(b.value)))
|
|
86
|
+
.slice(0, REQUEST_FACET_TOP);
|
|
87
|
+
}
|
|
88
|
+
return { total, facets, estimated: cube.estimated };
|
|
89
|
+
}
|
|
90
|
+
const patternLevel = (v) => v === 'debug' || v === 'warn' || v === 'error' ? v : 'info';
|
|
91
|
+
/** `ctx.log` lines grouped by template: count, share, level split, and a small histogram. */
|
|
92
|
+
export function patternsFrom(cube, scope) {
|
|
93
|
+
const width = barWidth(scope.to - scope.from, scope.buckets, scope.grainMs);
|
|
94
|
+
const rows = own(cube.rows, scope).filter((r) => (!scope.level?.length || scope.level.includes(patternLevel(r.level))) &&
|
|
95
|
+
(!scope.operation?.length || (r.operation !== null && scope.operation.includes(r.operation))));
|
|
96
|
+
const total = rows.reduce((n, r) => n + r.count, 0);
|
|
97
|
+
const byTemplate = new Map();
|
|
98
|
+
for (const r of rows) {
|
|
99
|
+
if (r.template === '')
|
|
100
|
+
continue;
|
|
101
|
+
let e = byTemplate.get(r.template);
|
|
102
|
+
if (!e) {
|
|
103
|
+
e = { levels: { debug: 0, info: 0, warn: 0, error: 0 }, bars: new Map() };
|
|
104
|
+
byTemplate.set(r.template, e);
|
|
105
|
+
}
|
|
106
|
+
e.levels[patternLevel(r.level)] += r.count;
|
|
107
|
+
const start = scope.from + Math.floor((r.bucket - scope.from) / width) * width;
|
|
108
|
+
e.bars.set(start, (e.bars.get(start) ?? 0) + r.count);
|
|
109
|
+
}
|
|
110
|
+
const patterns = [...byTemplate.entries()]
|
|
111
|
+
.map(([template, e]) => {
|
|
112
|
+
const count = e.levels.debug + e.levels.info + e.levels.warn + e.levels.error;
|
|
113
|
+
const dominant = ['error', 'warn', 'info', 'debug'].reduce((best, l) => e.levels[l] > e.levels[best] ? l : best);
|
|
114
|
+
return {
|
|
115
|
+
template,
|
|
116
|
+
count,
|
|
117
|
+
share: total > 0 ? count / total : 0,
|
|
118
|
+
levels: e.levels,
|
|
119
|
+
dominant,
|
|
120
|
+
buckets: [...e.bars.entries()].sort(([a], [b]) => a - b).map(([t, n]) => ({ start: new Date(t).toISOString(), count: n })),
|
|
121
|
+
};
|
|
122
|
+
})
|
|
123
|
+
.sort((a, b) => b.count - a.count || a.template.localeCompare(b.template));
|
|
124
|
+
return {
|
|
125
|
+
total,
|
|
126
|
+
bucketMs: width,
|
|
127
|
+
patterns: patterns.slice(0, LOG_PATTERN_TOP),
|
|
128
|
+
truncated: patterns.length > LOG_PATTERN_TOP,
|
|
129
|
+
estimated: cube.estimated,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** Cubes for several services, as one — a tenant's app can be served by more than one. */
|
|
133
|
+
export function mergeCubes(cubes) {
|
|
134
|
+
return { rows: cubes.flatMap((c) => c.rows), estimated: cubes.some((c) => c.estimated) };
|
|
135
|
+
}
|
|
136
|
+
/** The window aligned outward to whole grains, so no grain is half in and half out. */
|
|
137
|
+
export function alignWindow(from, to, grainMs) {
|
|
138
|
+
return { from: Math.floor(from / grainMs) * grainMs, to: Math.ceil(to / grainMs) * grainMs };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The scripts an aggregate read counts over — REQUIRED. A cube is counted per script family,
|
|
142
|
+
* so there is no tenant-only fallback, and answering an absent list with empty counts would
|
|
143
|
+
* read as "no traffic". The routes always resolve it; this refuses a caller that did not.
|
|
144
|
+
*/
|
|
145
|
+
function scriptsOf(services) {
|
|
146
|
+
if (services === undefined) {
|
|
147
|
+
throw new Error("aggregate log reads need the app's script families (`services`) — a cube is counted per family");
|
|
148
|
+
}
|
|
149
|
+
return services;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The three aggregate reads of `ObservabilityReader`, over any source (#1877). An adapter
|
|
153
|
+
* binds its reads to this rather than computing them itself, so every source — the
|
|
154
|
+
* telemetry query, a cache of it, a future store — answers with the same semantics, and
|
|
155
|
+
* the contract suite holds one implementation to them.
|
|
156
|
+
*
|
|
157
|
+
* The histogram and the facet panel ask for the same cube (same window, same grain), so a
|
|
158
|
+
* cached source answers a page's two reads from one block of counts.
|
|
159
|
+
*/
|
|
160
|
+
export function aggregateReads(source) {
|
|
161
|
+
const requestCube = async (input) => {
|
|
162
|
+
const services = scriptsOf(input.services);
|
|
163
|
+
const grainMs = grainFor(input.to - input.from);
|
|
164
|
+
const window = alignWindow(input.from, input.to, grainMs);
|
|
165
|
+
const cube = mergeCubes(await Promise.all(services.map((service) => source.requests({ service, ...window, grainMs }))));
|
|
166
|
+
return { grainMs, window, cube };
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
async tenantRequestVolume(input) {
|
|
170
|
+
const { grainMs, window, cube } = await requestCube(input);
|
|
171
|
+
return volumeFrom(cube, { ...input, ...window, buckets: input.buckets, grainMs });
|
|
172
|
+
},
|
|
173
|
+
async tenantRequestFacets(input) {
|
|
174
|
+
const { cube } = await requestCube(input);
|
|
175
|
+
return facetsFrom(cube, input);
|
|
176
|
+
},
|
|
177
|
+
async tenantLogPatterns(input) {
|
|
178
|
+
const services = scriptsOf(input.services);
|
|
179
|
+
const grainMs = grainFor(input.to - input.from);
|
|
180
|
+
const window = alignWindow(input.from, input.to, grainMs);
|
|
181
|
+
const cube = mergeCubes(await Promise.all(services.map((service) => source.patterns({ service, ...window, grainMs }))));
|
|
182
|
+
return patternsFrom(cube, { ...input, ...window, grainMs });
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=aggregate-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-reads.js","sourceRoot":"","sources":["../src/aggregate-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,QAAQ,EAA6E,MAAM,uBAAuB,CAAC;AAC5H,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,iBAAiB,GAYlB,MAAM,oBAAoB,CAAC;AAS5B,oGAAoG;AACpG,SAAS,GAAG,CAAyD,IAAkB,EAAE,KAAqB;IAC5G,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,KAA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C,QAAQ,CAAC,CAAC;YAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;YAChD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC1D,MAAM,IAAI,GAAG,UAAU,CACrB,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAC/F,CAAC;YACF,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The aggregate half of the observability seam (#1877): counts, grouped by every facet,
|
|
3
|
+
* for one deployed service and one span of time — and the cache that makes each span be
|
|
4
|
+
* counted once.
|
|
5
|
+
*
|
|
6
|
+
* ## Why a second seam
|
|
7
|
+
*
|
|
8
|
+
* `ObservabilityReader` is the adapter the routes reach through, and its shapes are the
|
|
9
|
+
* contract the dashboard reads. Underneath it, the request histogram, the facet counts
|
|
10
|
+
* and the log patterns are all the same computation — sum a cube of counts — over a
|
|
11
|
+
* source that could be a telemetry query, a cache of earlier answers, or a pre-aggregated
|
|
12
|
+
* store. This file is that source, so the three reads are written once
|
|
13
|
+
* (`aggregate-reads.ts`) and the way the counts are obtained can keep improving behind
|
|
14
|
+
* them without the API moving.
|
|
15
|
+
*
|
|
16
|
+
* ## Why a cube, and why per service
|
|
17
|
+
*
|
|
18
|
+
* A source answers for a whole SERVICE (a deployed script) and every tenant it served,
|
|
19
|
+
* grouped by every facet at once. A per-tenant answer would pay to scan the whole script's
|
|
20
|
+
* lines to keep one tenant's; grouping by tenant in the same scan answers every tenant at
|
|
21
|
+
* the price of one. And every facet in the grouping means any filter a panel produces is
|
|
22
|
+
* summed from the cube in memory — ticking a value costs no query.
|
|
23
|
+
*
|
|
24
|
+
* The rows are therefore OTHER TENANTS' counts too. The reads filter to the caller's
|
|
25
|
+
* tenant before anything leaves them, and the contract suite holds them to it.
|
|
26
|
+
*
|
|
27
|
+
* ## Why the cache is safe to keep forever
|
|
28
|
+
*
|
|
29
|
+
* Logs never change. A span of time that has closed — and has had long enough for late
|
|
30
|
+
* lines to be ingested — has final counts, so its cube is kept for good and every later
|
|
31
|
+
* reader of any tenant gets it without a query. Only the open span is read live.
|
|
32
|
+
*/
|
|
33
|
+
/** One row of the request cube: how many stamped invocation lines had these values. */
|
|
34
|
+
export interface RequestCubeRow {
|
|
35
|
+
/** Start of the grain bucket, epoch milliseconds. */
|
|
36
|
+
bucket: number;
|
|
37
|
+
tenantId: string;
|
|
38
|
+
scopeId: string | null;
|
|
39
|
+
/** `null` for a line written before the field existed (#1746). */
|
|
40
|
+
level: string | null;
|
|
41
|
+
operation: string | null;
|
|
42
|
+
problemCode: string | null;
|
|
43
|
+
principalKind: string | null;
|
|
44
|
+
surface: string | null;
|
|
45
|
+
status: number | null;
|
|
46
|
+
count: number;
|
|
47
|
+
}
|
|
48
|
+
/** One row of the pattern cube: how many `ctx.log` lines had these values (#1747). */
|
|
49
|
+
export interface PatternCubeRow {
|
|
50
|
+
bucket: number;
|
|
51
|
+
tenantId: string;
|
|
52
|
+
scopeId: string | null;
|
|
53
|
+
template: string;
|
|
54
|
+
level: string | null;
|
|
55
|
+
operation: string | null;
|
|
56
|
+
count: number;
|
|
57
|
+
}
|
|
58
|
+
/** A cube and whether any of it was counted from a sample. */
|
|
59
|
+
export interface Cube<Row> {
|
|
60
|
+
rows: Row[];
|
|
61
|
+
/** The backend scaled a sample; the counts are estimates. */
|
|
62
|
+
estimated: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* `false` when the source could not vouch for having every group — it had to page an
|
|
65
|
+
* answer whose order is not guaranteed. Still answered, never KEPT: a cache that stored
|
|
66
|
+
* it would serve a smaller answer as final for good. Absent means complete.
|
|
67
|
+
*/
|
|
68
|
+
complete?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** What a source is asked: one service, one span, cut at one grain. */
|
|
71
|
+
export interface CubeQuery {
|
|
72
|
+
/** The deployed script the lines came from — the scan boundary and the cache key. */
|
|
73
|
+
service: string;
|
|
74
|
+
/** Epoch milliseconds, inclusive / exclusive, aligned to `grainMs`. */
|
|
75
|
+
from: number;
|
|
76
|
+
to: number;
|
|
77
|
+
grainMs: number;
|
|
78
|
+
}
|
|
79
|
+
/** A source of cubes. Implementations: the telemetry query, and a cache wrapping one. */
|
|
80
|
+
export interface AggregateSource {
|
|
81
|
+
requests(q: CubeQuery): Promise<Cube<RequestCubeRow>>;
|
|
82
|
+
patterns(q: CubeQuery): Promise<Cube<PatternCubeRow>>;
|
|
83
|
+
}
|
|
84
|
+
/** The grains a cube is cut at. Finer grains serve narrower windows. */
|
|
85
|
+
export declare const GRAINS_MS: readonly [10000, 60000, 300000, 3600000];
|
|
86
|
+
/**
|
|
87
|
+
* The grain for a window: the coarsest that still gives a zoomed histogram real
|
|
88
|
+
* resolution. Fifteen minutes and under is cut into 10 s, two hours into a minute, a day
|
|
89
|
+
* into five minutes, anything longer into hours — so a histogram of 90 bars never has
|
|
90
|
+
* fewer than about 90 grains to draw them from, and a three-day window is 72 of them.
|
|
91
|
+
*/
|
|
92
|
+
export declare function grainFor(windowMs: number): number;
|
|
93
|
+
/** A cached block is twelve grains: 2 min, 12 min, 1 h or 12 h. */
|
|
94
|
+
export declare function blockMsFor(grainMs: number): number;
|
|
95
|
+
/** How long after a block ends before its counts are final — Workers Logs ingests late. */
|
|
96
|
+
export declare const CLOSE_LAG_MS: number;
|
|
97
|
+
/** A stored block: its cube, as the source answered it. */
|
|
98
|
+
export interface StoredBlock<Row> {
|
|
99
|
+
rows: Row[];
|
|
100
|
+
estimated: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** Where closed blocks live. Keys are opaque; a block, once written, never changes. */
|
|
103
|
+
export interface CubeStore {
|
|
104
|
+
get(keys: readonly string[]): Promise<Map<string, StoredBlock<unknown>>>;
|
|
105
|
+
put(key: string, block: StoredBlock<unknown>, blockStart: number): Promise<void>;
|
|
106
|
+
}
|
|
107
|
+
/** An in-memory store — the tests', and a harness without a Durable Object. */
|
|
108
|
+
export declare function memoryCubeStore(): CubeStore & {
|
|
109
|
+
size(): number;
|
|
110
|
+
};
|
|
111
|
+
/** The cache key of one block. The grain is in it: a block at 5 min is not one at 1 h. */
|
|
112
|
+
export declare function blockKey(kind: 'requests' | 'patterns', service: string, grainMs: number, start: number): string;
|
|
113
|
+
/**
|
|
114
|
+
* A source that counts each closed block once.
|
|
115
|
+
*
|
|
116
|
+
* A query is split into blocks of twelve grains, aligned to the epoch so every reader
|
|
117
|
+
* cuts the same blocks. A block that closed more than `CLOSE_LAG_MS` ago is read from the
|
|
118
|
+
* store, or counted by `inner` and stored; the rest are counted live and not kept. Rows
|
|
119
|
+
* outside the query's span are dropped, so a caller never sees the block edges.
|
|
120
|
+
*/
|
|
121
|
+
export declare function cachedSource(inner: AggregateSource, store: CubeStore, opts?: {
|
|
122
|
+
now?: () => number;
|
|
123
|
+
lagMs?: number;
|
|
124
|
+
}): AggregateSource;
|
|
125
|
+
//# sourceMappingURL=aggregate-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-source.d.ts","sourceRoot":"","sources":["../src/aggregate-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAA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1
|
+
/**
|
|
2
|
+
* The aggregate half of the observability seam (#1877): counts, grouped by every facet,
|
|
3
|
+
* for one deployed service and one span of time — and the cache that makes each span be
|
|
4
|
+
* counted once.
|
|
5
|
+
*
|
|
6
|
+
* ## Why a second seam
|
|
7
|
+
*
|
|
8
|
+
* `ObservabilityReader` is the adapter the routes reach through, and its shapes are the
|
|
9
|
+
* contract the dashboard reads. Underneath it, the request histogram, the facet counts
|
|
10
|
+
* and the log patterns are all the same computation — sum a cube of counts — over a
|
|
11
|
+
* source that could be a telemetry query, a cache of earlier answers, or a pre-aggregated
|
|
12
|
+
* store. This file is that source, so the three reads are written once
|
|
13
|
+
* (`aggregate-reads.ts`) and the way the counts are obtained can keep improving behind
|
|
14
|
+
* them without the API moving.
|
|
15
|
+
*
|
|
16
|
+
* ## Why a cube, and why per service
|
|
17
|
+
*
|
|
18
|
+
* A source answers for a whole SERVICE (a deployed script) and every tenant it served,
|
|
19
|
+
* grouped by every facet at once. A per-tenant answer would pay to scan the whole script's
|
|
20
|
+
* lines to keep one tenant's; grouping by tenant in the same scan answers every tenant at
|
|
21
|
+
* the price of one. And every facet in the grouping means any filter a panel produces is
|
|
22
|
+
* summed from the cube in memory — ticking a value costs no query.
|
|
23
|
+
*
|
|
24
|
+
* The rows are therefore OTHER TENANTS' counts too. The reads filter to the caller's
|
|
25
|
+
* tenant before anything leaves them, and the contract suite holds them to it.
|
|
26
|
+
*
|
|
27
|
+
* ## Why the cache is safe to keep forever
|
|
28
|
+
*
|
|
29
|
+
* Logs never change. A span of time that has closed — and has had long enough for late
|
|
30
|
+
* lines to be ingested — has final counts, so its cube is kept for good and every later
|
|
31
|
+
* reader of any tenant gets it without a query. Only the open span is read live.
|
|
32
|
+
*/
|
|
33
|
+
/** The grains a cube is cut at. Finer grains serve narrower windows. */
|
|
34
|
+
export const GRAINS_MS = [10_000, 60_000, 300_000, 3_600_000];
|
|
35
|
+
/**
|
|
36
|
+
* The grain for a window: the coarsest that still gives a zoomed histogram real
|
|
37
|
+
* resolution. Fifteen minutes and under is cut into 10 s, two hours into a minute, a day
|
|
38
|
+
* into five minutes, anything longer into hours — so a histogram of 90 bars never has
|
|
39
|
+
* fewer than about 90 grains to draw them from, and a three-day window is 72 of them.
|
|
40
|
+
*/
|
|
41
|
+
export function grainFor(windowMs) {
|
|
42
|
+
if (windowMs <= 15 * 60_000)
|
|
43
|
+
return 10_000;
|
|
44
|
+
if (windowMs <= 2 * 3_600_000)
|
|
45
|
+
return 60_000;
|
|
46
|
+
if (windowMs <= 24 * 3_600_000)
|
|
47
|
+
return 300_000;
|
|
48
|
+
return 3_600_000;
|
|
49
|
+
}
|
|
50
|
+
/** A cached block is twelve grains: 2 min, 12 min, 1 h or 12 h. */
|
|
51
|
+
export function blockMsFor(grainMs) {
|
|
52
|
+
return grainMs * 12;
|
|
53
|
+
}
|
|
54
|
+
/** How long after a block ends before its counts are final — Workers Logs ingests late. */
|
|
55
|
+
export const CLOSE_LAG_MS = 5 * 60_000;
|
|
56
|
+
/** An in-memory store — the tests', and a harness without a Durable Object. */
|
|
57
|
+
export function memoryCubeStore() {
|
|
58
|
+
const blocks = new Map();
|
|
59
|
+
return {
|
|
60
|
+
async get(keys) {
|
|
61
|
+
const out = new Map();
|
|
62
|
+
for (const k of keys) {
|
|
63
|
+
const b = blocks.get(k);
|
|
64
|
+
if (b)
|
|
65
|
+
out.set(k, b);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
},
|
|
69
|
+
async put(key, block) {
|
|
70
|
+
blocks.set(key, block);
|
|
71
|
+
},
|
|
72
|
+
size: () => blocks.size,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** The cache key of one block. The grain is in it: a block at 5 min is not one at 1 h. */
|
|
76
|
+
export function blockKey(kind, service, grainMs, start) {
|
|
77
|
+
return `${kind}|${service}|${grainMs}|${start}`;
|
|
78
|
+
}
|
|
79
|
+
/** How many uncached blocks one read computes at once — a bound on the backend's load. */
|
|
80
|
+
const BLOCK_CONCURRENCY = 4;
|
|
81
|
+
async function inBatches(items, size, fn) {
|
|
82
|
+
const out = [];
|
|
83
|
+
for (let i = 0; i < items.length; i += size)
|
|
84
|
+
out.push(...(await Promise.all(items.slice(i, i + size).map(fn))));
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A source that counts each closed block once.
|
|
89
|
+
*
|
|
90
|
+
* A query is split into blocks of twelve grains, aligned to the epoch so every reader
|
|
91
|
+
* cuts the same blocks. A block that closed more than `CLOSE_LAG_MS` ago is read from the
|
|
92
|
+
* store, or counted by `inner` and stored; the rest are counted live and not kept. Rows
|
|
93
|
+
* outside the query's span are dropped, so a caller never sees the block edges.
|
|
94
|
+
*/
|
|
95
|
+
export function cachedSource(inner, store, opts = {}) {
|
|
96
|
+
const now = opts.now ?? (() => Date.now());
|
|
97
|
+
const lag = opts.lagMs ?? CLOSE_LAG_MS;
|
|
98
|
+
const read = async (kind, q, count) => {
|
|
99
|
+
const blockMs = blockMsFor(q.grainMs);
|
|
100
|
+
const first = Math.floor(q.from / blockMs) * blockMs;
|
|
101
|
+
const starts = [];
|
|
102
|
+
for (let s = first; s < q.to; s += blockMs)
|
|
103
|
+
starts.push(s);
|
|
104
|
+
const closedBefore = now() - lag;
|
|
105
|
+
const closed = starts.filter((s) => s + blockMs <= closedBefore);
|
|
106
|
+
const open = starts.filter((s) => s + blockMs > closedBefore);
|
|
107
|
+
const keys = closed.map((s) => blockKey(kind, q.service, q.grainMs, s));
|
|
108
|
+
const found = await store.get(keys);
|
|
109
|
+
const missing = closed.filter((_, i) => !found.has(keys[i]));
|
|
110
|
+
const counted = await inBatches(missing, BLOCK_CONCURRENCY, async (s) => {
|
|
111
|
+
const block = await count({ service: q.service, from: s, to: s + blockMs, grainMs: q.grainMs });
|
|
112
|
+
// Only a block the source vouches for as whole is kept; the rest is recounted next time.
|
|
113
|
+
if (block.complete !== false) {
|
|
114
|
+
await store.put(blockKey(kind, q.service, q.grainMs, s), { rows: block.rows, estimated: block.estimated }, s);
|
|
115
|
+
}
|
|
116
|
+
return block;
|
|
117
|
+
});
|
|
118
|
+
// The open blocks as ONE live span: they are contiguous, and one query is cheaper
|
|
119
|
+
// than several short ones.
|
|
120
|
+
const live = open.length > 0
|
|
121
|
+
? await count({ service: q.service, from: open[0], to: open[open.length - 1] + blockMs, grainMs: q.grainMs })
|
|
122
|
+
: { rows: [], estimated: false };
|
|
123
|
+
const blocks = [...[...found.values()].map((b) => b), ...counted, live];
|
|
124
|
+
return {
|
|
125
|
+
rows: blocks.flatMap((b) => b.rows).filter((r) => r.bucket >= q.from && r.bucket < q.to),
|
|
126
|
+
estimated: blocks.some((b) => b.estimated),
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
requests: (q) => read('requests', q, (b) => inner.requests(b)),
|
|
131
|
+
patterns: (q) => read('patterns', q, (b) => inner.patterns(b)),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=aggregate-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-source.js","sourceRoot":"","sources":["../src/aggregate-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA0DH,wEAAwE;AACxE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB;IACvC,IAAI,QAAQ,IAAI,EAAE,GAAG,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3C,IAAI,QAAQ,IAAI,CAAC,GAAG,SAAS;QAAE,OAAO,MAAM,CAAC;IAC7C,IAAI,QAAQ,IAAI,EAAE,GAAG,SAAS;QAAE,OAAO,OAAO,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU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