Skip to content

feat(sandbox): add MSW mock intake panel to visualize OTLP exports#347

Draft
mquentin wants to merge 5 commits into
open-telemetry:mainfrom
mquentin:mquentin/sandbox_msw_intake_panel
Draft

feat(sandbox): add MSW mock intake panel to visualize OTLP exports#347
mquentin wants to merge 5 commits into
open-telemetry:mainfrom
mquentin:mquentin/sandbox_msw_intake_panel

Conversation

@mquentin

@mquentin mquentin commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Disclaimer

The sandbox UI now has redundancy between the Event Log and Intake received sections, and the expand feature in Intake received isn't responsive... I'm happy to invest more time fixing this if the SIG considers the initiative worthwhile.

Also the recent e2e testing initiative #332 has been merged which share quite some MSW approach with this PR.

What

Screenshot 2026-07-10 at 17 22 41

Adds an in-browser "Intake received" panel to the sandbox that intercepts the
SDK's OTLP/HTTP exports with MSW and renders exactly what a
collector would receive over the wire — no backend, no CORS, no extra process.

It sits under the "Equivalent SDK init" panel, so you get a side-by-side of
"here's the code / action""here's what got exported".

Why

The sandbox could trigger telemetry but there was no way to see the resulting
export payloads without an external collector (and cross-origin exports to
localhost:4318 would otherwise need CORS). MSW intercepts the request inside
the browser, so it works with zero setup — and, being fully client-side, it also
works on the deployed GitHub Pages showcase.

How it works

  • MSW handlers intercept POST */v1/traces and */v1/logs, decode the OTLP JSON
    (AnyValue/KeyValue, span durations, session.id), and publish to the UI.
  • The panel shows a request feed (batching + payload size + signal badge) →
    expand to see records grouped by instrumentation scope, each with duration,
    trace=…, and a session=… chip → per-request raw OTLP JSON toggle.

Usage

  • Local: npm run dev — enabled automatically in dev (single command, no
    extra process).
  • Deployed / any build: append ?intake=mock to the URL.
  • Point the sandbox at a real collector (config form / query string) and the mock
    stays out of the way — it's dev/flag-gated so it never swallows real exports.

@mquentin
mquentin force-pushed the mquentin/sandbox_msw_intake_panel branch from 56a82dc to f74f16f Compare July 17, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant