toilscript 0.1.51 → 0.1.52
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/cli.js +74 -46
- package/dist/cli.js.map +2 -2
- package/dist/importmap.json +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/toildb.ts +73 -45
- package/std/assembly/toilscript.d.ts +55 -35
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.52/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.52/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var ASSEMBLYSCRIPT_VERSION = "0.1.
|
|
1
|
+
var ASSEMBLYSCRIPT_VERSION = "0.1.52";
|
|
2
2
|
var ASSEMBLYSCRIPT_IMPORTMAP = {
|
|
3
3
|
"imports": {
|
|
4
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
5
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.52/dist/toilscript.js",
|
|
5
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.52/dist/cli.js",
|
|
6
6
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
7
7
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
8
8
|
}
|
package/package.json
CHANGED
package/std/assembly/toildb.ts
CHANGED
|
@@ -440,7 +440,7 @@ export class Counter<K> {
|
|
|
440
440
|
|
|
441
441
|
/// Every per-domain metric, by stable numeric id. This is the WIRE CONTRACT shared with the edge
|
|
442
442
|
/// (`src/analytics/metric_id.rs`) and the dev server; it orders the snapshot frame and addresses a
|
|
443
|
-
/// time-series. Ids `0..=
|
|
443
|
+
/// time-series. Ids `0..=42` are cumulative COUNTERS (a rate is `value / seconds`); `43..=46` are the
|
|
444
444
|
/// avg/peak series of the two GAUGES. Append-only: never renumber.
|
|
445
445
|
export enum MetricId {
|
|
446
446
|
Requests = 0,
|
|
@@ -484,15 +484,17 @@ export enum MetricId {
|
|
|
484
484
|
DaemonHttpCallFailures = 38,
|
|
485
485
|
MemGrownBytes = 39,
|
|
486
486
|
Emails = 40,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
487
|
+
CacheHits = 41,
|
|
488
|
+
CacheMisses = 42,
|
|
489
|
+
ConnectedStreamsAvg = 43,
|
|
490
|
+
ConnectedStreamsPeak = 44,
|
|
491
|
+
CommittedMemoryAvg = 45,
|
|
492
|
+
CommittedMemoryPeak = 46,
|
|
491
493
|
}
|
|
492
494
|
|
|
493
|
-
/// The number of cumulative counter metrics (`MetricId 0..=
|
|
495
|
+
/// The number of cumulative counter metrics (`MetricId 0..=42`) = the length of the snapshot's lifetime
|
|
494
496
|
/// section.
|
|
495
|
-
export const METRIC_COUNTERS: i32 =
|
|
497
|
+
export const METRIC_COUNTERS: i32 = 43;
|
|
496
498
|
|
|
497
499
|
/// A dashboard time range for `Analytics.series`. Short ranges (1h/6h) read the per-MINUTE ring; the rest
|
|
498
500
|
/// read the per-HOUR ring (30-day retention).
|
|
@@ -512,56 +514,81 @@ export enum AnalyticsRange {
|
|
|
512
514
|
/// value either by the typed getter (`stats.requests`) or by id (`stats.metric(MetricId.Requests)`).
|
|
513
515
|
export class TenantStats {
|
|
514
516
|
/// Lifetime totals indexed by `MetricId` (length `METRIC_COUNTERS`). Prefer the named getters below.
|
|
515
|
-
life: StaticArray<
|
|
517
|
+
life: StaticArray<u64> = new StaticArray<u64>(METRIC_COUNTERS);
|
|
516
518
|
/// Live gauges (current level, not a total).
|
|
517
|
-
connectedStreams:
|
|
518
|
-
committedMemory:
|
|
519
|
+
connectedStreams: u64 = 0;
|
|
520
|
+
committedMemory: u64 = 0;
|
|
519
521
|
/// Request windows: current bucket usage + plan cap (0 = unlimited).
|
|
520
|
-
reqMinuteUsed:
|
|
522
|
+
reqMinuteUsed: u64 = 0;
|
|
521
523
|
reqMinuteCap: u64 = 0;
|
|
522
|
-
reqDayUsed:
|
|
524
|
+
reqDayUsed: u64 = 0;
|
|
523
525
|
reqDayCap: u64 = 0;
|
|
524
526
|
/// Edge wall-clock (ms) when the snapshot was read.
|
|
525
527
|
nowMs: u64 = 0;
|
|
526
528
|
|
|
527
529
|
/// Any counter metric by id (0 for an out-of-range id).
|
|
528
|
-
metric(id: MetricId):
|
|
530
|
+
metric(id: MetricId): u64 {
|
|
529
531
|
return <i32>id < METRIC_COUNTERS ? this.life[<i32>id] : 0;
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
// Typed getters for every counter (the catalog: no magic strings, self-documenting).
|
|
533
|
-
get requests():
|
|
534
|
-
get bytesOutL1():
|
|
535
|
-
get bytesInL1():
|
|
536
|
-
get status2xx():
|
|
537
|
-
get status3xx():
|
|
538
|
-
get status4xx():
|
|
539
|
-
get status5xx():
|
|
540
|
-
get staticHits():
|
|
541
|
-
get wasmDispatches():
|
|
542
|
-
get executorFullRejects():
|
|
543
|
-
get unknownHostRejects():
|
|
544
|
-
get rateLimitedRejects():
|
|
545
|
-
get gasUsed():
|
|
546
|
-
get dbOps():
|
|
547
|
-
get dbReads():
|
|
548
|
-
get dbWrites():
|
|
549
|
-
get dbErrors():
|
|
550
|
-
get dbLatencyNsSum():
|
|
551
|
-
get streamAccepts():
|
|
552
|
-
get
|
|
553
|
-
get
|
|
554
|
-
get
|
|
555
|
-
get
|
|
556
|
-
get
|
|
557
|
-
get
|
|
558
|
-
get
|
|
535
|
+
get requests(): u64 { return this.life[MetricId.Requests]; }
|
|
536
|
+
get bytesOutL1(): u64 { return this.life[MetricId.BytesOutL1]; }
|
|
537
|
+
get bytesInL1(): u64 { return this.life[MetricId.BytesInL1]; }
|
|
538
|
+
get status2xx(): u64 { return this.life[MetricId.Status2xx]; }
|
|
539
|
+
get status3xx(): u64 { return this.life[MetricId.Status3xx]; }
|
|
540
|
+
get status4xx(): u64 { return this.life[MetricId.Status4xx]; }
|
|
541
|
+
get status5xx(): u64 { return this.life[MetricId.Status5xx]; }
|
|
542
|
+
get staticHits(): u64 { return this.life[MetricId.StaticHits]; }
|
|
543
|
+
get wasmDispatches(): u64 { return this.life[MetricId.WasmDispatches]; }
|
|
544
|
+
get executorFullRejects(): u64 { return this.life[MetricId.ExecutorFullRejects]; }
|
|
545
|
+
get unknownHostRejects(): u64 { return this.life[MetricId.UnknownHostRejects]; }
|
|
546
|
+
get rateLimitedRejects(): u64 { return this.life[MetricId.RateLimitedRejects]; }
|
|
547
|
+
get gasUsed(): u64 { return this.life[MetricId.GasUsed]; }
|
|
548
|
+
get dbOps(): u64 { return this.life[MetricId.DbOps]; }
|
|
549
|
+
get dbReads(): u64 { return this.life[MetricId.DbReads]; }
|
|
550
|
+
get dbWrites(): u64 { return this.life[MetricId.DbWrites]; }
|
|
551
|
+
get dbErrors(): u64 { return this.life[MetricId.DbErrors]; }
|
|
552
|
+
get dbLatencyNsSum(): u64 { return this.life[MetricId.DbLatencyNsSum]; }
|
|
553
|
+
get streamAccepts(): u64 { return this.life[MetricId.StreamAccepts]; }
|
|
554
|
+
get streamRejectWrongNode(): u64 { return this.life[MetricId.StreamRejectWrongNode]; }
|
|
555
|
+
get streamRejectCapacity(): u64 { return this.life[MetricId.StreamRejectCapacity]; }
|
|
556
|
+
get streamRejectArtifact(): u64 { return this.life[MetricId.StreamRejectArtifact]; }
|
|
557
|
+
get streamRejectGuest(): u64 { return this.life[MetricId.StreamRejectGuest]; }
|
|
558
|
+
get streamTraps(): u64 { return this.life[MetricId.StreamTraps]; }
|
|
559
|
+
get streamIdleTimeouts(): u64 { return this.life[MetricId.StreamIdleTimeouts]; }
|
|
560
|
+
get streamBytesIn(): u64 { return this.life[MetricId.StreamBytesIn]; }
|
|
561
|
+
get streamBytesOut(): u64 { return this.life[MetricId.StreamBytesOut]; }
|
|
562
|
+
get streamBackpressureEvents(): u64 { return this.life[MetricId.StreamBackpressureEvents]; }
|
|
563
|
+
get streamCloses(): u64 { return this.life[MetricId.StreamCloses]; }
|
|
564
|
+
get streamDisconnects(): u64 { return this.life[MetricId.StreamDisconnects]; }
|
|
565
|
+
get daemonStarts(): u64 { return this.life[MetricId.DaemonStarts]; }
|
|
566
|
+
get daemonStartFailures(): u64 { return this.life[MetricId.DaemonStartFailures]; }
|
|
567
|
+
get daemonTicksFired(): u64 { return this.life[MetricId.DaemonTicksFired]; }
|
|
568
|
+
get daemonTicksSkippedNotLeader(): u64 { return this.life[MetricId.DaemonTicksSkippedNotLeader]; }
|
|
569
|
+
get daemonTicksFailed(): u64 { return this.life[MetricId.DaemonTicksFailed]; }
|
|
570
|
+
get daemonLeaderAcquires(): u64 { return this.life[MetricId.DaemonLeaderAcquires]; }
|
|
571
|
+
get daemonLeaderFenced(): u64 { return this.life[MetricId.DaemonLeaderFenced]; }
|
|
572
|
+
get daemonHttpCallAttempts(): u64 { return this.life[MetricId.DaemonHttpCallAttempts]; }
|
|
573
|
+
get daemonHttpCallFailures(): u64 { return this.life[MetricId.DaemonHttpCallFailures]; }
|
|
574
|
+
get memGrownBytes(): u64 { return this.life[MetricId.MemGrownBytes]; }
|
|
575
|
+
get emails(): u64 { return this.life[MetricId.Emails]; }
|
|
576
|
+
get cacheHits(): u64 { return this.life[MetricId.CacheHits]; }
|
|
577
|
+
get cacheMisses(): u64 { return this.life[MetricId.CacheMisses]; }
|
|
559
578
|
|
|
560
579
|
/// Mean host-observed DB op latency (ns), or 0 with no ops.
|
|
561
|
-
get meanDbLatencyNs():
|
|
580
|
+
get meanDbLatencyNs(): u64 {
|
|
562
581
|
const ops = this.dbOps;
|
|
563
582
|
return ops > 0 ? this.dbLatencyNsSum / ops : 0;
|
|
564
583
|
}
|
|
584
|
+
|
|
585
|
+
/// Fraction of cacheable responses served from cache (`hits / (hits + misses)`),
|
|
586
|
+
/// 0.0 when there were no cacheable responses.
|
|
587
|
+
get cacheRatio(): f64 {
|
|
588
|
+
const hits = this.cacheHits;
|
|
589
|
+
const total = hits + this.cacheMisses;
|
|
590
|
+
return total > 0 ? <f64>hits / <f64>total : 0.0;
|
|
591
|
+
}
|
|
565
592
|
}
|
|
566
593
|
|
|
567
594
|
/// One metric's time series for a range: `points` oldest→newest, `bucketSecs` the per-bucket width, and
|
|
@@ -599,14 +626,15 @@ export class Analytics {
|
|
|
599
626
|
stats.nowMs = r.readU64();
|
|
600
627
|
const count = <i32>r.readU32();
|
|
601
628
|
for (let i: i32 = 0; i < count && r.ok; i++) {
|
|
602
|
-
|
|
629
|
+
// Wire fields are non-negative i64; read the same bytes as u64.
|
|
630
|
+
const v = r.readU64();
|
|
603
631
|
if (i < METRIC_COUNTERS) stats.life[i] = v; // ignore any extra (forward-compat)
|
|
604
632
|
}
|
|
605
|
-
stats.connectedStreams = r.
|
|
606
|
-
stats.committedMemory = r.
|
|
607
|
-
stats.reqMinuteUsed = r.
|
|
633
|
+
stats.connectedStreams = r.readU64();
|
|
634
|
+
stats.committedMemory = r.readU64();
|
|
635
|
+
stats.reqMinuteUsed = r.readU64();
|
|
608
636
|
stats.reqMinuteCap = r.readU64();
|
|
609
|
-
stats.reqDayUsed = r.
|
|
637
|
+
stats.reqDayUsed = r.readU64();
|
|
610
638
|
stats.reqDayCap = r.readU64();
|
|
611
639
|
return stats;
|
|
612
640
|
}
|
|
@@ -282,8 +282,8 @@ declare class Events<K, V> {
|
|
|
282
282
|
latest(key: K, limit: i32): V[];
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/** Every per-domain metric, by stable numeric id (the wire contract). `0..=
|
|
286
|
-
* COUNTERS (rate = value/seconds); `
|
|
285
|
+
/** Every per-domain metric, by stable numeric id (the wire contract). `0..=42` are cumulative
|
|
286
|
+
* COUNTERS (rate = value/seconds); `43..=46` are the avg/peak series of the two GAUGES. */
|
|
287
287
|
declare const enum MetricId {
|
|
288
288
|
Requests = 0, BytesOutL1 = 1, BytesInL1 = 2,
|
|
289
289
|
Status2xx = 3, Status3xx = 4, Status4xx = 5, Status5xx = 6,
|
|
@@ -296,7 +296,8 @@ declare const enum MetricId {
|
|
|
296
296
|
DaemonStarts = 30, DaemonStartFailures = 31, DaemonTicksFired = 32, DaemonTicksSkippedNotLeader = 33,
|
|
297
297
|
DaemonTicksFailed = 34, DaemonLeaderAcquires = 35, DaemonLeaderFenced = 36,
|
|
298
298
|
DaemonHttpCallAttempts = 37, DaemonHttpCallFailures = 38, MemGrownBytes = 39, Emails = 40,
|
|
299
|
-
|
|
299
|
+
CacheHits = 41, CacheMisses = 42,
|
|
300
|
+
ConnectedStreamsAvg = 43, ConnectedStreamsPeak = 44, CommittedMemoryAvg = 45, CommittedMemoryPeak = 46,
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
/** A dashboard time range for `Analytics.series`. 1h/6h are per-minute; the rest per-hour (30-day). */
|
|
@@ -308,39 +309,58 @@ declare const enum AnalyticsRange {
|
|
|
308
309
|
* live gauge levels, and the request windows (current usage + plan cap; cap 0 = unlimited). Read a
|
|
309
310
|
* value by typed getter (`stats.requests`) or by id (`stats.metric(MetricId.Requests)`). */
|
|
310
311
|
declare class TenantStats {
|
|
311
|
-
metric(id: MetricId):
|
|
312
|
-
readonly requests:
|
|
313
|
-
readonly bytesOutL1:
|
|
314
|
-
readonly bytesInL1:
|
|
315
|
-
readonly status2xx:
|
|
316
|
-
readonly status3xx:
|
|
317
|
-
readonly status4xx:
|
|
318
|
-
readonly status5xx:
|
|
319
|
-
readonly staticHits:
|
|
320
|
-
readonly wasmDispatches:
|
|
321
|
-
readonly executorFullRejects:
|
|
322
|
-
readonly unknownHostRejects:
|
|
323
|
-
readonly rateLimitedRejects:
|
|
324
|
-
readonly gasUsed:
|
|
325
|
-
readonly dbOps:
|
|
326
|
-
readonly dbReads:
|
|
327
|
-
readonly dbWrites:
|
|
328
|
-
readonly dbErrors:
|
|
329
|
-
readonly dbLatencyNsSum:
|
|
330
|
-
readonly meanDbLatencyNs:
|
|
331
|
-
readonly streamAccepts:
|
|
332
|
-
readonly
|
|
333
|
-
readonly
|
|
334
|
-
readonly
|
|
335
|
-
readonly
|
|
336
|
-
readonly
|
|
337
|
-
readonly
|
|
338
|
-
readonly
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
312
|
+
metric(id: MetricId): u64;
|
|
313
|
+
readonly requests: u64;
|
|
314
|
+
readonly bytesOutL1: u64;
|
|
315
|
+
readonly bytesInL1: u64;
|
|
316
|
+
readonly status2xx: u64;
|
|
317
|
+
readonly status3xx: u64;
|
|
318
|
+
readonly status4xx: u64;
|
|
319
|
+
readonly status5xx: u64;
|
|
320
|
+
readonly staticHits: u64;
|
|
321
|
+
readonly wasmDispatches: u64;
|
|
322
|
+
readonly executorFullRejects: u64;
|
|
323
|
+
readonly unknownHostRejects: u64;
|
|
324
|
+
readonly rateLimitedRejects: u64;
|
|
325
|
+
readonly gasUsed: u64;
|
|
326
|
+
readonly dbOps: u64;
|
|
327
|
+
readonly dbReads: u64;
|
|
328
|
+
readonly dbWrites: u64;
|
|
329
|
+
readonly dbErrors: u64;
|
|
330
|
+
readonly dbLatencyNsSum: u64;
|
|
331
|
+
readonly meanDbLatencyNs: u64;
|
|
332
|
+
readonly streamAccepts: u64;
|
|
333
|
+
readonly streamRejectWrongNode: u64;
|
|
334
|
+
readonly streamRejectCapacity: u64;
|
|
335
|
+
readonly streamRejectArtifact: u64;
|
|
336
|
+
readonly streamRejectGuest: u64;
|
|
337
|
+
readonly streamTraps: u64;
|
|
338
|
+
readonly streamIdleTimeouts: u64;
|
|
339
|
+
readonly streamBytesIn: u64;
|
|
340
|
+
readonly streamBytesOut: u64;
|
|
341
|
+
readonly streamBackpressureEvents: u64;
|
|
342
|
+
readonly streamCloses: u64;
|
|
343
|
+
readonly streamDisconnects: u64;
|
|
344
|
+
readonly daemonStarts: u64;
|
|
345
|
+
readonly daemonStartFailures: u64;
|
|
346
|
+
readonly daemonTicksFired: u64;
|
|
347
|
+
readonly daemonTicksSkippedNotLeader: u64;
|
|
348
|
+
readonly daemonTicksFailed: u64;
|
|
349
|
+
readonly daemonLeaderAcquires: u64;
|
|
350
|
+
readonly daemonLeaderFenced: u64;
|
|
351
|
+
readonly daemonHttpCallAttempts: u64;
|
|
352
|
+
readonly daemonHttpCallFailures: u64;
|
|
353
|
+
readonly memGrownBytes: u64;
|
|
354
|
+
readonly emails: u64;
|
|
355
|
+
readonly cacheHits: u64;
|
|
356
|
+
readonly cacheMisses: u64;
|
|
357
|
+
/** Fraction of cacheable responses served from cache (`hits / (hits + misses)`), 0.0 when none. */
|
|
358
|
+
readonly cacheRatio: f64;
|
|
359
|
+
connectedStreams: u64;
|
|
360
|
+
committedMemory: u64;
|
|
361
|
+
reqMinuteUsed: u64;
|
|
342
362
|
reqMinuteCap: u64;
|
|
343
|
-
reqDayUsed:
|
|
363
|
+
reqDayUsed: u64;
|
|
344
364
|
reqDayCap: u64;
|
|
345
365
|
nowMs: u64;
|
|
346
366
|
}
|