toilscript 0.1.50 → 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.generated.d.ts +2 -2
- package/dist/cli.js +213 -16
- package/dist/cli.js.map +2 -2
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +2 -2
- package/dist/toilscript.js +1 -1
- package/dist/toilscript.js.map +1 -1
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/bindings/toildb.ts +6 -0
- package/std/assembly/toildb.ts +205 -14
- package/std/assembly/toilscript.d.ts +93 -8
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
|
@@ -283,6 +283,12 @@ export namespace analyticsHost {
|
|
|
283
283
|
@external("env", "analytics_read")
|
|
284
284
|
export declare function read(domainPtr: usize, domainLen: i32): i32;
|
|
285
285
|
|
|
286
|
+
// analytics_series(domain, metricId, range): frame length (v2 series frame) stashed for takeResult,
|
|
287
|
+
// or a negative status (-2 absent / -3 forbidden / bad metric or range).
|
|
288
|
+
// @ts-ignore: decorator
|
|
289
|
+
@external("env", "analytics_series")
|
|
290
|
+
export declare function series(domainPtr: usize, domainLen: i32, metricId: i32, range: i32): i32;
|
|
291
|
+
|
|
286
292
|
// analytics_list_sites(cursor, limit): frame length (count u32 | (u32 nameLen, name)* |
|
|
287
293
|
// has_more u8) stashed for takeResult; -3 forbidden when the caller is not dacely.com.
|
|
288
294
|
// @ts-ignore: decorator
|
package/std/assembly/toildb.ts
CHANGED
|
@@ -438,16 +438,172 @@ export class Counter<K> {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
///
|
|
442
|
-
/// `
|
|
443
|
-
///
|
|
444
|
-
///
|
|
441
|
+
/// Every per-domain metric, by stable numeric id. This is the WIRE CONTRACT shared with the edge
|
|
442
|
+
/// (`src/analytics/metric_id.rs`) and the dev server; it orders the snapshot frame and addresses a
|
|
443
|
+
/// time-series. Ids `0..=42` are cumulative COUNTERS (a rate is `value / seconds`); `43..=46` are the
|
|
444
|
+
/// avg/peak series of the two GAUGES. Append-only: never renumber.
|
|
445
|
+
export enum MetricId {
|
|
446
|
+
Requests = 0,
|
|
447
|
+
BytesOutL1 = 1,
|
|
448
|
+
BytesInL1 = 2,
|
|
449
|
+
Status2xx = 3,
|
|
450
|
+
Status3xx = 4,
|
|
451
|
+
Status4xx = 5,
|
|
452
|
+
Status5xx = 6,
|
|
453
|
+
StaticHits = 7,
|
|
454
|
+
WasmDispatches = 8,
|
|
455
|
+
ExecutorFullRejects = 9,
|
|
456
|
+
UnknownHostRejects = 10,
|
|
457
|
+
RateLimitedRejects = 11,
|
|
458
|
+
GasUsed = 12,
|
|
459
|
+
DbOps = 13,
|
|
460
|
+
DbReads = 14,
|
|
461
|
+
DbWrites = 15,
|
|
462
|
+
DbErrors = 16,
|
|
463
|
+
DbLatencyNsSum = 17,
|
|
464
|
+
StreamAccepts = 18,
|
|
465
|
+
StreamRejectWrongNode = 19,
|
|
466
|
+
StreamRejectCapacity = 20,
|
|
467
|
+
StreamRejectArtifact = 21,
|
|
468
|
+
StreamRejectGuest = 22,
|
|
469
|
+
StreamTraps = 23,
|
|
470
|
+
StreamIdleTimeouts = 24,
|
|
471
|
+
StreamBytesIn = 25,
|
|
472
|
+
StreamBytesOut = 26,
|
|
473
|
+
StreamBackpressureEvents = 27,
|
|
474
|
+
StreamCloses = 28,
|
|
475
|
+
StreamDisconnects = 29,
|
|
476
|
+
DaemonStarts = 30,
|
|
477
|
+
DaemonStartFailures = 31,
|
|
478
|
+
DaemonTicksFired = 32,
|
|
479
|
+
DaemonTicksSkippedNotLeader = 33,
|
|
480
|
+
DaemonTicksFailed = 34,
|
|
481
|
+
DaemonLeaderAcquires = 35,
|
|
482
|
+
DaemonLeaderFenced = 36,
|
|
483
|
+
DaemonHttpCallAttempts = 37,
|
|
484
|
+
DaemonHttpCallFailures = 38,
|
|
485
|
+
MemGrownBytes = 39,
|
|
486
|
+
Emails = 40,
|
|
487
|
+
CacheHits = 41,
|
|
488
|
+
CacheMisses = 42,
|
|
489
|
+
ConnectedStreamsAvg = 43,
|
|
490
|
+
ConnectedStreamsPeak = 44,
|
|
491
|
+
CommittedMemoryAvg = 45,
|
|
492
|
+
CommittedMemoryPeak = 46,
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/// The number of cumulative counter metrics (`MetricId 0..=42`) = the length of the snapshot's lifetime
|
|
496
|
+
/// section.
|
|
497
|
+
export const METRIC_COUNTERS: i32 = 43;
|
|
498
|
+
|
|
499
|
+
/// A dashboard time range for `Analytics.series`. Short ranges (1h/6h) read the per-MINUTE ring; the rest
|
|
500
|
+
/// read the per-HOUR ring (30-day retention).
|
|
501
|
+
export enum AnalyticsRange {
|
|
502
|
+
H1 = 0,
|
|
503
|
+
H6 = 1,
|
|
504
|
+
H12 = 2,
|
|
505
|
+
H24 = 3,
|
|
506
|
+
D3 = 4,
|
|
507
|
+
D7 = 5,
|
|
508
|
+
D14 = 6,
|
|
509
|
+
D30 = 7,
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/// One tenant's analytics snapshot: the lifetime totals (indexed by `MetricId`, NO string keys), the two
|
|
513
|
+
/// live gauge levels, and the request windows paired with the plan caps (cap 0 = unlimited). Read every
|
|
514
|
+
/// value either by the typed getter (`stats.requests`) or by id (`stats.metric(MetricId.Requests)`).
|
|
445
515
|
export class TenantStats {
|
|
446
|
-
|
|
447
|
-
|
|
516
|
+
/// Lifetime totals indexed by `MetricId` (length `METRIC_COUNTERS`). Prefer the named getters below.
|
|
517
|
+
life: StaticArray<u64> = new StaticArray<u64>(METRIC_COUNTERS);
|
|
518
|
+
/// Live gauges (current level, not a total).
|
|
519
|
+
connectedStreams: u64 = 0;
|
|
520
|
+
committedMemory: u64 = 0;
|
|
521
|
+
/// Request windows: current bucket usage + plan cap (0 = unlimited).
|
|
522
|
+
reqMinuteUsed: u64 = 0;
|
|
448
523
|
reqMinuteCap: u64 = 0;
|
|
449
|
-
reqDayUsed:
|
|
524
|
+
reqDayUsed: u64 = 0;
|
|
450
525
|
reqDayCap: u64 = 0;
|
|
526
|
+
/// Edge wall-clock (ms) when the snapshot was read.
|
|
527
|
+
nowMs: u64 = 0;
|
|
528
|
+
|
|
529
|
+
/// Any counter metric by id (0 for an out-of-range id).
|
|
530
|
+
metric(id: MetricId): u64 {
|
|
531
|
+
return <i32>id < METRIC_COUNTERS ? this.life[<i32>id] : 0;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Typed getters for every counter (the catalog: no magic strings, self-documenting).
|
|
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]; }
|
|
578
|
+
|
|
579
|
+
/// Mean host-observed DB op latency (ns), or 0 with no ops.
|
|
580
|
+
get meanDbLatencyNs(): u64 {
|
|
581
|
+
const ops = this.dbOps;
|
|
582
|
+
return ops > 0 ? this.dbLatencyNsSum / ops : 0;
|
|
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
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/// One metric's time series for a range: `points` oldest→newest, `bucketSecs` the per-bucket width, and
|
|
595
|
+
/// `headMs` the newest bucket's end. Rates are derived, never stored.
|
|
596
|
+
export class Series {
|
|
597
|
+
metric: MetricId = MetricId.Requests;
|
|
598
|
+
bucketSecs: u32 = 0;
|
|
599
|
+
headMs: u64 = 0;
|
|
600
|
+
points: i64[] = [];
|
|
601
|
+
|
|
602
|
+
/// Per-second rate of bucket `i` (its total divided by the bucket width). 0 for an out-of-range index.
|
|
603
|
+
ratePerSec(i: i32): f64 {
|
|
604
|
+
if (i < 0 || i >= this.points.length || this.bucketSecs == 0) return 0;
|
|
605
|
+
return <f64>this.points[i] / <f64>this.bucketSecs;
|
|
606
|
+
}
|
|
451
607
|
}
|
|
452
608
|
|
|
453
609
|
/// A page of site names from `Analytics.listSites` (dacely.com only). When `hasMore` is
|
|
@@ -465,19 +621,39 @@ export class Analytics {
|
|
|
465
621
|
private static decode(buf: Uint8Array): TenantStats {
|
|
466
622
|
const r = new DataReader(buf);
|
|
467
623
|
const stats = new TenantStats();
|
|
468
|
-
r.readU16();
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
624
|
+
const version = r.readU16();
|
|
625
|
+
if (version < 2) return stats; // pre-v2 edge: refuse rather than mis-decode
|
|
626
|
+
stats.nowMs = r.readU64();
|
|
627
|
+
const count = <i32>r.readU32();
|
|
628
|
+
for (let i: i32 = 0; i < count && r.ok; i++) {
|
|
629
|
+
// Wire fields are non-negative i64; read the same bytes as u64.
|
|
630
|
+
const v = r.readU64();
|
|
631
|
+
if (i < METRIC_COUNTERS) stats.life[i] = v; // ignore any extra (forward-compat)
|
|
473
632
|
}
|
|
474
|
-
stats.
|
|
633
|
+
stats.connectedStreams = r.readU64();
|
|
634
|
+
stats.committedMemory = r.readU64();
|
|
635
|
+
stats.reqMinuteUsed = r.readU64();
|
|
475
636
|
stats.reqMinuteCap = r.readU64();
|
|
476
|
-
stats.reqDayUsed = r.
|
|
637
|
+
stats.reqDayUsed = r.readU64();
|
|
477
638
|
stats.reqDayCap = r.readU64();
|
|
478
639
|
return stats;
|
|
479
640
|
}
|
|
480
641
|
|
|
642
|
+
private static decodeSeries(buf: Uint8Array): Series {
|
|
643
|
+
const r = new DataReader(buf);
|
|
644
|
+
const out = new Series();
|
|
645
|
+
const version = r.readU16();
|
|
646
|
+
if (version < 2) return out;
|
|
647
|
+
out.metric = <MetricId>r.readU16();
|
|
648
|
+
out.bucketSecs = r.readU32();
|
|
649
|
+
out.headMs = r.readU64();
|
|
650
|
+
const count = <i32>r.readU32();
|
|
651
|
+
const pts = new Array<i64>(count);
|
|
652
|
+
for (let i: i32 = 0; i < count && r.ok; i++) pts[i] = r.readI64();
|
|
653
|
+
out.points = pts;
|
|
654
|
+
return out;
|
|
655
|
+
}
|
|
656
|
+
|
|
481
657
|
/// This site's own analytics. Returns empty stats if unavailable.
|
|
482
658
|
static self(): TenantStats {
|
|
483
659
|
const status = analyticsHost.read(0, 0);
|
|
@@ -494,6 +670,21 @@ export class Analytics {
|
|
|
494
670
|
return Analytics.decode(__toildbTake(status));
|
|
495
671
|
}
|
|
496
672
|
|
|
673
|
+
/// This site's time-series for `metric` over `range` (for graphs). Empty series if unavailable.
|
|
674
|
+
static series(metric: MetricId, range: AnalyticsRange): Series {
|
|
675
|
+
const status = analyticsHost.series(0, 0, <i32>metric, <i32>range);
|
|
676
|
+
if (status < 0) return new Series();
|
|
677
|
+
return Analytics.decodeSeries(__toildbTake(status));
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/// Another site's time-series (dacely.com only, else `null`).
|
|
681
|
+
static siteSeries(domain: string, metric: MetricId, range: AnalyticsRange): Series | null {
|
|
682
|
+
const db = Uint8Array.wrap(String.UTF8.encode(domain));
|
|
683
|
+
const status = analyticsHost.series(db.dataStart, db.byteLength, <i32>metric, <i32>range);
|
|
684
|
+
if (status < 0) return null;
|
|
685
|
+
return Analytics.decodeSeries(__toildbTake(status));
|
|
686
|
+
}
|
|
687
|
+
|
|
497
688
|
/// Enumerate sites, paginated. ONLY `dacely.com` gets results; any other caller gets an
|
|
498
689
|
/// empty list. `cursor` is the previous page's last name (`""` = from the start); reads up
|
|
499
690
|
/// to `limit` names. When `hasMore` is true, pass the last `sites` entry as the next cursor.
|
|
@@ -282,19 +282,99 @@ declare class Events<K, V> {
|
|
|
282
282
|
latest(key: K, limit: i32): V[];
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/**
|
|
286
|
-
*
|
|
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
|
+
declare const enum MetricId {
|
|
288
|
+
Requests = 0, BytesOutL1 = 1, BytesInL1 = 2,
|
|
289
|
+
Status2xx = 3, Status3xx = 4, Status4xx = 5, Status5xx = 6,
|
|
290
|
+
StaticHits = 7, WasmDispatches = 8,
|
|
291
|
+
ExecutorFullRejects = 9, UnknownHostRejects = 10, RateLimitedRejects = 11, GasUsed = 12,
|
|
292
|
+
DbOps = 13, DbReads = 14, DbWrites = 15, DbErrors = 16, DbLatencyNsSum = 17,
|
|
293
|
+
StreamAccepts = 18, StreamRejectWrongNode = 19, StreamRejectCapacity = 20, StreamRejectArtifact = 21,
|
|
294
|
+
StreamRejectGuest = 22, StreamTraps = 23, StreamIdleTimeouts = 24, StreamBytesIn = 25,
|
|
295
|
+
StreamBytesOut = 26, StreamBackpressureEvents = 27, StreamCloses = 28, StreamDisconnects = 29,
|
|
296
|
+
DaemonStarts = 30, DaemonStartFailures = 31, DaemonTicksFired = 32, DaemonTicksSkippedNotLeader = 33,
|
|
297
|
+
DaemonTicksFailed = 34, DaemonLeaderAcquires = 35, DaemonLeaderFenced = 36,
|
|
298
|
+
DaemonHttpCallAttempts = 37, DaemonHttpCallFailures = 38, MemGrownBytes = 39, Emails = 40,
|
|
299
|
+
CacheHits = 41, CacheMisses = 42,
|
|
300
|
+
ConnectedStreamsAvg = 43, ConnectedStreamsPeak = 44, CommittedMemoryAvg = 45, CommittedMemoryPeak = 46,
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** A dashboard time range for `Analytics.series`. 1h/6h are per-minute; the rest per-hour (30-day). */
|
|
304
|
+
declare const enum AnalyticsRange {
|
|
305
|
+
H1 = 0, H6 = 1, H12 = 2, H24 = 3, D3 = 4, D7 = 5, D14 = 6, D30 = 7,
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** One tenant's analytics snapshot: lifetime totals (indexed by `MetricId`, no string keys), the two
|
|
309
|
+
* live gauge levels, and the request windows (current usage + plan cap; cap 0 = unlimited). Read a
|
|
310
|
+
* value by typed getter (`stats.requests`) or by id (`stats.metric(MetricId.Requests)`). */
|
|
287
311
|
declare class TenantStats {
|
|
288
|
-
|
|
289
|
-
|
|
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;
|
|
290
362
|
reqMinuteCap: u64;
|
|
291
|
-
reqDayUsed:
|
|
363
|
+
reqDayUsed: u64;
|
|
292
364
|
reqDayCap: u64;
|
|
365
|
+
nowMs: u64;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** One metric's time series for a range: `points` oldest→newest, `bucketSecs` bucket width,
|
|
369
|
+
* `headMs` newest bucket end. `ratePerSec(i)` derives the per-second rate of point `i`. */
|
|
370
|
+
declare class Series {
|
|
371
|
+
metric: MetricId;
|
|
372
|
+
bucketSecs: u32;
|
|
373
|
+
headMs: u64;
|
|
374
|
+
points: i64[];
|
|
375
|
+
ratePerSec(i: i32): f64;
|
|
293
376
|
}
|
|
294
377
|
|
|
295
|
-
/** Per-domain analytics. `Analytics.self()` reads this site's own stats; the privileged
|
|
296
|
-
* `dacely.com` domain may read any site via `Analytics.site(domain)` (any other caller,
|
|
297
|
-
* or an unknown domain, gets `null`). The calling domain is decided host-side. */
|
|
298
378
|
/** A page of site names from `Analytics.listSites` (dacely.com only). When `hasMore` is
|
|
299
379
|
* true, pass the last `sites` entry back as the next call's cursor. */
|
|
300
380
|
declare class SiteList {
|
|
@@ -302,9 +382,14 @@ declare class SiteList {
|
|
|
302
382
|
hasMore: bool;
|
|
303
383
|
}
|
|
304
384
|
|
|
385
|
+
/** Per-domain analytics. `Analytics.self()` reads this site's own stats; the privileged
|
|
386
|
+
* `dacely.com` domain may read any site via `Analytics.site(domain)` (any other caller,
|
|
387
|
+
* or an unknown domain, gets `null`). The calling domain is decided host-side. */
|
|
305
388
|
declare class Analytics {
|
|
306
389
|
static self(): TenantStats;
|
|
307
390
|
static site(domain: string): TenantStats | null;
|
|
391
|
+
static series(metric: MetricId, range: AnalyticsRange): Series;
|
|
392
|
+
static siteSeries(domain: string, metric: MetricId, range: AnalyticsRange): Series | null;
|
|
308
393
|
static listSites(cursor?: string, limit?: i32): SiteList;
|
|
309
394
|
}
|
|
310
395
|
|