@lunora/observability 1.0.0-alpha.11 → 1.0.0-alpha.111

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.
Files changed (44) hide show
  1. package/README.md +2 -4
  2. package/dist/index.d.mts +323 -97
  3. package/dist/index.d.ts +323 -97
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/AUTH_METRICS_BUCKETS_TABLE-C-qbQA-w.mjs +22 -0
  6. package/dist/packem_shared/DEFAULT_EXPLAIN_ISSUE_MODEL-BkFTgdkd.mjs +3 -0
  7. package/dist/packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-ChlIe0vF.mjs +56 -0
  8. package/dist/packem_shared/ISSUE_SEVERITIES-0SJ0glV4.mjs +15 -0
  9. package/dist/packem_shared/LogBuffer-BmD4CfV0.mjs +1 -0
  10. package/dist/packem_shared/MIN_ADMIN_TOKEN_LENGTH-DSOQ6rno.mjs +1 -0
  11. package/dist/packem_shared/MetricBuffer-DnOJJVHH.mjs +1 -0
  12. package/dist/packem_shared/REQUEST_LOG_TABLE-CObysreb.mjs +1 -0
  13. package/dist/packem_shared/SpanBuffer-DnYOc8uk.mjs +1 -0
  14. package/dist/packem_shared/createDatabaseTally-BVH6hi5W.mjs +1 -0
  15. package/dist/packem_shared/createMetrics-pQCAOmxn.mjs +1 -0
  16. package/dist/packem_shared/findDanglingReferences-BaOyIdxz.mjs +1 -0
  17. package/dist/packem_shared/metric-buffer-Bx0XbypU.mjs +1 -0
  18. package/dist/packem_shared/otlp-B-WBkikT.mjs +1 -0
  19. package/dist/packem_shared/prune-marker-B4An9Nuj.mjs +1 -0
  20. package/dist/packem_shared/readMetricHistory-TKfnwFNv.mjs +31 -0
  21. package/dist/packem_shared/readQueryInsights-DkQfxGfP.mjs +32 -0
  22. package/dist/packem_shared/request-log-ClXupUgG.mjs +24 -0
  23. package/dist/packem_shared/resolveTraceAnchor-CTZfm9KX.mjs +1 -0
  24. package/dist/packem_shared/run-sql-0aPgJkIw.mjs +1 -0
  25. package/dist/packem_shared/setHostSpanAttributes-DfxUKy_K.mjs +1 -0
  26. package/package.json +5 -5
  27. package/dist/packem_shared/AUTH_METRICS_BUCKETS_TABLE-C2V-DiGu.mjs +0 -22
  28. package/dist/packem_shared/DEFAULT_EXPLAIN_ISSUE_MODEL-xF11R4vX.mjs +0 -3
  29. package/dist/packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-BB8kcFBe.mjs +0 -56
  30. package/dist/packem_shared/ISSUE_SEVERITIES-Js6lGUG5.mjs +0 -15
  31. package/dist/packem_shared/LogBuffer-bIvCelI-.mjs +0 -1
  32. package/dist/packem_shared/MIN_ADMIN_TOKEN_LENGTH-T-zuwRVR.mjs +0 -1
  33. package/dist/packem_shared/MetricBuffer-CYrLuEsz.mjs +0 -1
  34. package/dist/packem_shared/REQUEST_LOG_TABLE-BvpprPd_.mjs +0 -1
  35. package/dist/packem_shared/SpanBuffer-BR6Ff0M-.mjs +0 -1
  36. package/dist/packem_shared/createDatabaseTally-DBs7wDeF.mjs +0 -1
  37. package/dist/packem_shared/createMetrics-BXNmqy0o.mjs +0 -1
  38. package/dist/packem_shared/findDanglingReferences-D-x9LvY0.mjs +0 -1
  39. package/dist/packem_shared/metric-buffer-CdgXal7w.mjs +0 -1
  40. package/dist/packem_shared/readMetricHistory-CVcUgQEL.mjs +0 -31
  41. package/dist/packem_shared/readQueryInsights-DN07YcQy.mjs +0 -32
  42. package/dist/packem_shared/request-log-BwFic6VV.mjs +0 -21
  43. package/dist/packem_shared/resolveTraceAnchor-IAN8riI0.mjs +0 -1
  44. package/dist/packem_shared/trace-context-DrdF960P.mjs +0 -1
package/dist/index.d.ts CHANGED
@@ -64,9 +64,9 @@ declare const ensureAuthMetricsTables: (sql: SqlExec) => void;
64
64
  * `failures` advances only when `outcome === "fail"`. `since_ms` is set once on
65
65
  * the first attempt and never moved (so it stays a true first-seen marker).
66
66
  *
67
- * Exactly two `INSERT … ON CONFLICT … DO UPDATE` statements plus a bounded
68
- * `DELETE`, all keyed by primary key — cheap enough to fire off the auth
69
- * response path without blocking it.
67
+ * Exactly two `INSERT … ON CONFLICT … DO UPDATE` statements, all keyed by
68
+ * primary key, plus a bounded `DELETE` that runs once per bucket window —
69
+ * cheap enough to fire off the auth response path without blocking it.
70
70
  */
71
71
  declare const recordAuthEvent: (sql: SqlExec, input: RecordAuthEventInput) => void;
72
72
  /**
@@ -320,10 +320,50 @@ interface SpanHandle {
320
320
  * `@opentelemetry/api` bridge parenting a third-party library's spans — to
321
321
  * reach around the API for it.
322
322
  */
323
- spanContext: () => {
324
- spanId: string;
325
- traceId: string;
326
- };
323
+ spanContext: () => SpanContextIds;
324
+ }
325
+ /**
326
+ * The W3C identity of one span, plus the trace's settled sampling verdict.
327
+ *
328
+ * `sampled` is the propagated head decision (absent means "no verdict reached
329
+ * this tier", which every consumer reads as keep). It rides alongside the ids
330
+ * because everything that needs the ids to announce this span downstream — a
331
+ * hand-built `traceparent`, the `@opentelemetry/api` bridge's `SpanContext` —
332
+ * needs the flag in the same breath, and announcing `sampled` on a trace that
333
+ * was sampled OUT is what leaves a collector holding the middle of a trace.
334
+ */
335
+ interface SpanContextIds {
336
+ /** The trace's settled W3C `sampled` verdict; absent when none was propagated. */
337
+ sampled?: boolean;
338
+ /** This span's id (16-hex). */
339
+ spanId: string;
340
+ /** The trace this span belongs to (32-hex). */
341
+ traceId: string;
342
+ }
343
+ /**
344
+ * Caller-supplied ids for one `ctx.trace` span, passed as the tracer's fourth
345
+ * argument.
346
+ *
347
+ * For adapters that must hand a span's identity to somebody else BEFORE the span
348
+ * body runs — the `@opentelemetry/api` bridge returns a `SpanContext`
349
+ * synchronously from `startSpan`, and a library builds a `traceparent` from it —
350
+ * so the id the adapter published is the id that reaches the collector rather
351
+ * than a phantom. `parentSpanId` overrides the enclosing span for the same
352
+ * reason: an adapter that tracks its own parent/child structure (OTel's
353
+ * `Context`) can express it without an ambient span stack.
354
+ *
355
+ * Not part of the ordinary `ctx.trace(name, fn, attributes)` call — a handler
356
+ * never mints its own ids.
357
+ *
358
+ * Both ids are required: an adapter that has published one has published the
359
+ * other, and `identity` is itself optional — omitting it, not passing a partial
360
+ * object, is how a caller says "no adapter involved".
361
+ */
362
+ interface SpanIdentity {
363
+ /** Parent to this span id instead of the enclosing `ctx.trace` / dispatch span. */
364
+ parentSpanId: string;
365
+ /** Record the span under this id (16-hex) instead of a freshly minted one. */
366
+ spanId: string;
327
367
  }
328
368
  /** Options accepted by `ctx.trace(name, fn, options)` beyond the plain attribute bag. */
329
369
  interface SpanOptions {
@@ -402,6 +442,19 @@ interface SpanEvent {
402
442
  * the outermost span, which is why the fold prefers it as a trace's anchor.
403
443
  */
404
444
  dispatch?: boolean;
445
+ /**
446
+ * The trace's settled W3C `sampled` verdict, stamped as the span leaves for a
447
+ * sink. Absent means no verdict reached this tier, which every consumer reads
448
+ * as keep.
449
+ *
450
+ * Carried because the OTLP encoders write it into the span's `flags` field,
451
+ * and a span exported with no `flags` reads as UNSAMPLED (0) at the collector
452
+ * — on EVERY span, including the ones it is meant to keep. It is genuinely
453
+ * per-span rather than derivable from "it was exported at all": a trace the
454
+ * tail bias rescued (head-sampled out, then errored) is exported with the bit
455
+ * CLEAR, and saying otherwise misreports the trace's verdict.
456
+ */
457
+ sampled?: boolean;
405
458
  /** Shard key for single-shard calls; absent for the unnamed root DO. */
406
459
  shardKey?: string;
407
460
  /** This span's own id (16-hex). */
@@ -413,35 +466,6 @@ interface SpanEvent {
413
466
  /** Acting userId, or absent when anonymous. */
414
467
  userId?: string;
415
468
  }
416
- /**
417
- * Structural shape of the `ctx.trace` span factory (see the server
418
- * `LunoraTracer`). Declared here rather than imported so `@lunora/do` takes no
419
- * dependency on `@lunora/server`; a cross-package assignability guard in
420
- * `@lunora/testing` fails the build if the two drift apart.
421
- *
422
- * The body's second argument is the enclosing span's {@link SpanHandle}, through
423
- * which it can attach attributes only known *after* it resolves (post-hoc). It is
424
- * a trailing parameter, so a `(trace) => …` body that ignores it still conforms.
425
- */
426
- type ContextTracer = <T>(name: string, function_: (trace: ContextTracer, span: SpanHandle) => Promise<T> | T, options?: LogFields | SpanOptions) => Promise<T>;
427
- /** Structural shape of the `ctx.metrics` recorder (see the server `LunoraMetrics`). */
428
- interface ContextMetrics {
429
- count: (name: string, value?: number, attributes?: LogFields) => void;
430
- gauge: (name: string, value: number, attributes?: LogFields) => void;
431
- record: (name: string, value: number, attributes?: LogFields) => void;
432
- }
433
- /** The trace a ctx's spans hang off: the shared id, and the span they parent to. */
434
- interface TraceAnchor {
435
- rootSpanId: string;
436
- /**
437
- * The W3C `sampled` verdict for this trace, inherited from the inbound
438
- * `traceparent` when there was one. Carried on the anchor rather than
439
- * re-derived per outbound call so every `ctx.fetch` of one dispatch
440
- * propagates the same answer.
441
- */
442
- sampled?: boolean;
443
- traceId: string;
444
- }
445
469
  /**
446
470
  * Minimal structural shape of one **host-native custom span** — the object a
447
471
  * `tracing.enterSpan(name, (span) => …)` callback receives (GA 2026-06-16). Only
@@ -465,8 +489,18 @@ interface HostSpanLike {
465
489
  * a span nobody will read.
466
490
  */
467
491
  readonly isTraced: boolean;
492
+ /**
493
+ * Record an OTel `exception` event on the span (CF 2026-09-25). Optional and
494
+ * feature-detected: older runtimes only have `setAttribute`.
495
+ */
496
+ recordException?: (exception: {
497
+ message: string;
498
+ name: string;
499
+ }) => unknown;
468
500
  /** Attach one primitive attribute to the CF span. */
469
- setAttribute: (key: string, value: boolean | number | string | undefined) => void;
501
+ setAttribute: (key: string, value: boolean | number | string | undefined) => unknown;
502
+ /** Attach several attributes in one call (CF 2026-09-25). Optional, like `recordException`. */
503
+ setAttributes?: (attributes: Record<string, boolean | number | string>) => unknown;
470
504
  }
471
505
  /**
472
506
  * Minimal structural shape of the `tracing` namespace exported by
@@ -475,6 +509,11 @@ interface HostSpanLike {
475
509
  */
476
510
  interface HostTracingLike {
477
511
  enterSpan: <T>(name: string, callback: (span: HostSpanLike) => T) => T;
512
+ /**
513
+ * The currently active span; outside any custom span, the invocation's root
514
+ * span (CF 2026-09-25). Optional and feature-detected: absent on older runtimes.
515
+ */
516
+ getActiveSpan?: () => HostSpanLike | undefined;
478
517
  }
479
518
  /**
480
519
  * Resolves CF's `tracing` namespace, or `undefined` when it is unavailable —
@@ -484,6 +523,42 @@ interface HostTracingLike {
484
523
  * supplies the real resolver, tests a fake or `undefined`.
485
524
  */
486
525
  type HostTracingResolver = () => HostTracingLike | Promise<HostTracingLike | undefined> | undefined;
526
+ /**
527
+ * Copy an attribute bag onto a host span, best-effort: one native
528
+ * `setAttributes` call where the runtime has it, a `setAttribute` loop where it
529
+ * does not. Skipped for an untraced span; non-primitive values are dropped,
530
+ * since CF's setters take `string | number | boolean` only.
531
+ */
532
+ declare const setHostSpanAttributes: (span: HostSpanLike, attributes: Record<string, LogFields[string]>) => void;
533
+ /**
534
+ * Structural shape of the `ctx.trace` span factory (see the server
535
+ * `LunoraTracer`). Declared here rather than imported so `@lunora/do` takes no
536
+ * dependency on `@lunora/server`; a cross-package assignability guard in
537
+ * `@lunora/testing` fails the build if the two drift apart.
538
+ *
539
+ * The body's second argument is the enclosing span's {@link SpanHandle}, through
540
+ * which it can attach attributes only known *after* it resolves (post-hoc). It is
541
+ * a trailing parameter, so a `(trace) => …` body that ignores it still conforms.
542
+ */
543
+ type ContextTracer = <T>(name: string, function_: (trace: ContextTracer, span: SpanHandle) => Promise<T> | T, options?: LogFields | SpanOptions, identity?: SpanIdentity) => Promise<T>;
544
+ /** Structural shape of the `ctx.metrics` recorder (see the server `LunoraMetrics`). */
545
+ interface ContextMetrics {
546
+ count: (name: string, value?: number, attributes?: LogFields) => void;
547
+ gauge: (name: string, value: number, attributes?: LogFields) => void;
548
+ record: (name: string, value: number, attributes?: LogFields) => void;
549
+ }
550
+ /** The trace a ctx's spans hang off: the shared id, and the span they parent to. */
551
+ interface TraceAnchor {
552
+ rootSpanId: string;
553
+ /**
554
+ * The W3C `sampled` verdict for this trace, inherited from the inbound
555
+ * `traceparent` when there was one. Carried on the anchor rather than
556
+ * re-derived per outbound call so every `ctx.fetch` of one dispatch
557
+ * propagates the same answer.
558
+ */
559
+ sampled?: boolean;
560
+ traceId: string;
561
+ }
487
562
  /** What {@link createTracer} needs from the shard to build a span. */
488
563
  interface TracerDeps {
489
564
  /** The trace this ctx's spans belong to. */
@@ -560,10 +635,7 @@ interface SpanCollector {
560
635
  * class `isInternalCode` redaction exists for, so it rides the same dev-only
561
636
  * escape hatch rather than shipping to a third-party collector by default.
562
637
  */
563
- declare const createSpanCollector: (ids: {
564
- spanId: string;
565
- traceId: string;
566
- }, captureRaw?: boolean) => SpanCollector;
638
+ declare const createSpanCollector: (ids: SpanContextIds, captureRaw?: boolean) => SpanCollector;
567
639
  /**
568
640
  * Build the `ctx.trace` span factory for one dispatched function.
569
641
  *
@@ -605,7 +677,7 @@ declare const createSpanCollector: (ids: {
605
677
  *
606
678
  * **DO async-context caveat (EXPERIMENTAL, partially workerd-validated).**
607
679
  * `tracing.enterSpan` is now confirmed to EXIST and RUN inside a real Durable
608
- * Object under `@cloudflare/vitest-pool-workers` (see
680
+ * Object under `@cloudflare/vitest-plugin` (see
609
681
  * `__tests__/workerd/context-telemetry-cf-bridge.workerd.test.ts`): it resolves
610
682
  * from `cloudflare:workers`, its callback executes and returns the body value
611
683
  * without throwing, `span.isTraced` is a real boolean, and — the key additive
@@ -625,6 +697,14 @@ declare const createTracer: (deps: TracerDeps) => ContextTracer;
625
697
  interface TracedFetchDeps {
626
698
  /** The trace the CLIENT spans belong to. */
627
699
  anchor: TraceAnchor;
700
+ /**
701
+ * Whether to record a failed fetch's error message verbatim rather than
702
+ * redacted. Same dev-only escape hatch as {@link TracerDeps.captureRaw}, and
703
+ * the same reason: a `fetch` TypeError embeds the request URL, so a key in a
704
+ * query string would otherwise reach the collector in the clear on the very
705
+ * span whose `url.full` is scrubbed by `redactUrl`.
706
+ */
707
+ captureRaw?: boolean;
628
708
  /** Function path the spans are attributed to. */
629
709
  functionPath: string;
630
710
  /**
@@ -660,6 +740,15 @@ type ContextFetch = (input: Request | string | URL, init?: RequestInit) => Promi
660
740
  * Kind is `client` rather than `internal` — that is what lets a collector draw
661
741
  * the edge to the downstream service in a service map.
662
742
  *
743
+ * **Parenting is the DISPATCH, not the enclosing `ctx.trace`.** `ctx.fetch` is
744
+ * built once per dispatch, and the enclosing span is threaded explicitly rather
745
+ * than kept on an ambient stack (no `AsyncLocalStorage` in the Durable Object
746
+ * profile — the same constraint `ctx.trace` and the `@opentelemetry/api` bridge
747
+ * document), so a fetch inside `ctx.trace("stripe", …)` renders as that span's
748
+ * SIBLING under the dispatch, not its child. The duration and the ordering are
749
+ * right and the span is never lost; only the nesting is flat. Wrap the call in
750
+ * the span whose bar you want it under and read the two side by side.
751
+ *
663
752
  * Failures are recorded and re-thrown untouched, and a non-2xx response is
664
753
  * recorded as an ERROR span (it is a failed call from the caller's point of
665
754
  * view) while still being returned normally — instrumentation, never flow
@@ -759,11 +848,12 @@ interface DatabaseTelemetryDeps {
759
848
  * increments numbers on it; the shard reads it ONCE at the dispatch boundary
760
849
  * and formats it with {@link formatTally}.
761
850
  *
762
- * Two properties fall out of that split. Per-call cost stays at a few integer
763
- * increments — no object allocation, no lookup — which matters because this is
764
- * on the path of every query. And because nothing is written through the
765
- * dispatch's `SpanHandle`, the wide-event collector is never materialized, so
766
- * a handler that instrumented nothing still doesn't trip the root-span gate.
851
+ * Per-call cost stays at a few integer increments — no object allocation, no
852
+ * lookup — which matters because this is on the path of every query. Nothing
853
+ * is written through the dispatch's `SpanHandle` either, so the wide-event
854
+ * collector is never materialized by instrumentation alone: a dispatch that
855
+ * ran queries gets a root span carrying these counters, but no `lunora.dispatch`
856
+ * log record unless the handler actually opened `ctx.span`.
767
857
  */
768
858
  tally: DatabaseTally;
769
859
  /** Read lazily — the acting user is resolved per span. */
@@ -1196,6 +1286,8 @@ interface LogEntry {
1196
1286
  level: LogLevel;
1197
1287
  message: string;
1198
1288
  timestamp: number;
1289
+ /** Trace the line was emitted under; absent outside a dispatch (container lifecycle, hibernation-path errors). What the Studio joins a log line to its waterfall on. */
1290
+ traceId?: string;
1199
1291
  }
1200
1292
  /**
1201
1293
  * A bounded, in-memory ring buffer of recent {@link LogEntry} records.
@@ -1216,10 +1308,21 @@ declare class LogBuffer {
1216
1308
  /** Backing store, kept in insertion order (oldest first). */
1217
1309
  private readonly buffer;
1218
1310
  private readonly capacity;
1311
+ /** How many entries the ring has evicted since it was last cleared. */
1312
+ private droppedCount;
1219
1313
  constructor(capacity?: number);
1314
+ /**
1315
+ * Entries evicted for capacity since the last {@link LogBuffer.clear}.
1316
+ *
1317
+ * Without it a full ring is indistinguishable from a quiet instance that
1318
+ * happened to log exactly `capacity` lines: the reader sees 500 entries
1319
+ * either way and cannot tell whether 500 lines happened or 50,000 did. The
1320
+ * count is what turns "the newest 500" into an honest statement.
1321
+ */
1322
+ get dropped(): number;
1220
1323
  /** Number of entries currently buffered. */
1221
1324
  get size(): number;
1222
- /** Drop every buffered entry. */
1325
+ /** Drop every buffered entry, including the eviction count. */
1223
1326
  clear(): void;
1224
1327
  /**
1225
1328
  * Snapshot of the buffered entries, **newest first** so the panel renders
@@ -1342,7 +1445,14 @@ interface MetricHistoryResult {
1342
1445
  * omitted field keeps the historical behaviour.
1343
1446
  */
1344
1447
  interface MetricHistoryOptions {
1345
- /** Distinct series tracked before the least-recently-updated one is evicted to admit a new one (default {@link METRIC_HISTORY_MAX_SERIES}). */
1448
+ /**
1449
+ * Distinct series tracked before a brand-new one is REFUSED admission
1450
+ * (default {@link METRIC_HISTORY_MAX_SERIES}). Nothing is evicted: an
1451
+ * already-tracked series keeps accumulating past the cap, and a flood of
1452
+ * one-off series cannot displace the app's real ones — see
1453
+ * {@link admitNewSeries}. `readMetricHistory`'s `capped` flag is the
1454
+ * read-side signal that admission is being refused.
1455
+ */
1346
1456
  maxSeries?: number;
1347
1457
  /** Minute-buckets kept per series before older rows are trimmed (default {@link METRIC_HISTORY_BUCKET_RETENTION}). */
1348
1458
  retentionBuckets?: number;
@@ -1393,9 +1503,9 @@ interface QueryStatEntry {
1393
1503
  execCount: number;
1394
1504
  /** Normalised SQL text (literals stripped, truncated). */
1395
1505
  normalizedSql: string;
1396
- /** Total rows read across all executions (SELECT result sizes). */
1506
+ /** Total rows SCANNED across all executions (the billed number, not the result-set size). */
1397
1507
  rowsRead: number;
1398
- /** Total rows written across all executions. */
1508
+ /** Total rows WRITTEN across all executions. */
1399
1509
  rowsWritten: number;
1400
1510
  /** Total wall-clock milliseconds across all executions. */
1401
1511
  totalDurationMs: number;
@@ -1476,6 +1586,8 @@ type RequestOutcome = "error" | "ok";
1476
1586
  interface RequestLogEntry {
1477
1587
  /** Whether the result was served from the reactive cache; `undefined` when the cache is disabled or the path isn't cached (a write/action). */
1478
1588
  cacheHit?: boolean;
1589
+ /** Worker deployment id from the `CF_VERSION_METADATA` binding; `undefined` when the binding isn't declared. Group on this to answer "did this start with a deploy?". */
1590
+ deploymentId?: string;
1479
1591
  /** Handler wall-clock duration in milliseconds (before the subscription write-flush, matching the per-function metrics). */
1480
1592
  durationMs: number;
1481
1593
  /** Error message when `outcome === "error"`, redacted like args/identity; absent on success. */
@@ -1498,14 +1610,19 @@ interface RequestLogEntry {
1498
1610
  tablesRead: string[];
1499
1611
  /** Tables the handler wrote (from the change tracker); empty for a read-only dispatch. */
1500
1612
  tablesWritten: string[];
1613
+ /** W3C trace id (32-hex) of the dispatch; `undefined` on a row appended before this column existed. See the module docstring on the retention asymmetry. */
1614
+ traceId?: string;
1501
1615
  /** Wall-clock millis when the dispatch completed. */
1502
1616
  ts: number;
1503
1617
  /** Acting userId forwarded by the runtime, or `undefined` when anonymous. */
1504
1618
  userId?: string;
1619
+ /** Worker version tag from the `CF_VERSION_METADATA` binding; `undefined` when the binding isn't declared or the deploy carried no tag. */
1620
+ versionTag?: string;
1505
1621
  }
1506
1622
  /** Fields accepted when appending one request-log entry; `seq` is assigned by the table. */
1507
1623
  interface AppendRequestLogEntry {
1508
1624
  cacheHit?: boolean;
1625
+ deploymentId?: string;
1509
1626
  durationMs: number;
1510
1627
  errorMessage?: string;
1511
1628
  functionPath: string;
@@ -1516,8 +1633,10 @@ interface AppendRequestLogEntry {
1516
1633
  subscriptionsReRun?: number;
1517
1634
  tablesRead?: string[];
1518
1635
  tablesWritten?: string[];
1636
+ traceId?: string;
1519
1637
  ts: number;
1520
1638
  userId?: string;
1639
+ versionTag?: string;
1521
1640
  }
1522
1641
  /** Knobs the dispatch site threads into a request-log write. */
1523
1642
  interface RequestLogWriteOptions {
@@ -1536,14 +1655,19 @@ interface ReadRequestLogOptions {
1536
1655
  outcome?: RequestOutcome;
1537
1656
  /** Exact shard-key match. */
1538
1657
  shardKey?: string;
1539
- /** Only entries strictly after this cursor (forward paging). */
1658
+ /**
1659
+ * Only entries strictly after this cursor. Setting it switches the read to
1660
+ * ASCENDING order — see {@link readRequestLog} — because that is the only
1661
+ * ordering under which advancing the cursor to the last returned `seq`
1662
+ * actually pages forward without a hole.
1663
+ */
1540
1664
  sinceSeq?: number;
1541
1665
  /** Keep only entries whose read OR written table set contains this table. */
1542
1666
  tableTouched?: string;
1543
1667
  /** Exact acting-userId match. */
1544
1668
  userId?: string;
1545
1669
  }
1546
- /** Payload of a `__lunora_admin__:getRequestLog` call: the recorded entries, newest first. */
1670
+ /** Payload of a `__lunora_admin__:getRequestLog` call: the recorded entries, newest first — or oldest first when the request paged forward with `sinceSeq` (see {@link readRequestLog}). */
1547
1671
  interface RequestLogResult {
1548
1672
  entries: RequestLogEntry[];
1549
1673
  }
@@ -1609,31 +1733,31 @@ interface ReadIssuesOptions {
1609
1733
  userId?: string;
1610
1734
  }
1611
1735
  /**
1612
- * Redact the secrets / PII out of a value before it reaches the durable log or a
1613
- * Logpush event, via `@visulima/redact`'s `standardRules`. Unlike a blunt
1614
- * type-tag stamp this masks sensitive values by PATTERN (not just by key name)
1615
- * while leaving benign values readable, so the studio's args/identity columns
1616
- * stay useful. `null` / `undefined` pass through unchanged.
1617
- *
1618
- * What `standardRules` actually catches differs by shape, verified against its
1619
- * real behavior rather than assumed from its name: on a KEYED object (`args`,
1620
- * `identity`) it also matches by key name, so `{ password: "hunter2" }` and
1621
- * `{ token: "…" }` ARE masked regardless of the value's shape. On a PLAIN
1622
- * STRING — which is what `errorMessage`/log `fields`-as-rendered-text are —
1623
- * only pattern-shaped matches apply: emails, long digit runs / structured
1624
- * numeric IDs (credit-card, phone, SSN, AWS-access-key-style), and an explicit
1625
- * `Bearer <token>` / `token=…`-shaped substring. A free-text `password=hunter2`
1626
- * or a bare provider API key embedded in prose (e.g. `sk-live-…`) is NOT
1627
- * caught on a plain string — there is no key to match against, and neither is
1628
- * a recognized value pattern. So this is a PII-pattern net for rendered text,
1629
- * not a general secrets scrubber; a handler that echoes a raw credential into
1630
- * an error message or a log string can still leak it through here. Works on a
1631
- * plain string too (`redact` traverses whatever value it's handed), which is
1632
- * how {@link appendRequestLogEntry} and {@link emitRequestLogEvent} reuse this
1633
- * for `errorMessage` — a validation error echoes the offending value, a
1634
- * constraint error quotes the conflicting row, so the error message is at
1635
- * least as PII-dense as args and gets the same treatment (with the free-text
1636
- * caveat above).
1736
+ * Redact the secrets / PII out of a value before it reaches the durable log, a
1737
+ * Logpush event, a function-metrics row or a span's error message:
1738
+ * `maskCredentials`, then `@visulima/redact`'s `standardRules`. `null` /
1739
+ * `undefined` pass through unchanged.
1740
+ *
1741
+ * On a KEYED object (`args`, `identity`), a key that names a credential
1742
+ * (`accessToken`, `client_secret`, `X-Api-Key`, `sessionId`, `otp`, `pin`,
1743
+ * `DATABASE_URL`) has its value masked, numbers included; a key that measures
1744
+ * credentials (`maxTokens`, `tokenUsage`) keeps its numbers. See
1745
+ * `shared/credential-redaction.ts` for how keys are judged.
1746
+ *
1747
+ * On a STRING (`errorMessage`, a URL, a log line), every URL loses its query,
1748
+ * fragment and userinfo; `name=value`, `name: value` and `"name":"value"` pairs
1749
+ * with a credential name are masked; `Basic …`, `Bearer …` and `Digest …` are
1750
+ * masked; and so is a bare token in prose with no name attached, when its format
1751
+ * has a distinctive vendor prefix (`failed with sk_live_…`, `ghp_…`, `xoxb-…`,
1752
+ * `AKIA…`, JWTs, … — see `SECRET_VALUE_RULES`), all by `maskCredentials`.
1753
+ * `standardRules`' value patterns (emails, long digit runs) then mask PII. Every
1754
+ * string is truncated to 4 KiB in what is stored, and once 16 KiB of one value has
1755
+ * been examined the remaining strings are replaced with a marker, so no arg can
1756
+ * hold the Durable Object in regex work.
1757
+ *
1758
+ * Still NOT caught: a bare secret with no name attached and no vendor prefix (a
1759
+ * random hex key, a password in a sentence). This is a credential-and-PII net,
1760
+ * not proof that no secret can reach the log.
1637
1761
  *
1638
1762
  * `captureRaw` is the development escape hatch: in a dev environment the dispatch
1639
1763
  * site (`isDevEnvironment`) passes `true` to skip redaction so a developer can
@@ -1651,12 +1775,17 @@ declare const redactArgs: (value: unknown, captureRaw?: boolean) => unknown;
1651
1775
  *
1652
1776
  * `error_fingerprint` is the {@link fingerprintError} grouping hash captured
1653
1777
  * from the RAW `error_message` at write time, before {@link appendRequestLogEntry}
1654
- * redacts it — see that function's docstring. It is added via a guarded
1655
- * `ALTER TABLE` rather than baked into the `CREATE`, mirroring
1778
+ * redacts it — see that function's docstring. `trace_id` is the dispatch's W3C
1779
+ * trace id, the correlation key to the span ring and to whatever collector
1780
+ * `otlpSink` ships to.
1781
+ *
1782
+ * Both are also added via a guarded `ALTER TABLE`, mirroring
1656
1783
  * `function-metrics.ts`'s `ensureFunctionMetricsTables`, so a shard whose
1657
- * `__lunora_reqlog__` predates this column gains it on the next call without a
1784
+ * `__lunora_reqlog__` predates a column gains it on the next call without a
1658
1785
  * migration. SQLite has no `ADD COLUMN IF NOT EXISTS`, so the duplicate-column
1659
- * error from a re-run (or the freshly-created schema above) is swallowed.
1786
+ * error from a re-run (or from the freshly-created schema above) is swallowed
1787
+ * per column — the loop is what keeps one column's duplicate from skipping the
1788
+ * next column's add.
1660
1789
  */
1661
1790
  declare const ensureRequestLogTable: (sql: SqlExec) => void;
1662
1791
  /**
@@ -1747,12 +1876,21 @@ declare const parseLogArgs: (args: unknown[], boundFields?: LogFields) => {
1747
1876
  */
1748
1877
  declare const emitLogEvent: (input: LogEventInput, options?: RequestLogWriteOptions) => void;
1749
1878
  /**
1750
- * Read request-log entries newest-first, AND-combining the supplied filters
1751
- * (function-path prefix, exact userId/shardKey/outcome, and a table-touched
1752
- * match against the read OR written table sets), up to `limit` (clamped to
1753
- * [1, 10000]). Each value is a bound parameter, so no filter can inject SQL.
1754
- * Creates the table first so reads on a never-logged shard return `[]` instead
1755
- * of throwing. Mirrors `readAuditLog`/`readCdcChanges`.
1879
+ * Read request-log entries, AND-combining the supplied filters (function-path
1880
+ * prefix, exact userId/shardKey/outcome, and a table-touched match against the
1881
+ * read OR written table sets), up to `limit` (clamped to [1, 10000]). Each value
1882
+ * is a bound parameter, so no filter can inject SQL. Creates the table first so
1883
+ * reads on a never-logged shard return `[]` instead of throwing. Mirrors
1884
+ * `readAuditLog`/`readCdcChanges`.
1885
+ *
1886
+ * **Ordering follows `sinceSeq`.** Without a cursor this is a "show me the tail"
1887
+ * read and returns NEWEST FIRST, which is what the studio's Logs tab renders.
1888
+ * With `sinceSeq` it is forward paging and returns OLDEST FIRST, starting at the
1889
+ * cursor: descending there silently loses rows, because `ORDER BY seq DESC LIMIT
1890
+ * n` answers "the newest n after the cursor", so a consumer that advances to the
1891
+ * largest returned `seq` skips everything between `sinceSeq` and that page
1892
+ * whenever more than `limit` rows accumulated between polls — the more traffic
1893
+ * the shard takes, the more it drops.
1756
1894
  */
1757
1895
  declare const readRequestLog: (sql: SqlExec, options?: ReadRequestLogOptions) => RequestLogEntry[];
1758
1896
  declare const readErrorIssues: (sql: SqlExec, options?: ReadIssuesOptions) => ErrorIssue[];
@@ -1770,7 +1908,7 @@ type SecurityFindingLevel = "error" | "info" | "warning";
1770
1908
  *
1771
1909
  * `admin-token-weak`: `LUNORA_ADMIN_TOKEN` is set but short enough to be brute-forceable. (An *unset* token disables admin introspection entirely, so this audit — itself admin-gated — only ever runs with a token present.)
1772
1910
  *
1773
- * `ws-gate-open`: admin HTTP RPCs require the bearer, but `LUNORA_WS_BEARER` is unset so the WebSocket upgrade gate defaults open — live admin subscriptions (Logs, Metrics, …) are reachable without a credential.
1911
+ * `ws-gate-open`: `LUNORA_WS_BEARER` is unset, so the WebSocket upgrade gate defaults open and anyone who can reach the worker can open a socket and run ordinary USER subscriptions (whatever `ctx.auth` / RLS then allows them to read). Admin subscriptions are NOT part of this: they require the socket's `admin` stamp, which the upgrade sets only from `LUNORA_ADMIN_TOKEN` or a minted admin sub-token, so an unset `LUNORA_WS_BEARER` never exposes Logs/Metrics/introspection. Which is why this is a posture finding about the app's own live-query surface, not an admin hole — set the var when subscribers are expected to present a shared credential.
1774
1912
  *
1775
1913
  * `dev-args-unredacted`: the worker reports a development environment, so the durable request log captures raw, un-redacted args and identity (PII). A production deploy mislabeled as dev would persist sensitive payloads.
1776
1914
  *
@@ -1842,6 +1980,15 @@ interface TraceSpan {
1842
1980
  message: string;
1843
1981
  type: string;
1844
1982
  };
1983
+ /**
1984
+ * Timestamped occurrences inside the span — `span.addEvent(...)` and
1985
+ * `span.recordException(...)`. Carried through so a handled retry or a
1986
+ * swallowed exception is visible on the span it happened in, which is the
1987
+ * only place it is interpretable. Absent when the body recorded none.
1988
+ */
1989
+ events?: SpanEventPoint[];
1990
+ /** OTel `SpanKind`; absent means `"internal"`. */
1991
+ kind?: OtlpSpanKind;
1845
1992
  name: string;
1846
1993
  /** Start of this span relative to the trace's start, in ms. */
1847
1994
  offsetMs: number;
@@ -1860,12 +2007,25 @@ interface TraceSummary {
1860
2007
  rootName: string;
1861
2008
  shardKey?: string;
1862
2009
  /**
1863
- * Spans ordered by `(offsetMs, depth)`, ready to render as waterfall rows.
1864
- * Start time alone is not enough to order them: spans are recorded on
1865
- * completion and `startTs` has millisecond resolution, so a parent and its
1866
- * child routinely tie. Breaking that tie by depth makes the sequence a valid
1867
- * pre-order traversal of the span tree, so indenting each row by its `depth`
1868
- * yields the nesting without a separate tree walk.
2010
+ * Spans in **pre-order**, ready to render as waterfall rows: every span is
2011
+ * immediately followed by its own subtree, siblings in start order. So
2012
+ * indenting each row by its `depth` yields the real nesting — the row above
2013
+ * a `depth`-`n+1` row is genuinely its parent.
2014
+ *
2015
+ * This is a tree walk, not a sort, because no ordering on `(offsetMs,
2016
+ * depth)` can produce it. Given a parent, its child `a`, `a`'s child `a1`
2017
+ * and `a`'s sibling `b` all at offset 0, that comparator yields
2018
+ * `parent, a, b, a1` — which renders `a1` indented beneath `b`, under a
2019
+ * parent it does not belong to.
2020
+ *
2021
+ * **Why they tie is not millisecond resolution.** On the Workers runtime
2022
+ * `Date.now()` is pinned to the time of the last I/O — a Spectre mitigation,
2023
+ * not a bug — so it does not advance at all across pure computation. Every
2024
+ * duration in this package is `Date.now() - startTs`, which means a span
2025
+ * wrapping CPU-only work reports `0`, and a parent whose child performed no
2026
+ * I/O shares its exact start and end. See `docs/concepts/observability`
2027
+ * ("Span durations on Workers"); the practical consequence is that a `0 ms`
2028
+ * span means "no I/O happened here", not "this was fast".
1869
2029
  */
1870
2030
  spans: TraceSpan[];
1871
2031
  startTs: number;
@@ -1880,10 +2040,19 @@ interface TraceSummary {
1880
2040
  declare class SpanBuffer {
1881
2041
  private readonly buffer;
1882
2042
  private readonly capacity;
2043
+ /** How many spans the ring has evicted since it was last cleared. */
2044
+ private droppedCount;
1883
2045
  constructor(capacity?: number);
2046
+ /**
2047
+ * Spans evicted for capacity since the last {@link SpanBuffer.clear}. The
2048
+ * ring silently drops its oldest span once full, which makes a busy instance
2049
+ * look identical to one that recorded exactly `capacity` spans; this count
2050
+ * is the difference between the two.
2051
+ */
2052
+ get dropped(): number;
1884
2053
  /** Number of spans currently buffered. */
1885
2054
  get size(): number;
1886
- /** Drop every buffered span. */
2055
+ /** Drop every buffered span, including the eviction count. */
1887
2056
  clear(): void;
1888
2057
  /** Snapshot of the buffered spans in insertion order. Fresh array per call. */
1889
2058
  entries(): SpanEvent[];
@@ -1965,4 +2134,61 @@ declare const resolveTraceAnchor: (traceparent: string | undefined) => {
1965
2134
  sampled: boolean;
1966
2135
  traceId: string;
1967
2136
  };
1968
- export { AUTH_METRICS_BUCKETS_TABLE, AUTH_METRICS_BUCKET_MS, AUTH_METRICS_BUCKET_RETENTION, AUTH_METRICS_TABLE, type AiRunBinding, type AppendRequestLogEntry, type AuthMetrics, type AuthMetricsBucket, type ContextFetch, type ContextLogLevel, type ContextMetrics, type ContextTracer, DEFAULT_EXPLAIN_ISSUE_MODEL, type DanglingReference, type DanglingReferenceResult, type DatabaseInstrumentation, type DatabaseTally, type DatabaseTelemetryDeps, type ErrorIssue, type ExplainIssueArgs, type ExplainIssueDegradedReason, type ExplainIssueGrounding, type ExplainIssueResult, FUNCTION_METRICS_BUCKETS_TABLE, FUNCTION_METRICS_BUCKET_MS, FUNCTION_METRICS_BUCKET_RETENTION, FUNCTION_METRICS_INDEX_TABLE, FUNCTION_METRICS_MAX_PATHS, FUNCTION_METRICS_READ_LIMIT, FUNCTION_METRICS_SCANS_TABLE, FUNCTION_METRICS_TABLE, type FoldedTraces, type FunctionMetricBucket, type FunctionMetricBucketsResult, type FunctionMetricIndexHit, type HostSpanLike, type HostTracingLike, type HostTracingResolver, ISSUE_SEVERITIES, ISSUE_STATE_TABLE, ISSUE_STATUSES, type IndexHit, type IssueSeverity, type IssueState, type IssueStatePatch, type IssueStatus, type IssuesResult, LogBuffer, type LogEntry, type LogEventInput, type LogLevel, MIN_ADMIN_TOKEN_LENGTH, MIN_AUTH_SECRET_LENGTH, MetricBuffer, type MetricEvent, type MetricHistoryOptions, type MetricHistoryPoint, type MetricHistoryResult, type MetricHistorySeries, type MetricKind, type MetricSeries, type MetricsDeps, type QueryInsightBucket, type QueryInsightEntry, type QueryInsightsResult, type QueryStatEntry, REQUEST_LOG_TABLE, type ReadIssuesOptions, type ReadRequestLogOptions, type RecordAuthEventInput, type RecordFunctionMetricInput, type RequestLogEntry, type RequestLogResult, type RequestLogWriteOptions, type RequestOutcome, type SecurityAuditResult, type SecurityFinding, type SecurityFindingKind, type SecurityFindingLevel, SpanBuffer, type SpanCollection, type SpanCollector, type SpanEvent, type SpanEventPoint, type SpanHandle, type OtlpSpanKind as SpanKind, type SpanLink, type SpanOptions, type TraceAnchor, type TraceSpan, type TraceSummary, type TracedFetchDeps, type TracerDeps, appendRequestLogEntry, buildSecurityAudit, createDatabaseTally, createMetrics, createSpanCollector, createTracedFetch, createTracer, dispatchRootSpan, emitLogEvent, emitRequestLogEvent, ensureAuthMetricsTables, ensureFunctionMetricsTables, ensureRequestLogTable, explainIssue, findDanglingReferences, foldTraces, formatTally, instrumentDatabase, mergeScanAttribution, parseExplainIssueArgs, parseLogArgs, readAuthMetrics, readErrorIssues, readFunctionMetricBuckets, readFunctionMetricIndexHits, readFunctionMetricScans, readFunctionMetrics, readFunctionMetricsTotals, readMetricHistory, readQueryInsights, readQueryMetrics, readRequestLog, recordAuthEvent, recordFunctionMetric, recordMetricHistory, recordQueryMetric, redactArgs, resolveTraceAnchor, upsertIssueState };
2137
+ export { AUTH_METRICS_BUCKETS_TABLE, AUTH_METRICS_BUCKET_MS, AUTH_METRICS_BUCKET_RETENTION, AUTH_METRICS_TABLE, type AiRunBinding, type AppendRequestLogEntry,
2138
+ /**
2139
+ * `@lunora/observability` — host-neutral telemetry storage and read models.
2140
+ *
2141
+ * Logs, traces, metrics, issue grouping and the security-audit view: the data
2142
+ * behind the Studio's observability pages. None of it is Cloudflare-specific —
2143
+ * it reads and writes through the SQL handle the engine hands it, and it lived
2144
+ * inside `@lunora/do` only because that is where the Durable Object it
2145
+ * instruments happens to live.
2146
+ *
2147
+ * The dependency runs `@lunora/do` → here → `@lunora/shard-engine`, never the
2148
+ * reverse, which is what makes this reusable by a second host rather than
2149
+ * merely relocated.
2150
+ *
2151
+ * This barrel is deliberately curated rather than `export *`. A star export
2152
+ * would promote every module internal to permanent public API — the exact
2153
+ * mistake `@lunora/do`'s own barrel documents having made once with the search
2154
+ * core. What is exported here is what a consumer actually needs.
2155
+ */
2156
+ type AuthMetrics,
2157
+ /**
2158
+ * `@lunora/observability` — host-neutral telemetry storage and read models.
2159
+ *
2160
+ * Logs, traces, metrics, issue grouping and the security-audit view: the data
2161
+ * behind the Studio's observability pages. None of it is Cloudflare-specific —
2162
+ * it reads and writes through the SQL handle the engine hands it, and it lived
2163
+ * inside `@lunora/do` only because that is where the Durable Object it
2164
+ * instruments happens to live.
2165
+ *
2166
+ * The dependency runs `@lunora/do` → here → `@lunora/shard-engine`, never the
2167
+ * reverse, which is what makes this reusable by a second host rather than
2168
+ * merely relocated.
2169
+ *
2170
+ * This barrel is deliberately curated rather than `export *`. A star export
2171
+ * would promote every module internal to permanent public API — the exact
2172
+ * mistake `@lunora/do`'s own barrel documents having made once with the search
2173
+ * core. What is exported here is what a consumer actually needs.
2174
+ */
2175
+ type AuthMetricsBucket, type ContextFetch, type ContextLogLevel, type ContextMetrics, type ContextTracer, DEFAULT_EXPLAIN_ISSUE_MODEL, type DanglingReference, type DanglingReferenceResult, type DatabaseInstrumentation, type DatabaseTally, type DatabaseTelemetryDeps, type ErrorIssue, type ExplainIssueArgs, type ExplainIssueDegradedReason, type ExplainIssueGrounding, type ExplainIssueResult, FUNCTION_METRICS_BUCKETS_TABLE, FUNCTION_METRICS_BUCKET_MS, FUNCTION_METRICS_BUCKET_RETENTION, FUNCTION_METRICS_INDEX_TABLE, FUNCTION_METRICS_MAX_PATHS, FUNCTION_METRICS_READ_LIMIT, FUNCTION_METRICS_SCANS_TABLE, FUNCTION_METRICS_TABLE, type FoldedTraces, type FunctionMetricBucket, type FunctionMetricBucketsResult, type FunctionMetricIndexHit, type HostSpanLike, type HostTracingLike, type HostTracingResolver, ISSUE_SEVERITIES, ISSUE_STATE_TABLE, ISSUE_STATUSES, type IndexHit, type IssueSeverity, type IssueState, type IssueStatePatch, type IssueStatus, type IssuesResult, LogBuffer, type LogEntry, type LogEventInput, type LogLevel, MIN_ADMIN_TOKEN_LENGTH, MIN_AUTH_SECRET_LENGTH, MetricBuffer, type MetricEvent, type MetricHistoryOptions, type MetricHistoryPoint, type MetricHistoryResult, type MetricHistorySeries, type MetricKind, type MetricSeries, type MetricsDeps, type QueryInsightBucket, type QueryInsightEntry, type QueryInsightsResult, type QueryStatEntry, REQUEST_LOG_TABLE, type ReadIssuesOptions, type ReadRequestLogOptions,
2176
+ /**
2177
+ * `@lunora/observability` — host-neutral telemetry storage and read models.
2178
+ *
2179
+ * Logs, traces, metrics, issue grouping and the security-audit view: the data
2180
+ * behind the Studio's observability pages. None of it is Cloudflare-specific —
2181
+ * it reads and writes through the SQL handle the engine hands it, and it lived
2182
+ * inside `@lunora/do` only because that is where the Durable Object it
2183
+ * instruments happens to live.
2184
+ *
2185
+ * The dependency runs `@lunora/do` → here → `@lunora/shard-engine`, never the
2186
+ * reverse, which is what makes this reusable by a second host rather than
2187
+ * merely relocated.
2188
+ *
2189
+ * This barrel is deliberately curated rather than `export *`. A star export
2190
+ * would promote every module internal to permanent public API — the exact
2191
+ * mistake `@lunora/do`'s own barrel documents having made once with the search
2192
+ * core. What is exported here is what a consumer actually needs.
2193
+ */
2194
+ type RecordAuthEventInput, type RecordFunctionMetricInput, type RequestLogEntry, type RequestLogResult, type RequestLogWriteOptions, type RequestOutcome, type SecurityAuditResult, type SecurityFinding, type SecurityFindingKind, type SecurityFindingLevel, SpanBuffer, type SpanCollection, type SpanCollector, type SpanEvent, type SpanEventPoint, type SpanHandle, type OtlpSpanKind as SpanKind, type SpanLink, type SpanOptions, type TraceAnchor, type TraceSpan, type TraceSummary, type TracedFetchDeps, type TracerDeps, appendRequestLogEntry, buildSecurityAudit, createDatabaseTally, createMetrics, createSpanCollector, createTracedFetch, createTracer, dispatchRootSpan, emitLogEvent, emitRequestLogEvent, ensureAuthMetricsTables, ensureFunctionMetricsTables, ensureRequestLogTable, explainIssue, findDanglingReferences, foldTraces, formatTally, instrumentDatabase, mergeScanAttribution, parseExplainIssueArgs, parseLogArgs, readAuthMetrics, readErrorIssues, readFunctionMetricBuckets, readFunctionMetricIndexHits, readFunctionMetricScans, readFunctionMetrics, readFunctionMetricsTotals, readMetricHistory, readQueryInsights, readQueryMetrics, readRequestLog, recordAuthEvent, recordFunctionMetric, recordMetricHistory, recordQueryMetric, redactArgs, resolveTraceAnchor, setHostSpanAttributes, upsertIssueState };