Visitar URL original
feat: capture Node.js trace categories via Perfetto by deepak1556 · Pull Request #50591 · electron/electron · GitHub
Skip to content

feat: capture Node.js trace categories via Perfetto - #50591

Merged
jkleinsc merged 4 commits into
mainfrom
robo/enable_node_perfetto
Apr 10, 2026
Merged

jkleinsc merged 4 commits into
mainfrom
robo/enable_node_perfetto

Conversation

@deepak1556

@deepak1556 deepak1556 commented Mar 31, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Chromium migrated from its legacy tracing system to Perfetto. Node.js trace events were silently dropped because they relied on APIs that no longer function under Perfetto (pointer-based category checks, comma-separated category strings, phase-limited SDK macros).

Chromium:

Register node as a dynamic category prefix in PERFETTO_DEFINE_TEST_CATEGORY_PREFIXES. This lets Perfetto treat any node.* category string as a valid category.

V8:

Replace phase-specific Perfetto SDK macros with INTERNAL_TRACE_EVENT_ADD legacy shim macros, which accept arbitrary phase characters. This restores support for nestable async (b/e), counter (C), and other phases used by Node.js.

Node.js:

  • When compiled inside Chromium, static registration is skipped in favor of the dynamic prefix approach. Replace all TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED pointer checks with TRACE_EVENT_CATEGORY_ENABLED, the old API does a static registry lookup that fails for dynamic categories.

  • Change TRACING_CATEGORY_NODE macros from comma-separated "node,node.fs.sync" to single strings "node.fs.sync".

  • Add trace events for performance.mark and performance.measure based on blink.user_timing implementation.

Release Notes

Notes: Fixed contentTracing module to capture Node.js trace categories.

@deepak1556 deepak1556 added the semver/minor backwards-compatible functionality label Mar 31, 2026
@deepak1556
deepak1556 requested a review from a team as a code owner March 31, 2026 00:50
@deepak1556 deepak1556 added target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 31, 2026
@deepak1556

deepak1556 commented Mar 31, 2026 •

Copy link
Copy Markdown
Member Author

I will see if a variation of the V8 patch can be upstreamed, the Node.js patch should reduce when they adopt Perfetto nodejs/diagnostics#654

@deepak1556

Copy link
Copy Markdown
Member Author
Screenshot 2026-03-31 at 10 05 32

@deepak1556
deepak1556 marked this pull request as draft March 31, 2026 05:59
@deepak1556

deepak1556 commented Mar 31, 2026 •

Copy link
Copy Markdown
Member Author

I will see if a variation of the V8 patch can be upstreamed

Started discussion in https://issues.chromium.org/issues/457135433#comment5, but any changes will be a followup

@deepak1556
deepak1556 marked this pull request as ready for review March 31, 2026 13:51
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Apr 7, 2026

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API LGTM

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@deepak1556 can you rebase and update the patches?

@deepak1556
deepak1556 force-pushed the robo/enable_node_perfetto branch from 19e9f98 to 22c8b7c Compare April 9, 2026 04:16
@deepak1556
deepak1556 requested a review from jkleinsc April 9, 2026 04:17

@erickzhao erickzhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API LGTM

stamping, no public API surface changes

@deepak1556
deepak1556 enabled auto-merge (squash) April 10, 2026 06:51
@deepak1556
deepak1556 disabled auto-merge April 10, 2026 07:02
ckerr added a commit that referenced this pull request Aug 5, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit that referenced this pull request Aug 5, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit that referenced this pull request Aug 7, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit that referenced this pull request Aug 7, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
@trop

trop Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@VerteDinde has manually backported this PR to "42-x-y", please check out #52973

MarshallOfSound pushed a commit that referenced this pull request Aug 19, 2026
feat: capture Node.js trace categories via Perfetto (#50591)

* feat: capture Node.js trace categories via Perfetto

* fix: crash in ELECTRON_RUN_AS_NODE

* chore: cleanup macro usage

* chore: update patches

Backport notes: patches/node regenerated against this branch's Node (v24.18.1); build_enable_perfetto.patch content is identical to the original change, the other node patch updates are index/offset only.

(cherry picked from commit c0f187f)

Co-authored-by: Robo <hop2deep@gmail.com>
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels Aug 19, 2026
jkleinsc pushed a commit that referenced this pull request Aug 20, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 20, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 24, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 24, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 24, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 24, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 24, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 24, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 25, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 25, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 25, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 25, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 25, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 25, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
deepak1556 pushed a commit that referenced this pull request Aug 26, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
deepak1556 pushed a commit that referenced this pull request Aug 26, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 26, 2026
Ref: #50591

Co-Authored-By: GitHub Copilot <copilot@github.com>
jkleinsc pushed a commit that referenced this pull request Aug 26, 2026
Electron builds Node exclusively with Perfetto since #50591. Wire the upstream Perfetto agent directly and drop the legacy header split and dual-backend source lists.

Ref: #50591

Ref: nodejs/node#64565

Co-Authored-By: GitHub Copilot <copilot@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/approved ✅ merged/42-x-y PR was merged to the "42-x-y" branch. semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants