@agoric/swingset-vat 0.33.0-u19.2 → 0.33.0-u20.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.
@@ -13,6 +13,12 @@ export function makeStartSubprocessWorkerNode(
13
13
  ).pathname;
14
14
  const args = nodeOptions ? [...nodeOptions] : [];
15
15
  if (profileVats.includes(vatID)) {
16
+ // Enable profiling with a 1 microsecond sampling interval,
17
+ // saving results to a file in the working directory
18
+ // with a portable name derived from the vat name
19
+ // and in particular replacing any colons with dashes.
20
+ // cf. ../kernel/vat-loader/manager-subprocess-node.js
21
+ // https://github.com/Agoric/agoric-sdk/blob/18d561f1b95755e58ca691b26938fc249618018d/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-node.js#L32-L34
16
22
  args.push('--cpu-prof');
17
23
  args.push('--cpu-prof-interval');
18
24
  args.push('1');
@@ -99,6 +99,7 @@ export default function buildKernel(
99
99
  startSubprocessWorkerNode,
100
100
  startXSnap,
101
101
  writeSlogObject,
102
+ slogDuration,
102
103
  WeakRef,
103
104
  FinalizationRegistry,
104
105
  gcAndFinalize,
@@ -111,11 +112,12 @@ export default function buildKernel(
111
112
  overrideVatManagerOptions = {},
112
113
  } = kernelRuntimeOptions;
113
114
  const logStartup = verbose ? console.debug : () => {};
115
+ if (verbose) kdebugEnable(true);
114
116
 
115
117
  const vatAdminRootKref = kernelStorage.kvStore.get('vatAdminRootKref');
116
118
 
117
119
  const kernelSlog = writeSlogObject
118
- ? makeSlogger(slogCallbacks, writeSlogObject)
120
+ ? makeSlogger(slogCallbacks, writeSlogObject, slogDuration)
119
121
  : makeDummySlogger(slogCallbacks, makeConsole('disabled slogger'));
120
122
 
121
123
  const kernelKeeper = makeKernelKeeper(
@@ -559,6 +561,10 @@ export default function buildKernel(
559
561
  */
560
562
  async function processSend(vatID, target, msg) {
561
563
  insistMessage(msg);
564
+ // DEPRECATED: These counts are available as "crank-start"/"crank-finish"
565
+ // slog entries with crankType "delivery" (the latter count filtered on
566
+ // messageType "send") and "deliver"/"deliver-result" slog entries (the
567
+ // latter count filtered on dispatch "message").
562
568
  kernelKeeper.incStat('dispatches');
563
569
  kernelKeeper.incStat('dispatchDeliver');
564
570
 
@@ -589,6 +595,8 @@ export default function buildKernel(
589
595
  const { vatID, kpid } = message;
590
596
  insistVatID(vatID);
591
597
  insistKernelType('promise', kpid);
598
+ // DEPRECATED: This count is available as "crank-start"/"crank-finish"
599
+ // slog entries with crankType "delivery".
592
600
  kernelKeeper.incStat('dispatches');
593
601
  const vatInfo = vatWarehouse.lookup(vatID);
594
602
  if (!vatInfo) {
@@ -598,6 +606,8 @@ export default function buildKernel(
598
606
  const { meterID } = vatInfo;
599
607
 
600
608
  const p = kernelKeeper.getKernelPromise(kpid);
609
+ // DEPRECATED: This count is available as "deliver"/"deliver-result" slog
610
+ // entries with dispatch "notify".
601
611
  kernelKeeper.incStat('dispatchNotify');
602
612
  const vatKeeper = kernelKeeper.provideVatKeeper(vatID);
603
613
  if (p.state === 'unresolved') {
@@ -1342,14 +1352,15 @@ export default function buildKernel(
1342
1352
  * @returns {Promise<PolicyInput>}
1343
1353
  */
1344
1354
  async function processDeliveryMessage(message) {
1355
+ const messageType = message.type;
1345
1356
  kdebug('');
1346
1357
  // prettier-ignore
1347
1358
  kdebug(`processQ crank ${kernelKeeper.getCrankNumber()} ${JSON.stringify(message)}`);
1348
1359
  kdebug(legibilizeMessage(message));
1349
- kernelSlog.write({
1350
- type: 'crank-start',
1360
+ const finish = kernelSlog.startDuration(['crank-start', 'crank-finish'], {
1351
1361
  crankType: 'delivery',
1352
1362
  crankNum: kernelKeeper.getCrankNumber(),
1363
+ messageType,
1353
1364
  message,
1354
1365
  });
1355
1366
  /** @type { PolicyInput } */
@@ -1451,12 +1462,8 @@ export default function buildKernel(
1451
1462
  const crankNum = kernelKeeper.getCrankNumber();
1452
1463
  kernelKeeper.incrementCrankNumber();
1453
1464
  const { crankhash, activityhash } = kernelKeeper.emitCrankHashes();
1454
- // kernelSlog.write({
1455
- // type: 'kernel-stats',
1456
- // stats: kernelKeeper.getStats(),
1457
- // });
1458
- kernelSlog.write({
1459
- type: 'crank-finish',
1465
+ finish({
1466
+ message: undefined,
1460
1467
  crankNum,
1461
1468
  crankhash,
1462
1469
  activityhash,
@@ -1494,14 +1501,15 @@ export default function buildKernel(
1494
1501
  * @returns {Promise<PolicyInput>}
1495
1502
  */
1496
1503
  async function processAcceptanceMessage(message) {
1504
+ const messageType = message.type;
1497
1505
  kdebug('');
1498
1506
  // prettier-ignore
1499
- kdebug(`processAcceptanceQ crank ${kernelKeeper.getCrankNumber()} ${message.type}`);
1507
+ kdebug(`processAcceptanceQ crank ${kernelKeeper.getCrankNumber()} ${messageType}`);
1500
1508
  // kdebug(legibilizeMessage(message));
1501
- kernelSlog.write({
1502
- type: 'crank-start',
1509
+ const finish = kernelSlog.startDuration(['crank-start', 'crank-finish'], {
1503
1510
  crankType: 'routing',
1504
1511
  crankNum: kernelKeeper.getCrankNumber(),
1512
+ messageType,
1505
1513
  message,
1506
1514
  });
1507
1515
  /** @type { PolicyInput } */
@@ -1538,8 +1546,8 @@ export default function buildKernel(
1538
1546
  const crankNum = kernelKeeper.getCrankNumber();
1539
1547
  kernelKeeper.incrementCrankNumber();
1540
1548
  const { crankhash, activityhash } = kernelKeeper.emitCrankHashes();
1541
- kernelSlog.write({
1542
- type: 'crank-finish',
1549
+ finish({
1550
+ message: undefined,
1543
1551
  crankNum,
1544
1552
  crankhash,
1545
1553
  activityhash,
@@ -2161,6 +2169,11 @@ export default function buildKernel(
2161
2169
  ephemeral.log.push(`${str}`);
2162
2170
  },
2163
2171
 
2172
+ /**
2173
+ * Return a fresh stats snapshot.
2174
+ *
2175
+ * @returns {Record<string, number>}
2176
+ */
2164
2177
  getStats() {
2165
2178
  return kernelKeeper.getStats();
2166
2179
  },
@@ -1,9 +1,12 @@
1
- import { q } from '@endo/errors';
1
+ import { q, Fail } from '@endo/errors';
2
+ import { makePromiseKit } from '@endo/promise-kit';
2
3
  import { objectMap } from '@agoric/internal';
4
+ import { defineName } from '@agoric/internal/src/js-utils.js';
3
5
  import { makeLimitedConsole } from '@agoric/internal/src/ses-utils.js';
4
6
 
5
7
  /** @import {Callable} from '@agoric/internal'; */
6
8
  /** @import {LimitedConsole} from '@agoric/internal/src/js-utils.js'; */
9
+ /** @import {SlogProps, SlogDurationProps, SwingsetController} from '../controller/controller.js'; */
7
10
 
8
11
  const IDLE = 'idle';
9
12
  const STARTUP = 'startup';
@@ -12,7 +15,7 @@ const DELIVERY = 'delivery';
12
15
  const noopFinisher = harden(() => {});
13
16
 
14
17
  /** @typedef {(...finishArgs: unknown[]) => unknown} AnyFinisher */
15
- /** @typedef {Partial<Record<Exclude<keyof KernelSlog, 'write'>, (methodName: string, args: unknown[], finisher: AnyFinisher) => unknown>>} SlogWrappers */
18
+ /** @typedef {Partial<Record<Exclude<keyof KernelSlog, 'write' | 'startDuration'>, (methodName: string, args: unknown[], finisher: AnyFinisher) => unknown>>} SlogWrappers */
16
19
 
17
20
  /**
18
21
  * Support asynchronous slog callbacks that are invoked at the start
@@ -96,24 +99,81 @@ export function makeDummySlogger(slogCallbacks, dummyConsole = badConsole) {
96
99
  changeCList: () => noopFinisher,
97
100
  terminateVat: () => noopFinisher,
98
101
  });
99
- return harden({ ...wrappedMethods, write: noopFinisher });
102
+ return harden({
103
+ ...wrappedMethods,
104
+ write: noopFinisher,
105
+ startDuration: () => noopFinisher,
106
+ });
100
107
  }
101
108
 
109
+ /**
110
+ * @callback StartDuration
111
+ * Capture an extended process, writing an entry with `type` $startLabel and
112
+ * then later (when the returned finish function is called) another entry with
113
+ * `type` $endLabel and `seconds` reporting the intervening duration.
114
+ *
115
+ * @param {readonly [startLabel: string, endLabel: string]} labels
116
+ * @param {SlogDurationProps} startProps
117
+ * @returns {import('../types-external').FinishSlogDuration}
118
+ */
119
+
102
120
  /**
103
121
  * @param {SlogWrappers} slogCallbacks
104
- * @param {(obj: object) => void} [writeObj]
122
+ * @param {SwingsetController['writeSlogObject']} [writeSlogObject]
123
+ * @param {SwingsetController['slogDuration']} [slogDuration] required when writeSlogObject is provided
105
124
  * @returns {KernelSlog}
106
125
  */
107
- export function makeSlogger(slogCallbacks, writeObj) {
108
- const safeWrite = writeObj
109
- ? obj => {
110
- try {
111
- writeObj(obj);
112
- } catch (err) {
113
- console.error('WARNING: slogger write error', err);
126
+ export function makeSlogger(slogCallbacks, writeSlogObject, slogDuration) {
127
+ if (writeSlogObject && !slogDuration) {
128
+ throw Fail`slogDuration is required with writeSlogObject`;
129
+ }
130
+ const { safeWrite, startDuration } = (() => {
131
+ if (!writeSlogObject) {
132
+ const dummySafeWrite = () => {};
133
+ /** @type {StartDuration} */
134
+ const dummyStartDuration = () => defineName('dummyFinish', () => {});
135
+ return { safeWrite: dummySafeWrite, startDuration: dummyStartDuration };
136
+ }
137
+ /** @type {(obj: SlogProps) => void} */
138
+ // eslint-disable-next-line no-shadow
139
+ const safeWrite = obj => {
140
+ try {
141
+ writeSlogObject(obj);
142
+ } catch (err) {
143
+ console.error('WARNING: slogger write error', err);
144
+ }
145
+ };
146
+ /** @type {StartDuration} */
147
+ // eslint-disable-next-line no-shadow
148
+ const startDuration = (labels, startProps) => {
149
+ try {
150
+ /** @type {(extraProps?: SlogDurationProps) => void} */
151
+ let closeSpan;
152
+ // @ts-expect-error TS2722 slogDuration is not undefined here
153
+ void slogDuration(labels, startProps, async finish => {
154
+ const doneKit = makePromiseKit();
155
+ closeSpan = props => {
156
+ try {
157
+ finish(props);
158
+ } finally {
159
+ doneKit.resolve(undefined);
160
+ }
161
+ };
162
+ // Hold the span open until `finish` is called.
163
+ await doneKit.promise;
164
+ });
165
+ // @ts-expect-error TS2454 closeSpan must have been assigned above
166
+ if (typeof closeSpan !== 'function') {
167
+ throw Fail`slogDuration did not synchronously provide a finisher`;
114
168
  }
169
+ return closeSpan;
170
+ } catch (err) {
171
+ console.error('WARNING: slogger write error', err);
172
+ return defineName('dummyFinish', () => {});
115
173
  }
116
- : () => {};
174
+ };
175
+ return { safeWrite, startDuration };
176
+ })();
117
177
 
118
178
  const vatSlogs = new Map(); // vatID -> vatSlog
119
179
 
@@ -149,15 +209,17 @@ export function makeSlogger(slogCallbacks, writeObj) {
149
209
 
150
210
  function startup() {
151
211
  // provide a context for console calls during startup
152
- checkOldState(IDLE, 'did startup get called twice?');
212
+ checkOldState(IDLE, 'vat-startup called twice?');
153
213
  state = STARTUP;
154
- safeWrite({ type: 'vat-startup-start', vatID });
155
- function finish() {
156
- checkOldState(STARTUP, 'startup-finish called twice?');
214
+ const finish = startDuration(
215
+ ['vat-startup-start', 'vat-startup-finish'],
216
+ { vatID },
217
+ );
218
+ return harden(() => {
219
+ checkOldState(STARTUP, 'vat-startup-finish called twice?');
157
220
  state = IDLE;
158
- safeWrite({ type: 'vat-startup-finish', vatID });
159
- }
160
- return harden(finish);
221
+ finish();
222
+ });
161
223
  }
162
224
 
163
225
  // kd: kernelDelivery, vd: vatDelivery
@@ -167,32 +229,44 @@ export function makeSlogger(slogCallbacks, writeObj) {
167
229
  crankNum = newCrankNum;
168
230
  deliveryNum = newDeliveryNum;
169
231
  replay = inReplay;
170
- const when = { crankNum, vatID, deliveryNum, replay };
171
- safeWrite({ type: 'deliver', ...when, kd, vd });
172
232
  syscallNum = 0;
173
-
233
+ const dispatch = vd?.[0]; // using vd because kd is undefined in replay
234
+ const finish = startDuration(['deliver', 'deliver-result'], {
235
+ crankNum,
236
+ vatID,
237
+ deliveryNum,
238
+ replay,
239
+ dispatch,
240
+ kd,
241
+ vd,
242
+ });
174
243
  // dr: deliveryResult
175
- function finish(dr) {
176
- checkOldState(DELIVERY, 'delivery-finish called twice?');
177
- safeWrite({ type: 'deliver-result', ...when, dr });
244
+ return harden(dr => {
245
+ checkOldState(DELIVERY, 'deliver-result called twice?');
178
246
  state = IDLE;
179
- }
180
- return harden(finish);
247
+ finish({ kd: undefined, vd: undefined, dr });
248
+ });
181
249
  }
182
250
 
183
251
  // ksc: kernelSyscallObject, vsc: vatSyscallObject
184
252
  function syscall(ksc, vsc) {
185
253
  checkOldState(DELIVERY, 'syscall invoked outside of delivery');
186
- const when = { crankNum, vatID, deliveryNum, syscallNum, replay };
187
- safeWrite({ type: 'syscall', ...when, ksc, vsc });
254
+ const finish = startDuration(['syscall', 'syscall-result'], {
255
+ crankNum,
256
+ vatID,
257
+ deliveryNum,
258
+ syscallNum,
259
+ replay,
260
+ syscall: vsc?.[0],
261
+ ksc,
262
+ vsc,
263
+ });
188
264
  syscallNum += 1;
189
-
190
265
  // ksr: kernelSyscallResult, vsr: vatSyscallResult
191
- function finish(ksr, vsr) {
266
+ return harden((ksr, vsr) => {
192
267
  checkOldState(DELIVERY, 'syscall finished after delivery?');
193
- safeWrite({ type: 'syscall-result', ...when, ksr, vsr });
194
- }
195
- return harden(finish);
268
+ finish({ ksc: undefined, vsc: undefined, ksr, vsr });
269
+ });
196
270
  }
197
271
 
198
272
  // mode: 'import' | 'export' | 'drop'
@@ -258,5 +332,5 @@ export function makeSlogger(slogCallbacks, writeObj) {
258
332
  terminateVat: (vatID, ...args) =>
259
333
  provideVatSlogger(vatID).vatSlog.terminateVat(...args),
260
334
  });
261
- return harden({ ...wrappedMethods, write: safeWrite });
335
+ return harden({ ...wrappedMethods, write: safeWrite, startDuration });
262
336
  }
@@ -1,5 +1,6 @@
1
1
  import { Nat, isNat } from '@endo/nat';
2
2
  import { assert, Fail } from '@endo/errors';
3
+ import { KERNEL_STATS_METRICS } from '@agoric/internal/src/metrics.js';
3
4
  import { naturalCompare } from '@agoric/internal/src/natural-sort.js';
4
5
  import { makeDummySlogger, noopConsole } from '../slogger.js';
5
6
  import {
@@ -25,7 +26,6 @@ import {
25
26
  makeUpgradeID,
26
27
  } from '../../lib/id.js';
27
28
  import { kdebug } from '../../lib/kdebug.js';
28
- import { KERNEL_STATS_METRICS } from '../metrics.js';
29
29
  import { makeKernelStats } from './stats.js';
30
30
  import {
31
31
  enumeratePrefixedKeys,
@@ -70,10 +70,9 @@ export const makeKernelStats = kernelStatsMetrics => {
70
70
  Object.freeze(allStatsKeys);
71
71
 
72
72
  const pickStats = (stat, gauge = false) => {
73
- assert(
74
- kernelConsensusStats && kernelLocalStats,
75
- 'Kernel stats not initialized',
76
- );
73
+ if (!kernelConsensusStats || !kernelLocalStats) {
74
+ throw Fail`Kernel stats not initialized`;
75
+ }
77
76
  const metricType = allStatsKeys[stat];
78
77
  if (gauge) {
79
78
  metricType === 'gauge' || Fail`Invalid kernel gauge stat ${stat}`;
@@ -116,7 +115,12 @@ export const makeKernelStats = kernelStatsMetrics => {
116
115
  kernelStats[downStat] += delta;
117
116
  };
118
117
 
119
- /** @param {boolean | undefined} [consensusOnly] */
118
+ /**
119
+ * Return a fresh snapshot, with or without local stats.
120
+ *
121
+ * @param {boolean | undefined} [consensusOnly]
122
+ * @returns {Record<string, number>}
123
+ */
120
124
  const getStats = consensusOnly => {
121
125
  return {
122
126
  ...(consensusOnly ? {} : kernelLocalStats),
@@ -130,10 +134,9 @@ export const makeKernelStats = kernelStatsMetrics => {
130
134
  };
131
135
 
132
136
  const getSerializedStats = () => {
133
- assert(
134
- kernelConsensusStats && kernelLocalStats,
135
- 'Kernel stats not initialized',
136
- );
137
+ if (!kernelConsensusStats || !kernelLocalStats) {
138
+ throw Fail`Kernel stats not initialized`;
139
+ }
137
140
 
138
141
  return {
139
142
  consensusStats: JSON.stringify(kernelConsensusStats),
@@ -2,6 +2,10 @@
2
2
 
3
3
  import { Fail } from '@endo/errors';
4
4
 
5
+ /**
6
+ * @import {KVStore} from '@agoric/swing-store';
7
+ */
8
+
5
9
  /**
6
10
  * Iterate over keys with a given prefix, in lexicographic order,
7
11
  * excluding an exact match of the prefix.
@@ -299,7 +299,10 @@ export function makeVatWarehouse({
299
299
  */
300
300
  async function replayTranscript(vatID, vatKeeper, manager) {
301
301
  const total = vatKeeper.transcriptSize();
302
- kernelSlog.write({ type: 'start-replay', vatID, deliveries: total });
302
+ const finish = kernelSlog.startDuration(['start-replay', 'finish-replay'], {
303
+ vatID,
304
+ deliveries: total,
305
+ });
303
306
  let first = true;
304
307
  for await (const [deliveryNum, te] of vatKeeper.getTranscript()) {
305
308
  // if (deliveryNum % 100 === 0) {
@@ -326,7 +329,7 @@ export function makeVatWarehouse({
326
329
  finishSlog(status);
327
330
  sim.finishSimulation(); // will throw if syscalls did not match
328
331
  }
329
- kernelSlog.write({ type: 'finish-replay', vatID });
332
+ finish({ deliveries: undefined });
330
333
  }
331
334
 
332
335
  /**
@@ -1,6 +1,10 @@
1
1
  import { assert, Fail } from '@endo/errors';
2
2
  import { insistCapData } from './capdata.js';
3
3
 
4
+ /**
5
+ * @import {VatSyscallObject, VatSyscallResult, VatDeliveryResult} from '@agoric/swingset-liveslots';
6
+ */
7
+
4
8
  /**
5
9
  * Assert function to ensure that something expected to be a message object
6
10
  * actually is. A message object should have a .method property that's a
@@ -5,6 +5,7 @@ export {};
5
5
  * @import {ERef} from '@endo/far';
6
6
  * @import {Passable, RemotableObject} from '@endo/pass-style';
7
7
  * @import {LimitedConsole} from '@agoric/internal/src/js-utils.js';
8
+ * @import {SlogProps, SlogDurationProps} from './controller/controller.js';
8
9
  */
9
10
 
10
11
  /* This file defines types that part of the external API of swingset. That
@@ -12,18 +13,23 @@ export {};
12
13
  * with, like VatAdminService. */
13
14
 
14
15
  /**
15
- * @typedef {'getExport' | 'nestedEvaluate' | 'endoZipBase64'} BundleFormat
16
+ * @typedef {(extraProps?: SlogDurationProps) => void} FinishSlogDuration
16
17
  */
17
18
 
18
19
  /**
19
20
  * @typedef {import('@endo/marshal').CapData<string>} SwingSetCapData
20
21
  */
21
22
 
23
+ // TODO move Bundle types into Endo
22
24
  /**
25
+ * @typedef {'getExport' | 'nestedEvaluate' | 'endoZipBase64'} BundleFormat
23
26
  * @typedef { { moduleFormat: 'getExport', source: string, sourceMap?: string } } GetExportBundle
24
27
  * @typedef { { moduleFormat: 'nestedEvaluate', source: string, sourceMap?: string } } NestedEvaluateBundle
25
- * @typedef { EndoZipBase64Bundle | GetExportBundle | NestedEvaluateBundle } Bundle
26
- *
28
+ * @typedef { { moduleFormat: 'test' } } TestBundle
29
+ * @typedef { EndoZipBase64Bundle | GetExportBundle | NestedEvaluateBundle | TestBundle} Bundle
30
+ */
31
+
32
+ /**
27
33
  * @typedef { 'local' | 'node-subprocess' | 'xsnap' | 'xs-worker' } ManagerType
28
34
  */
29
35
 
@@ -128,7 +134,9 @@ export {};
128
134
  * @typedef { Awaited<ReturnType<typeof import('@agoric/xsnap').xsnap>> } XSnap
129
135
  * @typedef { (dr: VatDeliveryResult) => void } SlogFinishDelivery
130
136
  * @typedef { (ksr: KernelSyscallResult, vsr: VatSyscallResult) => void } SlogFinishSyscall
131
- * @typedef { { write: ({}) => void,
137
+ * @typedef { { write: (obj: SlogProps) => void,
138
+ * startDuration: (labels: readonly [startLabel: string, endLabel: string],
139
+ * startProps: SlogDurationProps) => FinishSlogDuration,
132
140
  * provideVatSlogger: (vatID: string,
133
141
  * dynamic?: boolean,
134
142
  * description?: string,
@@ -6,8 +6,7 @@ import { Remotable } from '@endo/marshal';
6
6
  import { Far, E } from '@endo/far';
7
7
 
8
8
  /**
9
- * @template T
10
- * @typedef {T | PromiseLike<T>} ERef
9
+ * @import {ERef} from '@endo/far';
11
10
  */
12
11
 
13
12
  /** @type {{ onReset: (firstTime: Promise<boolean>) => void}} */
@@ -15,9 +15,10 @@ import { makeQueue } from '@endo/stream';
15
15
  */
16
16
  export const makeRunUtils = (controller, harness) => {
17
17
  const mutex = makeQueue();
18
+ mutex.put('dummy result'); // so the first `await mutex.get()` doesn't hang
19
+
18
20
  const logRunFailure = reason =>
19
21
  console.log('controller.run() failure', reason);
20
- mutex.put(controller.run().catch(logRunFailure));
21
22
 
22
23
  /**
23
24
  * Wait for exclusive access to the controller, then before relinquishing that access,
@@ -1,152 +0,0 @@
1
- // All the kernel metrics we are prepared for.
2
- export const KERNEL_STATS_SUM_METRICS = /** @type {const} */ ([
3
- {
4
- key: 'syscalls',
5
- name: 'swingset_all_syscall_total',
6
- description: 'Total number of SwingSet kernel calls',
7
- },
8
- {
9
- key: 'syscallSend',
10
- name: 'swingset_syscall_total',
11
- sub: { dimension: 'syscall', value: 'send' },
12
- description: 'Total number of SwingSet message send kernel calls',
13
- },
14
- {
15
- key: 'syscallCallNow',
16
- name: 'swingset_syscall_total',
17
- sub: { dimension: 'syscall', value: 'callNow' },
18
- description: 'Total number of SwingSet synchronous device kernel calls',
19
- },
20
- {
21
- key: 'syscallSubscribe',
22
- name: 'swingset_syscall_total',
23
- sub: { dimension: 'syscall', value: 'subscribe' },
24
- description: 'Total number of SwingSet promise subscription kernel calls',
25
- },
26
- {
27
- key: 'syscallResolve',
28
- name: 'swingset_syscall_total',
29
- sub: { dimension: 'syscall', value: 'resolve' },
30
- description: 'Total number of SwingSet promise resolution kernel calls',
31
- },
32
- {
33
- key: 'syscallExit',
34
- name: 'swingset_syscall_total',
35
- sub: { dimension: 'syscall', value: 'exit' },
36
- description: 'Total number of SwingSet vat exit kernel calls',
37
- },
38
- {
39
- key: 'syscallVatstoreGet',
40
- name: 'swingset_syscall_total',
41
- sub: { dimension: 'syscall', value: 'vatstoreGet' },
42
- description: 'Total number of SwingSet vatstore get kernel calls',
43
- },
44
- {
45
- key: 'syscallVatstoreSet',
46
- name: 'swingset_syscall_total',
47
- sub: { dimension: 'syscall', value: 'vatstoreSet' },
48
- description: 'Total number of SwingSet vatstore set kernel calls',
49
- },
50
- {
51
- key: 'syscallVatstoreGetNextKey',
52
- name: 'swingset_syscall_total',
53
- sub: { dimension: 'syscall', value: 'vatstoreGetNext' },
54
- description: 'Total number of SwingSet vatstore getNextKey kernel calls',
55
- },
56
- {
57
- key: 'syscallVatstoreDelete',
58
- name: 'swingset_syscall_total',
59
- sub: { dimension: 'syscall', value: 'vatstoreDelete' },
60
- description: 'Total number of SwingSet vatstore delete kernel calls',
61
- },
62
- {
63
- key: 'syscallDropImports',
64
- name: 'swingset_syscall_total',
65
- sub: { dimension: 'syscall', value: 'dropImports' },
66
- description: 'Total number of SwingSet drop imports kernel calls',
67
- },
68
- {
69
- key: 'dispatches',
70
- name: 'swingset_dispatch_total',
71
- description: 'Total number of SwingSet vat calls',
72
- },
73
- {
74
- key: 'dispatchDeliver',
75
- name: 'swingset_dispatch_deliver_total',
76
- description: 'Total number of SwingSet vat message deliveries',
77
- },
78
- {
79
- key: 'dispatchNotify',
80
- name: 'swingset_dispatch_notify_total',
81
- description: 'Total number of SwingSet vat promise notifications',
82
- },
83
- ]);
84
-
85
- export const KERNEL_STATS_UPDOWN_METRICS = /** @type {const} */ ([
86
- {
87
- key: 'kernelObjects',
88
- name: 'swingset_kernel_objects',
89
- description: 'Active kernel objects',
90
- },
91
- {
92
- key: 'kernelDevices',
93
- name: 'swingset_kernel_devices',
94
- description: 'Active kernel devices',
95
- },
96
- {
97
- key: 'kernelPromises',
98
- name: 'swingset_kernel_promises',
99
- description: 'Active kernel promises',
100
- },
101
- {
102
- key: 'kpUnresolved',
103
- name: 'swingset_unresolved_kernel_promises',
104
- description: 'Unresolved kernel promises',
105
- },
106
- {
107
- key: 'kpFulfilled',
108
- name: 'swingset_fulfilled_kernel_promises',
109
- description: 'Fulfilled kernel promises',
110
- },
111
- {
112
- key: 'kpRejected',
113
- name: 'swingset_rejected_kernel_promises',
114
- description: 'Rejected kernel promises',
115
- },
116
- {
117
- key: 'runQueueLength',
118
- name: 'swingset_run_queue_length',
119
- consensus: true,
120
- description: 'Length of the kernel run queue',
121
- },
122
- {
123
- key: 'acceptanceQueueLength',
124
- name: 'swingset_acceptance_queue_length',
125
- consensus: true,
126
- description: 'Length of the kernel acceptance queue',
127
- },
128
- {
129
- key: 'promiseQueuesLength',
130
- name: 'swingset_promise_queues_length',
131
- consensus: true,
132
- description: 'Combined length of all kernel promise queues',
133
- },
134
- {
135
- key: 'clistEntries',
136
- name: 'swingset_clist_entries',
137
- description: 'Number of entries in the kernel c-list',
138
- },
139
- {
140
- key: 'vats',
141
- name: 'swingset_vats',
142
- description: 'Number of active vats',
143
- },
144
- ]);
145
-
146
- const COUNTER = /** @type {const} */ ('counter');
147
- const GAUGE = /** @type {const} */ ('gauge');
148
-
149
- export const KERNEL_STATS_METRICS = harden([
150
- ...KERNEL_STATS_SUM_METRICS.map(m => ({ ...m, metricType: COUNTER })),
151
- ...KERNEL_STATS_UPDOWN_METRICS.map(m => ({ ...m, metricType: GAUGE })),
152
- ]);