@origintrail-official/dkg-core 10.0.11 → 10.0.13
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/LICENSE +201 -201
- package/README.md +29 -29
- package/dist/assertion-seal.js +46 -1
- package/dist/assertion-seal.js.map +1 -1
- package/dist/author-catalog-codec.d.ts +8 -20
- package/dist/author-catalog-codec.d.ts.map +1 -1
- package/dist/author-catalog-codec.js +33 -41
- package/dist/author-catalog-codec.js.map +1 -1
- package/dist/author-lane-scope-v1.d.ts +40 -0
- package/dist/author-lane-scope-v1.d.ts.map +1 -0
- package/dist/author-lane-scope-v1.js +168 -0
- package/dist/author-lane-scope-v1.js.map +1 -0
- package/dist/backpressure-observability.d.ts +273 -0
- package/dist/backpressure-observability.d.ts.map +1 -0
- package/dist/backpressure-observability.js +572 -0
- package/dist/backpressure-observability.js.map +1 -0
- package/dist/canonical-graph-scoped-author-seal.d.ts +2 -5
- package/dist/canonical-graph-scoped-author-seal.d.ts.map +1 -1
- package/dist/canonical-graph-scoped-author-seal.js +40 -32
- package/dist/canonical-graph-scoped-author-seal.js.map +1 -1
- package/dist/cg-shared-projection.d.ts.map +1 -1
- package/dist/cg-shared-projection.js +2 -10
- package/dist/cg-shared-projection.js.map +1 -1
- package/dist/genesis.js +15 -15
- package/dist/graph-knowledge-asset-metadata.js +106 -106
- package/dist/imported-artifact-metadata.js +31 -31
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/ka-bundle-v1.d.ts +2 -0
- package/dist/ka-bundle-v1.d.ts.map +1 -1
- package/dist/ka-bundle-v1.js +7 -2
- package/dist/ka-bundle-v1.js.map +1 -1
- package/dist/ka-content-scope.d.ts +27 -0
- package/dist/ka-content-scope.d.ts.map +1 -1
- package/dist/ka-content-scope.js +43 -1
- package/dist/ka-content-scope.js.map +1 -1
- package/dist/ka-ual-identity.d.ts +33 -0
- package/dist/ka-ual-identity.d.ts.map +1 -0
- package/dist/ka-ual-identity.js +89 -0
- package/dist/ka-ual-identity.js.map +1 -0
- package/dist/message-stream-pool.d.ts +15 -0
- package/dist/message-stream-pool.d.ts.map +1 -1
- package/dist/message-stream-pool.js +23 -0
- package/dist/message-stream-pool.js.map +1 -1
- package/dist/protocol-router.d.ts +18 -0
- package/dist/protocol-router.d.ts.map +1 -1
- package/dist/protocol-router.js +96 -1
- package/dist/protocol-router.js.map +1 -1
- package/dist/swm-author-inventory-v1.d.ts +83 -0
- package/dist/swm-author-inventory-v1.d.ts.map +1 -0
- package/dist/swm-author-inventory-v1.js +379 -0
- package/dist/swm-author-inventory-v1.js.map +1 -0
- package/dist/telemetry-api.d.ts +76 -0
- package/dist/telemetry-api.d.ts.map +1 -1
- package/dist/telemetry-api.js +101 -0
- package/dist/telemetry-api.js.map +1 -1
- package/dist/vm-update-convergence.d.ts +277 -0
- package/dist/vm-update-convergence.d.ts.map +1 -0
- package/dist/vm-update-convergence.js +715 -0
- package/dist/vm-update-convergence.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import { getMetrics } from './telemetry-api.js';
|
|
2
|
+
const DEFAULT_DEGRADED_QUEUE_AGE_MS = 5_000;
|
|
3
|
+
const DEFAULT_STALLED_ACTIVE_AGE_MS = 30_000;
|
|
4
|
+
const DEFAULT_DEGRADED_QUEUE_UTILIZATION = 0.75;
|
|
5
|
+
const DEFAULT_REJECTION_STATE_WINDOW_MS = 60_000;
|
|
6
|
+
const MAX_OPERATION_SUMMARIES = 8;
|
|
7
|
+
const STATE_RANK = {
|
|
8
|
+
healthy: 0,
|
|
9
|
+
degraded: 1,
|
|
10
|
+
saturated: 2,
|
|
11
|
+
stalled: 3,
|
|
12
|
+
};
|
|
13
|
+
function maxState(a, b) {
|
|
14
|
+
return STATE_RANK[a] >= STATE_RANK[b] ? a : b;
|
|
15
|
+
}
|
|
16
|
+
function normalizeLimit(value) {
|
|
17
|
+
return Number.isFinite(value) && value >= 0 ? value : null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Keep metric/log dimensions bounded and strip payload-like punctuation.
|
|
21
|
+
* Callers should still pass static operation names rather than graph, peer, or
|
|
22
|
+
* job identifiers.
|
|
23
|
+
*/
|
|
24
|
+
export function normalizeBackpressureLabel(value, fallback = 'unknown') {
|
|
25
|
+
const trimmed = value.trim();
|
|
26
|
+
if (!trimmed)
|
|
27
|
+
return fallback;
|
|
28
|
+
return trimmed.replace(/[^\w:./-]/g, '_').slice(0, 80) || fallback;
|
|
29
|
+
}
|
|
30
|
+
function mapToRecord(map) {
|
|
31
|
+
return Object.fromEntries([...map.entries()].sort(([a], [b]) => a.localeCompare(b)));
|
|
32
|
+
}
|
|
33
|
+
function operationSummaries(records, timestamp, now) {
|
|
34
|
+
const byOperation = new Map();
|
|
35
|
+
for (const record of records) {
|
|
36
|
+
const existing = byOperation.get(record.operation);
|
|
37
|
+
const at = timestamp(record);
|
|
38
|
+
if (existing) {
|
|
39
|
+
existing.count += 1;
|
|
40
|
+
existing.oldestAt = Math.min(existing.oldestAt, at);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
byOperation.set(record.operation, { count: 1, oldestAt: at });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [...byOperation.entries()]
|
|
47
|
+
.map(([operation, value]) => ({
|
|
48
|
+
operation,
|
|
49
|
+
count: value.count,
|
|
50
|
+
oldestAgeMs: Math.max(0, Math.floor(now - value.oldestAt)),
|
|
51
|
+
}))
|
|
52
|
+
.sort((a, b) => b.oldestAgeMs - a.oldestAgeMs || b.count - a.count || a.operation.localeCompare(b.operation))
|
|
53
|
+
.slice(0, MAX_OPERATION_SUMMARIES);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Scheduling-policy-neutral lifecycle tracker.
|
|
57
|
+
*
|
|
58
|
+
* Queue implementations call the five transition methods at their existing
|
|
59
|
+
* admission boundaries. The tracker owns timings, state classification,
|
|
60
|
+
* bounded metrics, and diagnostic snapshots, but never decides which work may
|
|
61
|
+
* run. All observability calls are fail-open so instrumentation cannot change
|
|
62
|
+
* scheduler behaviour.
|
|
63
|
+
*/
|
|
64
|
+
export class SchedulerPressureTracker {
|
|
65
|
+
scheduler;
|
|
66
|
+
queued = new Map();
|
|
67
|
+
active = new Map();
|
|
68
|
+
lanes = new Map();
|
|
69
|
+
now;
|
|
70
|
+
thresholds;
|
|
71
|
+
capacity;
|
|
72
|
+
nextTicketId = 1;
|
|
73
|
+
constructor(options) {
|
|
74
|
+
this.scheduler = normalizeBackpressureLabel(options.scheduler, 'scheduler');
|
|
75
|
+
this.capacity = options.capacity ?? {};
|
|
76
|
+
this.now = options.now ?? Date.now;
|
|
77
|
+
this.thresholds = {
|
|
78
|
+
degradedQueueAgeMs: options.thresholds?.degradedQueueAgeMs ?? DEFAULT_DEGRADED_QUEUE_AGE_MS,
|
|
79
|
+
stalledActiveAgeMs: options.thresholds?.stalledActiveAgeMs ?? DEFAULT_STALLED_ACTIVE_AGE_MS,
|
|
80
|
+
degradedQueueUtilization: options.thresholds?.degradedQueueUtilization ?? DEFAULT_DEGRADED_QUEUE_UTILIZATION,
|
|
81
|
+
rejectionStateWindowMs: options.thresholds?.rejectionStateWindowMs ?? DEFAULT_REJECTION_STATE_WINDOW_MS,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
updateCapacity(capacity) {
|
|
85
|
+
this.capacity = capacity;
|
|
86
|
+
}
|
|
87
|
+
enqueue(work) {
|
|
88
|
+
const record = {
|
|
89
|
+
id: this.nextTicketId++,
|
|
90
|
+
lane: normalizeBackpressureLabel(work.lane, 'default'),
|
|
91
|
+
operation: normalizeBackpressureLabel(work.operation),
|
|
92
|
+
queuedAt: this.now(),
|
|
93
|
+
};
|
|
94
|
+
this.queued.set(record.id, record);
|
|
95
|
+
this.recordEvent(record.lane, 'enqueued');
|
|
96
|
+
return { id: record.id };
|
|
97
|
+
}
|
|
98
|
+
start(ticket) {
|
|
99
|
+
const record = this.queued.get(ticket.id);
|
|
100
|
+
if (!record)
|
|
101
|
+
return;
|
|
102
|
+
this.queued.delete(ticket.id);
|
|
103
|
+
record.startedAt = this.now();
|
|
104
|
+
this.active.set(ticket.id, record);
|
|
105
|
+
this.recordEvent(record.lane, 'started');
|
|
106
|
+
this.safeMetric(() => getMetrics().backpressureQueueWaitMs.record(Math.max(0, record.startedAt - record.queuedAt), { scheduler: this.scheduler, lane: record.lane }));
|
|
107
|
+
}
|
|
108
|
+
reject(work, reason) {
|
|
109
|
+
const lane = normalizeBackpressureLabel(work.lane, 'default');
|
|
110
|
+
this.recordRejection(lane, reason);
|
|
111
|
+
}
|
|
112
|
+
rejectQueued(ticket, reason) {
|
|
113
|
+
const record = this.queued.get(ticket.id);
|
|
114
|
+
if (!record)
|
|
115
|
+
return;
|
|
116
|
+
this.queued.delete(ticket.id);
|
|
117
|
+
this.recordRejection(record.lane, reason);
|
|
118
|
+
}
|
|
119
|
+
cancelQueued(ticket, reason = 'cancelled') {
|
|
120
|
+
const record = this.queued.get(ticket.id);
|
|
121
|
+
if (!record)
|
|
122
|
+
return;
|
|
123
|
+
this.queued.delete(ticket.id);
|
|
124
|
+
this.recordEvent(record.lane, 'cancelled', reason);
|
|
125
|
+
}
|
|
126
|
+
finish(ticket, outcome) {
|
|
127
|
+
const record = this.active.get(ticket.id);
|
|
128
|
+
if (!record)
|
|
129
|
+
return;
|
|
130
|
+
this.active.delete(ticket.id);
|
|
131
|
+
const finishedAt = this.now();
|
|
132
|
+
this.recordEvent(record.lane, outcome);
|
|
133
|
+
this.safeMetric(() => getMetrics().backpressureActiveDurationMs.record(Math.max(0, finishedAt - (record.startedAt ?? finishedAt)), {
|
|
134
|
+
scheduler: this.scheduler,
|
|
135
|
+
lane: record.lane,
|
|
136
|
+
outcome,
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
snapshot() {
|
|
140
|
+
const now = this.now();
|
|
141
|
+
const laneNames = new Set([
|
|
142
|
+
...this.lanes.keys(),
|
|
143
|
+
...Object.keys(this.capacity.lanes ?? {}),
|
|
144
|
+
...[...this.queued.values()].map((entry) => entry.lane),
|
|
145
|
+
...[...this.active.values()].map((entry) => entry.lane),
|
|
146
|
+
]);
|
|
147
|
+
const snapshots = [...laneNames]
|
|
148
|
+
.sort()
|
|
149
|
+
.map((lane) => this.laneSnapshot(lane, now));
|
|
150
|
+
const totals = {
|
|
151
|
+
queued: snapshots.reduce((sum, lane) => sum + lane.queued, 0),
|
|
152
|
+
queueLimit: normalizeLimit(this.capacity.queueLimit)
|
|
153
|
+
?? this.sumLaneLimits('queueLimit', snapshots),
|
|
154
|
+
inflight: snapshots.reduce((sum, lane) => sum + lane.inflight, 0),
|
|
155
|
+
inflightLimit: normalizeLimit(this.capacity.inflightLimit)
|
|
156
|
+
?? this.sumLaneLimits('inflightLimit', snapshots),
|
|
157
|
+
oldestQueuedAgeMs: Math.max(0, ...snapshots.map((lane) => lane.oldestQueuedAgeMs)),
|
|
158
|
+
oldestActiveAgeMs: Math.max(0, ...snapshots.map((lane) => lane.oldestActiveAgeMs)),
|
|
159
|
+
rejectedTotal: snapshots.reduce((sum, lane) => sum + lane.rejectedTotal, 0),
|
|
160
|
+
};
|
|
161
|
+
let state = snapshots.reduce((current, lane) => maxState(current, lane.state), 'healthy');
|
|
162
|
+
if (totals.queueLimit !== null
|
|
163
|
+
&& totals.queueLimit > 0
|
|
164
|
+
&& totals.queued >= totals.queueLimit) {
|
|
165
|
+
state = maxState(state, 'saturated');
|
|
166
|
+
}
|
|
167
|
+
else if (totals.queueLimit !== null
|
|
168
|
+
&& totals.queueLimit > 0
|
|
169
|
+
&& totals.queued / totals.queueLimit >= this.thresholds.degradedQueueUtilization) {
|
|
170
|
+
state = maxState(state, 'degraded');
|
|
171
|
+
}
|
|
172
|
+
if (totals.oldestQueuedAgeMs >= this.thresholds.degradedQueueAgeMs) {
|
|
173
|
+
state = maxState(state, 'degraded');
|
|
174
|
+
}
|
|
175
|
+
if (totals.oldestActiveAgeMs >= this.thresholds.stalledActiveAgeMs) {
|
|
176
|
+
state = maxState(state, 'stalled');
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
scheduler: this.scheduler,
|
|
180
|
+
state,
|
|
181
|
+
capacityModel: this.capacity.capacityModel === 'shared' ? 'shared' : 'partitioned',
|
|
182
|
+
totals,
|
|
183
|
+
lanes: snapshots,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
runtimeFor(lane) {
|
|
187
|
+
let runtime = this.lanes.get(lane);
|
|
188
|
+
if (!runtime) {
|
|
189
|
+
runtime = {
|
|
190
|
+
events: new Map(),
|
|
191
|
+
rejectedByReason: new Map(),
|
|
192
|
+
lastRejectedAt: null,
|
|
193
|
+
};
|
|
194
|
+
this.lanes.set(lane, runtime);
|
|
195
|
+
}
|
|
196
|
+
return runtime;
|
|
197
|
+
}
|
|
198
|
+
recordEvent(lane, event, reason) {
|
|
199
|
+
const runtime = this.runtimeFor(lane);
|
|
200
|
+
runtime.events.set(event, (runtime.events.get(event) ?? 0) + 1);
|
|
201
|
+
this.safeMetric(() => getMetrics().backpressureEventsTotal.add(1, {
|
|
202
|
+
scheduler: this.scheduler,
|
|
203
|
+
lane,
|
|
204
|
+
event,
|
|
205
|
+
...(reason ? { reason: normalizeBackpressureLabel(reason) } : {}),
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
recordRejection(lane, reason) {
|
|
209
|
+
const normalizedReason = normalizeBackpressureLabel(reason, 'rejected');
|
|
210
|
+
const runtime = this.runtimeFor(lane);
|
|
211
|
+
runtime.rejectedByReason.set(normalizedReason, (runtime.rejectedByReason.get(normalizedReason) ?? 0) + 1);
|
|
212
|
+
runtime.lastRejectedAt = this.now();
|
|
213
|
+
this.recordEvent(lane, 'rejected', normalizedReason);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Everything the capacity model decides, in one place: which ceilings apply
|
|
217
|
+
* to a lane, what depth its state is measured against, and whether depth
|
|
218
|
+
* pressure applies at all. `laneSnapshot` stays a model-agnostic classifier,
|
|
219
|
+
* so adding a model means extending this descriptor rather than editing the
|
|
220
|
+
* classifier's branches.
|
|
221
|
+
*/
|
|
222
|
+
laneCapacityFor(lane, laneQueued) {
|
|
223
|
+
const shared = this.capacity.capacityModel === 'shared';
|
|
224
|
+
const queueLimit = shared
|
|
225
|
+
? normalizeLimit(this.capacity.queueLimit)
|
|
226
|
+
: normalizeLimit(this.capacity.lanes?.[lane]?.queueLimit);
|
|
227
|
+
// A lane with nothing waiting is not held back by a full queue, whoever
|
|
228
|
+
// filled it. Scoped to `shared` deliberately: under `partitioned` the
|
|
229
|
+
// comparisons imply it only for a positive utilization threshold, and
|
|
230
|
+
// `degradedQueueUtilization` is caller-supplied public API — at 0 the old
|
|
231
|
+
// branch read `0 / limit >= 0` as degraded on an idle lane. Applying the
|
|
232
|
+
// guard there would have been a real behaviour change for a private
|
|
233
|
+
// allocation, so it is not applied there.
|
|
234
|
+
const depthApplies = queueLimit !== null && queueLimit > 0 && (!shared || laneQueued > 0);
|
|
235
|
+
return {
|
|
236
|
+
capacityModel: shared ? 'shared' : 'partitioned',
|
|
237
|
+
queueLimit,
|
|
238
|
+
inflightLimit: shared
|
|
239
|
+
? normalizeLimit(this.capacity.inflightLimit)
|
|
240
|
+
: normalizeLimit(this.capacity.lanes?.[lane]?.inflightLimit),
|
|
241
|
+
// Depth is measured against whatever the lane's ceiling bounds: its own
|
|
242
|
+
// backlog when the allocation is private, the whole pool when the ceiling
|
|
243
|
+
// is shared.
|
|
244
|
+
depthPressure: depthApplies && queueLimit !== null
|
|
245
|
+
? { queued: shared ? this.queued.size : laneQueued, limit: queueLimit }
|
|
246
|
+
: null,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
laneSnapshot(lane, now) {
|
|
250
|
+
const runtime = this.runtimeFor(lane);
|
|
251
|
+
const queued = [...this.queued.values()].filter((entry) => entry.lane === lane);
|
|
252
|
+
const active = [...this.active.values()].filter((entry) => entry.lane === lane);
|
|
253
|
+
const { capacityModel, queueLimit, inflightLimit, depthPressure, } = this.laneCapacityFor(lane, queued.length);
|
|
254
|
+
// Exactly the depth the classifier used, so `pressureQueued / queueLimit`
|
|
255
|
+
// is always the utilization behind this lane's own state. A lane no depth
|
|
256
|
+
// applies to reports its own backlog rather than a pool it is not being
|
|
257
|
+
// held back by — publishing the pool there would read as full utilization
|
|
258
|
+
// on a lane that is `healthy` and waiting for nothing.
|
|
259
|
+
const pressureQueued = depthPressure?.queued ?? queued.length;
|
|
260
|
+
// The concurrency ceiling on a shared row is the pool's, so the count
|
|
261
|
+
// beside it must be too. The classifier reads neither — this pair is
|
|
262
|
+
// reported, not judged — but a row that pairs a lane-local count with a
|
|
263
|
+
// pool ceiling tells an operator the pool is idle while it is the reason
|
|
264
|
+
// nothing drains.
|
|
265
|
+
const pressureInflight = capacityModel === 'shared' ? this.active.size : active.length;
|
|
266
|
+
const oldestQueuedAgeMs = queued.length === 0
|
|
267
|
+
? 0
|
|
268
|
+
: Math.max(...queued.map((entry) => Math.max(0, Math.floor(now - entry.queuedAt))));
|
|
269
|
+
const oldestActiveAgeMs = active.length === 0
|
|
270
|
+
? 0
|
|
271
|
+
: Math.max(...active.map((entry) => Math.max(0, Math.floor(now - (entry.startedAt ?? now)))));
|
|
272
|
+
let state = 'healthy';
|
|
273
|
+
if (oldestActiveAgeMs >= this.thresholds.stalledActiveAgeMs) {
|
|
274
|
+
state = 'stalled';
|
|
275
|
+
}
|
|
276
|
+
else if ((depthPressure !== null && depthPressure.queued >= depthPressure.limit)
|
|
277
|
+
|| (runtime.lastRejectedAt !== null
|
|
278
|
+
&& now - runtime.lastRejectedAt <= this.thresholds.rejectionStateWindowMs)) {
|
|
279
|
+
state = 'saturated';
|
|
280
|
+
}
|
|
281
|
+
else if (oldestQueuedAgeMs >= this.thresholds.degradedQueueAgeMs
|
|
282
|
+
|| (depthPressure !== null
|
|
283
|
+
&& depthPressure.queued / depthPressure.limit >= this.thresholds.degradedQueueUtilization)) {
|
|
284
|
+
state = 'degraded';
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
lane,
|
|
288
|
+
state,
|
|
289
|
+
capacityModel,
|
|
290
|
+
queued: queued.length,
|
|
291
|
+
pressureQueued,
|
|
292
|
+
queueLimit,
|
|
293
|
+
inflight: active.length,
|
|
294
|
+
pressureInflight,
|
|
295
|
+
inflightLimit,
|
|
296
|
+
oldestQueuedAgeMs,
|
|
297
|
+
oldestActiveAgeMs,
|
|
298
|
+
queuedOperations: operationSummaries(queued, (entry) => entry.queuedAt, now),
|
|
299
|
+
activeOperations: operationSummaries(active, (entry) => entry.startedAt ?? now, now),
|
|
300
|
+
events: mapToRecord(runtime.events),
|
|
301
|
+
rejectedTotal: [...runtime.rejectedByReason.values()].reduce((sum, value) => sum + value, 0),
|
|
302
|
+
rejectedByReason: mapToRecord(runtime.rejectedByReason),
|
|
303
|
+
lastRejectedAgeMs: runtime.lastRejectedAt === null
|
|
304
|
+
? null
|
|
305
|
+
: Math.max(0, Math.floor(now - runtime.lastRejectedAt)),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Reached only when the scheduler publishes no ceiling of its own — which is
|
|
310
|
+
* also the only case in which a `shared` lane has none either, since a shared
|
|
311
|
+
* lane's ceiling resolves from that same value. A pool ceiling can therefore
|
|
312
|
+
* never become a summand here, which it must not: summing it would report N×
|
|
313
|
+
* the real capacity and silence the rollup's own saturation branch.
|
|
314
|
+
*/
|
|
315
|
+
sumLaneLimits(field, lanes) {
|
|
316
|
+
if (lanes.length === 0 || lanes.some((lane) => lane[field] === null))
|
|
317
|
+
return null;
|
|
318
|
+
return lanes.reduce((sum, lane) => sum + (lane[field] ?? 0), 0);
|
|
319
|
+
}
|
|
320
|
+
safeMetric(record) {
|
|
321
|
+
try {
|
|
322
|
+
record();
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
// Metrics are strictly fail-open.
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Base class for in-memory schedulers. Subclasses retain complete ownership of
|
|
331
|
+
* queue ordering, admission, coalescing, and release semantics and call these
|
|
332
|
+
* protected lifecycle methods at their existing boundaries.
|
|
333
|
+
*/
|
|
334
|
+
export class ObservableScheduler {
|
|
335
|
+
pressure;
|
|
336
|
+
constructor(options) {
|
|
337
|
+
this.pressure = new SchedulerPressureTracker(options);
|
|
338
|
+
}
|
|
339
|
+
get backpressureId() {
|
|
340
|
+
return this.pressure.scheduler;
|
|
341
|
+
}
|
|
342
|
+
getBackpressureSnapshot() {
|
|
343
|
+
return this.pressure.snapshot();
|
|
344
|
+
}
|
|
345
|
+
updatePressureCapacity(capacity) {
|
|
346
|
+
this.pressure.updateCapacity(capacity);
|
|
347
|
+
}
|
|
348
|
+
pressureEnqueue(work) {
|
|
349
|
+
return this.pressure.enqueue(work);
|
|
350
|
+
}
|
|
351
|
+
pressureStart(ticket) {
|
|
352
|
+
this.pressure.start(ticket);
|
|
353
|
+
}
|
|
354
|
+
pressureReject(work, reason) {
|
|
355
|
+
this.pressure.reject(work, reason);
|
|
356
|
+
}
|
|
357
|
+
pressureRejectQueued(ticket, reason) {
|
|
358
|
+
this.pressure.rejectQueued(ticket, reason);
|
|
359
|
+
}
|
|
360
|
+
pressureCancelQueued(ticket, reason) {
|
|
361
|
+
this.pressure.cancelQueued(ticket, reason);
|
|
362
|
+
}
|
|
363
|
+
pressureFinish(ticket, outcome) {
|
|
364
|
+
this.pressure.finish(ticket, outcome);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
export class BackpressureRegistry {
|
|
368
|
+
sources = new Map();
|
|
369
|
+
register(source) {
|
|
370
|
+
const id = normalizeBackpressureLabel(source.backpressureId, 'scheduler');
|
|
371
|
+
const existing = this.sources.get(id);
|
|
372
|
+
if (existing && existing !== source) {
|
|
373
|
+
throw new Error(`Backpressure source "${id}" is already registered`);
|
|
374
|
+
}
|
|
375
|
+
this.sources.set(id, source);
|
|
376
|
+
return () => {
|
|
377
|
+
if (this.sources.get(id) === source)
|
|
378
|
+
this.sources.delete(id);
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
capture() {
|
|
382
|
+
const schedulers = [];
|
|
383
|
+
const failures = [];
|
|
384
|
+
for (const [id, source] of [...this.sources.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
385
|
+
try {
|
|
386
|
+
schedulers.push(source.getBackpressureSnapshot());
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
failures.push({
|
|
390
|
+
scheduler: id,
|
|
391
|
+
error: error instanceof Error ? error.message : String(error),
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
capturedAt: new Date().toISOString(),
|
|
397
|
+
state: schedulers.reduce((current, scheduler) => maxState(current, scheduler.state), 'healthy'),
|
|
398
|
+
schedulers,
|
|
399
|
+
failures,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
export const backpressureRegistry = new BackpressureRegistry();
|
|
404
|
+
export function recordBackpressureSnapshotMetrics(snapshot) {
|
|
405
|
+
const metrics = getMetrics();
|
|
406
|
+
const record = (lane, values) => {
|
|
407
|
+
const attributes = { scheduler: snapshot.scheduler, lane };
|
|
408
|
+
metrics.backpressureQueueDepth.record(values.queued, attributes);
|
|
409
|
+
// `queue_depth` stays this lane's own backlog — the attribution signal —
|
|
410
|
+
// so the numerator that actually goes with `queue_limit` is published
|
|
411
|
+
// beside it. Without this a shared lane exports `queue_depth: 1` against a
|
|
412
|
+
// pool `queue_limit: 4` and a utilization alert reads 25% while the lane is
|
|
413
|
+
// `saturated`; on a private allocation the two are equal.
|
|
414
|
+
metrics.backpressurePressureDepth.record(values.pressureQueued ?? values.queued, attributes);
|
|
415
|
+
metrics.backpressureInflight.record(values.inflight, attributes);
|
|
416
|
+
metrics.backpressurePressureInflight.record(values.pressureInflight ?? values.inflight, attributes);
|
|
417
|
+
metrics.backpressureOldestQueuedAgeMs.record(values.oldestQueuedAgeMs, attributes);
|
|
418
|
+
metrics.backpressureOldestActiveAgeMs.record(values.oldestActiveAgeMs, attributes);
|
|
419
|
+
if (values.queueLimit !== null) {
|
|
420
|
+
metrics.backpressureQueueLimit.record(values.queueLimit, attributes);
|
|
421
|
+
}
|
|
422
|
+
if (values.inflightLimit !== null) {
|
|
423
|
+
metrics.backpressureInflightLimit.record(values.inflightLimit, attributes);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
record('all', {
|
|
427
|
+
queued: snapshot.totals.queued,
|
|
428
|
+
// The rollup row is the whole queue, so its depth is its own pressure.
|
|
429
|
+
pressureQueued: snapshot.totals.queued,
|
|
430
|
+
pressureInflight: snapshot.totals.inflight,
|
|
431
|
+
queueLimit: snapshot.totals.queueLimit,
|
|
432
|
+
inflight: snapshot.totals.inflight,
|
|
433
|
+
inflightLimit: snapshot.totals.inflightLimit,
|
|
434
|
+
oldestQueuedAgeMs: snapshot.totals.oldestQueuedAgeMs,
|
|
435
|
+
oldestActiveAgeMs: snapshot.totals.oldestActiveAgeMs,
|
|
436
|
+
});
|
|
437
|
+
for (const lane of snapshot.lanes)
|
|
438
|
+
record(lane.lane, lane);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* One process-wide sampler provides transition/recovery logging and periodic
|
|
442
|
+
* summaries. It logs state changes rather than individual queue operations.
|
|
443
|
+
*/
|
|
444
|
+
export class BackpressureMonitor {
|
|
445
|
+
registry;
|
|
446
|
+
intervalMs;
|
|
447
|
+
summaryIntervalMs;
|
|
448
|
+
now;
|
|
449
|
+
emit;
|
|
450
|
+
logged = new Map();
|
|
451
|
+
timer = null;
|
|
452
|
+
constructor(options) {
|
|
453
|
+
this.registry = options.registry ?? backpressureRegistry;
|
|
454
|
+
this.intervalMs = Math.max(1_000, options.intervalMs ?? 5_000);
|
|
455
|
+
this.summaryIntervalMs = Math.max(this.intervalMs, options.summaryIntervalMs ?? 60_000);
|
|
456
|
+
this.now = options.now ?? Date.now;
|
|
457
|
+
this.emit = options.emit;
|
|
458
|
+
}
|
|
459
|
+
start() {
|
|
460
|
+
if (this.timer)
|
|
461
|
+
return;
|
|
462
|
+
this.sample();
|
|
463
|
+
this.timer = setInterval(() => this.sample(), this.intervalMs);
|
|
464
|
+
if (typeof this.timer.unref === 'function')
|
|
465
|
+
this.timer.unref();
|
|
466
|
+
}
|
|
467
|
+
stop() {
|
|
468
|
+
if (!this.timer)
|
|
469
|
+
return;
|
|
470
|
+
clearInterval(this.timer);
|
|
471
|
+
this.timer = null;
|
|
472
|
+
}
|
|
473
|
+
sample() {
|
|
474
|
+
const captured = this.registry.capture();
|
|
475
|
+
const now = this.now();
|
|
476
|
+
for (const scheduler of captured.schedulers) {
|
|
477
|
+
try {
|
|
478
|
+
recordBackpressureSnapshotMetrics(scheduler);
|
|
479
|
+
}
|
|
480
|
+
catch {
|
|
481
|
+
// The monitor must keep logging even if a metrics provider misbehaves.
|
|
482
|
+
}
|
|
483
|
+
const worstLaneState = scheduler.lanes.reduce((state, lane) => maxState(state, lane.state), 'healthy');
|
|
484
|
+
const samples = scheduler.lanes.map((lane) => ({
|
|
485
|
+
key: `${scheduler.scheduler}/${lane.lane}`,
|
|
486
|
+
state: lane.state,
|
|
487
|
+
lane,
|
|
488
|
+
}));
|
|
489
|
+
if (STATE_RANK[scheduler.state] > STATE_RANK[worstLaneState]) {
|
|
490
|
+
samples.push({
|
|
491
|
+
key: `${scheduler.scheduler}/all`,
|
|
492
|
+
state: scheduler.state,
|
|
493
|
+
lane: null,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
for (const sample of samples) {
|
|
497
|
+
this.observeSample(sample.key, sample.state, scheduler, sample.lane, now);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
observeSample(key, state, scheduler, lane, now) {
|
|
502
|
+
const previous = this.logged.get(key);
|
|
503
|
+
if (state === 'healthy') {
|
|
504
|
+
if (previous && previous.state !== 'healthy') {
|
|
505
|
+
this.safeEmit('info', this.message('recovered', scheduler, lane, state, previous.state), scheduler, lane);
|
|
506
|
+
}
|
|
507
|
+
this.logged.set(key, { state, lastLoggedAt: previous?.lastLoggedAt ?? now });
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
const transition = !previous || previous.state !== state;
|
|
511
|
+
const summaryDue = !previous || now - previous.lastLoggedAt >= this.summaryIntervalMs;
|
|
512
|
+
if (transition || summaryDue) {
|
|
513
|
+
this.safeEmit('warn', this.message(transition ? 'transition' : 'summary', scheduler, lane, state, previous?.state), scheduler, lane);
|
|
514
|
+
this.logged.set(key, { state, lastLoggedAt: now });
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
message(event, scheduler, lane, state, previousState) {
|
|
518
|
+
const values = lane ?? {
|
|
519
|
+
lane: 'all',
|
|
520
|
+
queued: scheduler.totals.queued,
|
|
521
|
+
queueLimit: scheduler.totals.queueLimit,
|
|
522
|
+
inflight: scheduler.totals.inflight,
|
|
523
|
+
inflightLimit: scheduler.totals.inflightLimit,
|
|
524
|
+
oldestQueuedAgeMs: scheduler.totals.oldestQueuedAgeMs,
|
|
525
|
+
oldestActiveAgeMs: scheduler.totals.oldestActiveAgeMs,
|
|
526
|
+
rejectedTotal: scheduler.totals.rejectedTotal,
|
|
527
|
+
queuedOperations: scheduler.lanes.flatMap((item) => item.queuedOperations)
|
|
528
|
+
.sort((a, b) => b.oldestAgeMs - a.oldestAgeMs)
|
|
529
|
+
.slice(0, MAX_OPERATION_SUMMARIES),
|
|
530
|
+
activeOperations: scheduler.lanes.flatMap((item) => item.activeOperations)
|
|
531
|
+
.sort((a, b) => b.oldestAgeMs - a.oldestAgeMs)
|
|
532
|
+
.slice(0, MAX_OPERATION_SUMMARIES),
|
|
533
|
+
};
|
|
534
|
+
// A source that predates `pressureQueued` reports its own backlog, which is
|
|
535
|
+
// what a private allocation is classified against anyway.
|
|
536
|
+
const pressureQueued = lane?.pressureQueued ?? values.queued;
|
|
537
|
+
const pressureInflight = lane?.pressureInflight ?? values.inflight;
|
|
538
|
+
return `[backpressure] ${JSON.stringify({
|
|
539
|
+
event,
|
|
540
|
+
scheduler: scheduler.scheduler,
|
|
541
|
+
lane: values.lane,
|
|
542
|
+
state,
|
|
543
|
+
...(previousState ? { previousState } : {}),
|
|
544
|
+
queued: values.queued,
|
|
545
|
+
// Only when the depth that classified the lane is not the lane's own
|
|
546
|
+
// backlog — i.e. a shared pool. Without it the line reads as a
|
|
547
|
+
// contradiction (`state: saturated` next to `queued: 1, queueLimit: 4`),
|
|
548
|
+
// and the rollup line that would have carried the pool's depth is
|
|
549
|
+
// suppressed exactly when a lane matches the rollup's state. A private
|
|
550
|
+
// allocation emits nothing extra, so those records are unchanged.
|
|
551
|
+
...(pressureQueued === values.queued ? {} : { pressureQueued }),
|
|
552
|
+
queueLimit: values.queueLimit,
|
|
553
|
+
inflight: values.inflight,
|
|
554
|
+
...(pressureInflight === values.inflight ? {} : { pressureInflight }),
|
|
555
|
+
inflightLimit: values.inflightLimit,
|
|
556
|
+
oldestQueuedAgeMs: values.oldestQueuedAgeMs,
|
|
557
|
+
oldestActiveAgeMs: values.oldestActiveAgeMs,
|
|
558
|
+
rejectedTotal: values.rejectedTotal,
|
|
559
|
+
queuedOperations: values.queuedOperations,
|
|
560
|
+
activeOperations: values.activeOperations,
|
|
561
|
+
})}`;
|
|
562
|
+
}
|
|
563
|
+
safeEmit(level, message, scheduler, lane) {
|
|
564
|
+
try {
|
|
565
|
+
this.emit(level, message, scheduler, lane);
|
|
566
|
+
}
|
|
567
|
+
catch {
|
|
568
|
+
// Logging must never break scheduling or the monitor loop.
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
//# sourceMappingURL=backpressure-observability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backpressure-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I,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type AssertionSeal, type GraphScopedAssertionSealCandidate } from './assertion-seal.js';
|
|
2
2
|
import { type AssertionCoordinateV1, type CatalogLaneV1, type ContextGraphIdV1, type SubGraphNameV1 } from './author-catalog-codec.js';
|
|
3
3
|
import { type StrictJsonParseOptions } from './canonical-json.js';
|
|
4
|
+
import { type CanonicalDeterministicUalV1 } from './ka-content-scope.js';
|
|
4
5
|
import { type ChainIdV1, type DecimalU64V1, type Digest32V1, type EvmAddressV1, type KaIdV1 } from './sync-wire-scalars.js';
|
|
5
6
|
declare const HEX_32_V1_BRAND: unique symbol;
|
|
6
7
|
declare const POSITIVE_DECIMAL_U64_V1_BRAND: unique symbol;
|
|
7
8
|
declare const SEAL_TRIPLE_COUNT_V1_BRAND: unique symbol;
|
|
8
9
|
declare const CANONICAL_ISO_UTC_MILLIS_V1_BRAND: unique symbol;
|
|
9
|
-
declare const CANONICAL_DETERMINISTIC_UAL_V1_BRAND: unique symbol;
|
|
10
10
|
export type Hex32V1 = string & {
|
|
11
11
|
readonly [HEX_32_V1_BRAND]: true;
|
|
12
12
|
};
|
|
@@ -19,9 +19,7 @@ export type SealTripleCountV1 = DecimalU64V1 & {
|
|
|
19
19
|
export type CanonicalIsoUtcMillisV1 = string & {
|
|
20
20
|
readonly [CANONICAL_ISO_UTC_MILLIS_V1_BRAND]: true;
|
|
21
21
|
};
|
|
22
|
-
export type CanonicalDeterministicUalV1
|
|
23
|
-
readonly [CANONICAL_DETERMINISTIC_UAL_V1_BRAND]: true;
|
|
24
|
-
};
|
|
22
|
+
export type { CanonicalDeterministicUalV1 } from './ka-content-scope.js';
|
|
25
23
|
export declare const CANONICAL_GRAPH_SCOPED_AUTHOR_SEAL_DIGEST_DOMAIN_V1: "dkg-ka-author-seal-v1\n";
|
|
26
24
|
export declare const MAX_CANONICAL_GRAPH_SCOPED_AUTHOR_SEAL_BYTES_V1: number;
|
|
27
25
|
export declare const MAX_SEAL_TRIPLE_COUNT_V1 = 9007199254740991n;
|
|
@@ -132,5 +130,4 @@ export declare function decodeCanonicalGraphScopedAuthorSealRowsV1(rows: readonl
|
|
|
132
130
|
* no catalog-row, signature/root, deployment, or chain-authority admission.
|
|
133
131
|
*/
|
|
134
132
|
export declare function classifyCanonicalGraphScopedAuthorSealRowsV1(rows: readonly CanonicalAuthorSealStoreRowV1[], coordinate: CanonicalGraphScopedAuthorSealCoordinateV1): ClassifiedCanonicalGraphScopedAuthorSealRowsV1;
|
|
135
|
-
export {};
|
|
136
133
|
//# sourceMappingURL=canonical-graph-scoped-author-seal.d.ts.map
|