Commit 59c3e24
authored
E2e distributed tracing: suite-owned motel, browser OTLP, end-to-end trace join (#979)
* Install @executor-js/motel for local trace inspection
Our fork of kitlangton/motel (UsefulSoftwareCo/motel) with the query-
worker serialization fix: trace/span detail endpoints 500ed upstream
('Expected JSON value' — shared span objects tripping Schema.Unknown's
isJson guard). Run it with `bun run motel` in e2e/, then E2E_MOTEL=1
sends browser + server spans there during runs.
* Run pages link every API call to its distributed trace
The browser surface harvests the W3C traceparent the web app already
sends on each API request into the run's traces.json (id + offset +
url). The runs viewer renders them as a Distributed traces table — one
row per call, linking into the local motel's per-trace waterfall — so
'why was that page slow in this recording' goes from the recording to
the exact click→server→DB trace in two clicks. Spans exist in motel
when the run exported there (E2E_MOTEL=1); ids harvest regardless.
* E2e distributed tracing: suite-owned motel, browser OTLP, trace join
Every e2e run captures distributed traces. A suite-owned motel (local
OTLP store) boots alongside the WorkOS/Autumn emulators — own port,
runs-local store wiped per boot, torn down with the suite — and the
cloud boot recipe gains an extraEnv seam so the globalsetup points the
app's exporter at it (the same endpoint-agnostic layer that ships prod
traces to Axiom).
The web client exports OTLP spans when the build names an endpoint
(VITE_PUBLIC_OTLP_TRACES_URL, proxied same-origin to motel in dev), and
the cloud worker's http.server span adopts the caller's W3C traceparent
— one trace id from the click in the browser through the worker to the
database. Run pages list every harvested trace id with links into
motel's waterfall.
Also switches the worker's span processor Simple → Batch: per-span
synchronous export fetches under the dev worker added enough request
latency to flip the approval pause/resume race in e2e; batching removes
the class, and the existing ctx.waitUntil(forceFlush) still drains per
request in prod.
* CLI/MCP calls join the run's distributed-trace ledger
The web app's HttpClient sends a traceparent on its own, but mcporter's
plain fetch does not — so the terminal half of a session was invisible
in traces.json. The MCP surface now wraps the global fetch: every POST
to the target's MCP endpoint gets a minted traceparent (the worker and
DO already join whatever arrives) and lands in the ledger with the
JSON-RPC method or tool name as its label, duration, status, and
source: terminal. traces.json becomes a shared append-merge ledger
(src/trace-harvest.ts) so the browser surface's harvested entries and
the MCP surface's minted ones interleave by wall clock, and the trace
rail tags each row with its window (⌨ terminal / ⊕ browser).1 parent fe5181b commit 59c3e24
14 files changed
Lines changed: 825 additions & 48 deletions
File tree
- apps/cloud
- src
- observability
- e2e
- setup
- src
- surfaces
- viewer/src
- packages/react/src/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
89 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
90 | 118 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 119 | + | |
| 120 | + | |
101 | 121 | | |
102 | 122 | | |
103 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
| |||
0 commit comments