@claxedo/workspace-relay 0.7.0 → 0.10.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.
@@ -1,60 +0,0 @@
1
- /**
2
- * T10: Synthetic end-to-end probe.
3
- *
4
- * Liveness depends on metrics; metrics can lie. A synthetic probe periodically
5
- * exercises the relay's HTTP path and records RTT so we have an independent
6
- * signal that the data path actually works.
7
- *
8
- * Implementation notes
9
- * --------------------
10
- * - The probe targets `${relayUrl}/health` rather than minting a Runtime
11
- * Access Token and hitting `/workspaces/<id>/...`. `/health` validates HTTP
12
- * connectivity end-to-end without pretending the Relay owns Control Plane
13
- * token issuance.
14
- * - All clocks, timers and `fetch` are injectable so tests stay deterministic.
15
- * - "Loud" logs after 3 consecutive failures use `console.error` by default;
16
- * pageability (PagerDuty / equivalent) is wired separately.
17
- */
18
- export type SyntheticProbeStats = {
19
- successCount: number;
20
- failureCount: number;
21
- consecutiveFailures: number;
22
- /** RTT (ms) of the most recent probe attempt. Undefined before the first probe completes. */
23
- lastRttMs?: number;
24
- /** p50 / p99 over the rolling RTT window. Undefined if no successes yet. */
25
- p50?: number;
26
- p99?: number;
27
- /** Number of RTTs currently in the rolling window. */
28
- windowSize: number;
29
- };
30
- export type SyntheticProbe = {
31
- stop(): void;
32
- stats(): SyntheticProbeStats;
33
- };
34
- export type SyntheticProbeOptions = {
35
- /** Base URL of the relay, e.g. `http://127.0.0.1:7777`. No trailing slash required. */
36
- relayUrl: string;
37
- /** Probe cadence. Default 60_000 (60 s). */
38
- intervalMs?: number;
39
- /** Summary log cadence (p50/p99). Default 300_000 (5 min). */
40
- summaryIntervalMs?: number;
41
- /** Path to probe. Default `/health`. */
42
- probePath?: string;
43
- /** Rolling window size for RTT percentile calculation. Default 100. */
44
- rttWindowSize?: number;
45
- /** Number of consecutive failures that triggers a loud log. Default 3. */
46
- loudFailureThreshold?: number;
47
- /** Override `fetch`. Defaults to global `fetch`. */
48
- fetch?: typeof fetch;
49
- /** Override clock for tests. Defaults to `Date.now`. */
50
- now?: () => number;
51
- /** Override `setInterval` for tests. Defaults to global `setInterval`. */
52
- setInterval?: typeof setInterval;
53
- /** Override `clearInterval` for tests. Defaults to global `clearInterval`. */
54
- clearInterval?: typeof clearInterval;
55
- /** Loud-failure logger. Defaults to `console.error`. */
56
- logError?: (msg: string, fields?: Record<string, unknown>) => void;
57
- /** Periodic summary logger (p50/p99). Defaults to `console.log`. */
58
- logSummary?: (msg: string, fields?: Record<string, unknown>) => void;
59
- };
60
- export declare function startSyntheticProbe(options: SyntheticProbeOptions): SyntheticProbe;