Skip to content

feat: add devtools trace capture to web profiling - #180

Merged
kalvinnchau merged 1 commit into
mainfrom
coffee/profile-trace
Sep 23, 2026
Merged

kalvinnchau merged 1 commit into
mainfrom
coffee/profile-trace

Conversation

@kalvinnchau

@kalvinnchau kalvinnchau commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds just web profile --trace, which records a Chromium DevTools Performance trace to chromium-trace.json via Playwright browser.startTracing(page) / stopTracing() (default timeline categories).

  • --trace replaces the renderer CDP Profiler capture: the trace already includes V8 CPU samples (~128 µs interval vs 1 ms), and running both stacks two samplers. The broker .cpuprofile and --network capture are unchanged.
  • The trace is written in the capture finally before browser.close(); a failed stop is reported with the other capture failures.
  • Manifest coverage reports chromium-trace instead of chromium-renderer.

Validation

  • node --test tests/integration/profile-dev.test.mjs: 35/35. The 3 new tests (traced artifacts/manifest; cancel during a pending startTracing with late resolve and late reject) fail on main.
  • Manual just web profile --network --trace run (~100 s): trace loads in DevTools with layout/paint events, ProfileChunk samples, and React performance tracks.

Traces are large (~47 MB for 10 s, ~286 MB for 100 s), so the docs recommend short sessions.

`just web profile --trace` records a Chromium DevTools Performance trace
(chromium-trace.json) through Playwright's browser tracing in place of the
renderer CPU profile. The trace carries style, layout and paint events,
React's performance tracks and denser CPU samples; skipping the separate
renderer Profiler avoids stacking a second sampler on the timings.

Co-authored-by: Kalvin Chau <kalvin@block.xyz>
Signed-off-by: Kalvin Chau <kalvin@block.xyz>
@kalvinnchau
kalvinnchau marked this pull request as ready for review September 23, 2026 22:12
@kalvinnchau
kalvinnchau requested review from a team, comp615 and wesbillman as code owners September 23, 2026 22:12

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Carl, an automated reviewer, commenting via Wes’s GitHub account.

No blocking findings at 8ab0b52d51e0ebb8fe96c32a4df6e34836ee9743 against a47ddaf452e605a59056476d2091146e1f3902e8. One optional documentation clarification inline. This is a review comment, not formal approval.

Validation: hosted CI is green, including the trace/cancellation fixtures. An independent synthetic capture using pinned Playwright 1.63.0 and installed Chrome 153 produced JSON with CPU samples, layout and paint events. Two focused failure-injection checks confirmed start/stop failures retain broker/network artifacts, close resources, and report failure. No broad local rerun.

The actual-producer check was headless and used only synthetic local data. I did not repeat the author’s attended full-app/React-track capture or DevTools UI import.

Comment thread docs/contributing.md
fragments, and WebSocket frame data are omitted. Use `just web profile --trace`
to record a Chromium DevTools Performance trace (`chromium-trace.json`, with
style/layout/paint events, React's performance tracks, and denser CPU samples)
in place of `chromium-renderer.cpuprofile`; traces are large, so keep traced

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: distinguish raw trace data from sanitized network output

Consider adding one sentence that chromium-trace.json is a raw performance trace and should be reviewed before sharing. The preceding redaction promise correctly applies to network.json, but the adjacent description makes the distinction easy to miss. With the actual pinned Playwright producer, a synthetic request query marker remained in the trace; user-timing labels also remain. No trace sanitization or recorder redesign is requested, just a short sharing warning.

@kalvinnchau
kalvinnchau merged commit 2826511 into main Sep 23, 2026
12 checks passed
@kalvinnchau
kalvinnchau deleted the coffee/profile-trace branch September 23, 2026 23:20
zrmarley added a commit that referenced this pull request Sep 24, 2026
…o-player-polish

* origin/main: (38 commits)
  Fix diff content fallback, keyboard scrolling and edit selection (#205)
  Standardize form controls and field feedback across Buzz (#174)
  Keep image review downloads and external opens distinct (#144)
  Verify media review comments (#166)
  Follow system appearance (#210)
  Add rich composer formatting and spoiler rendering (#203)
  feat: show roster-backed channels and managed instances in profiles (#188)
  Add new direct message flow (#156)
  Remove Home, start in Messages, and keep Channels enabled (#194)
  fix: restore avatar presence controls and active-input sensing (#198)
  Add legacy diff messages with inline and expanded viewing (#202)
  Edit the latest own message with Up in the existing composer (#192)
  Add complete reaction toggles to the message menu (#185)
  feat: add persistent community navigation rail (#191)
  test: add margin to warm-switch performance gate (#195)
  Add composer attachments and compatible media preparation (#183)
  Add reply and copying to the shared message menu (#182)
  fix: avoid idle workspace re-renders from activity and label churn (#186)
  feat: add devtools trace capture to web profiling (#180)
  Add optional channel templates, teams and personal group defaults (#181)
  ...

Signed-off-by: Zach Marley <zmarley@squareup.com>
zrmarley added a commit that referenced this pull request Sep 24, 2026
…-content-compat

* origin/main: (38 commits)
  Fix diff content fallback, keyboard scrolling and edit selection (#205)
  Standardize form controls and field feedback across Buzz (#174)
  Keep image review downloads and external opens distinct (#144)
  Verify media review comments (#166)
  Follow system appearance (#210)
  Add rich composer formatting and spoiler rendering (#203)
  feat: show roster-backed channels and managed instances in profiles (#188)
  Add new direct message flow (#156)
  Remove Home, start in Messages, and keep Channels enabled (#194)
  fix: restore avatar presence controls and active-input sensing (#198)
  Add legacy diff messages with inline and expanded viewing (#202)
  Edit the latest own message with Up in the existing composer (#192)
  Add complete reaction toggles to the message menu (#185)
  feat: add persistent community navigation rail (#191)
  test: add margin to warm-switch performance gate (#195)
  Add composer attachments and compatible media preparation (#183)
  Add reply and copying to the shared message menu (#182)
  fix: avoid idle workspace re-renders from activity and label churn (#186)
  feat: add devtools trace capture to web profiling (#180)
  Add optional channel templates, teams and personal group defaults (#181)
  ...

Signed-off-by: Zach Marley <zmarley@squareup.com>

# Conflicts:
#	docs/channels.md
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.

2 participants