Skip to content

fix: add exit handler to profiler - #1221

Merged
BioPhoton merged 28 commits into
mainfrom
feat/utils/profiler-exit-handler
Jan 27, 2026
Merged

fix: add exit handler to profiler#1221
BioPhoton merged 28 commits into
mainfrom
feat/utils/profiler-exit-handler

Conversation

@BioPhoton

@BioPhotonBioPhoton commented Jan 18, 2026

Copy link
Copy Markdown
Collaborator

Related:

Followup:


Note

Introduces a production-ready Node.js profiler with safe shutdown and trace output, and modernizes process-exit utilities.

  • New NodejsProfiler that auto-creates a WriteAheadLogFile, subscribes to process exit/fatal events, supports sharded trace paths, debug transition markers, stats/flush/filePath, and runtime enable/disable; extensive unit/integration tests and snapshots added
  • Exit handling API revamped: installExitHandlers replaced by subscribeProcessExit (returns unsubscribe, idempotent, supports exitOnSignal/exitOnFatal/custom exit codes); tests updated
  • WAL improvements: isLeaderWal/setLeaderWal renamed to isCoordinatorProcess/setCoordinatorProcess; ShardedWal gains coordinator detection via CP_SHARDED_WAL_COORDINATOR_ID; test updates
  • Docs expanded: profiler features, NodeJSProfiler capabilities, exit handlers, configuration; sink mock extended with getPath
  • Test utils added (omit-trace-json, awaitObserverCallbackAndFlush) to normalize trace snapshots

Written by Cursor Bugbot for commit a6da35d. This will update automatically on new commits. Configure here.

@nx-cloud

nx-cloudBot commented Jan 18, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a6da35d

CommandStatusDurationResult
nx run ci:code-pushup -- merge-diffs --files=/h...✅ Succeeded5sView ↗
nx run-many --targets=code-pushup --parallel=fa...✅ Succeeded1m 30sView ↗
nx run-many --targets=code-pushup --parallel=fa...✅ Succeeded12m 54sView ↗

☁️ Nx Cloud last updated this comment at 2026-01-27 21:59:42 UTC

@pkg-pr-new

pkg-pr-newBot commented Jan 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1221

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1221

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1221

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1221

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1221

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1221

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1221

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1221

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1221

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1221

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1221

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1221

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1221

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1221

commit: a6da35d

@github-actions

github-actionsBot commented Jan 18, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 125089c with previous commit e47bf34.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Performance🔴 36🔴 34↓ −2.2
Documentation🟡 53🟡 53↑ +0.5
Code coverage🟢 93🟢 93↑ +0.1
Bug prevention🟡 75🟡 75↓ −0.1
Axe Accessibility🟡 88🟡 88↓ −0.1
Code style🟢 100🟢 100
Security🔴 47🔴 47
Updates🟡 78🟡 78
Type Safety🟡 67🟡 67
Miscellaneous🟡 67🟡 67
Accessibility🟢 92🟢 92
Best Practices🟢 100🟢 100
SEO🟢 92🟢 92
👍 2 groups improved, 👎 1 group regressed, 👍 7 audits improved, 👎 4 audits regressed, 14 audits changed without impacting score

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
LighthousePerformance🔴 36🔴 34↓ −2.2
JSDocs coverageDocumentation coverage🟡 53🟡 53↑ +0.5
Code coverageCode coverage metrics🟢 93🟢 93↑ +0.1

31 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
LighthouseInitial server response time was short🟩 Root document took 480 ms🟥 Root document took 610 ms↑ +25.5 %
LighthouseTotal Blocking Time🟥 1,530 ms🟥 2,400 ms↑ +56.8 %
LighthouseFirst Contentful Paint🟥 3.4 s🟥 3.2 s↓ −6.3 %
LighthouseSpeed Index🟥 7.1 s🟥 7.3 s↑ +3.7 %
JSDocs coverageMethods coverage🟨 11 undocumented methods🟨 10 undocumented methods↓ −9.1 %
JSDocs coverageProperties coverage🟥 38 undocumented properties🟥 42 undocumented properties↑ +10.5 %
JSDocs coverageVariables coverage🟥 273 undocumented variables🟥 273 undocumented variables +0 %
JSDocs coverageFunctions coverage🟥 582 undocumented functions🟥 581 undocumented functions↓ −0.2 %
Code coverageFunction coverage🟩 94.3 %🟩 94.3 %↑ +0.1 %
Code coverageLine coverage🟩 92.7 %🟩 92.7 %↑ +0.1 %
Code coverageBranch coverage🟨 89.2 %🟨 89.2 %↑ +0.1 %
LighthouseAvoids enormous network payloads🟩 Total size was 2,096 KiB🟩 Total size was 2,095 KiB↓ −0.1 %
LighthouseMinimizes main-thread work🟥 10.2 s🟥 9.5 s↓ −7.2 %
LighthouseServer Backend Latencies🟩 1,340 ms🟩 690 ms↓ −49 %
LighthouseTime to Interactive🟥 13.4 s🟥 13.6 s↑ +1.7 %
LighthouseMetrics🟩 100%🟩 100%↑ +1.7 %
LighthouseReduce unused CSS🟥 Potential savings of 125 KiB🟥 Potential savings of 125 KiB↑ +42.6 %
LighthouseLargest Contentful Paint🟥 11.9 s🟥 11.7 s↓ −1.5 %
LighthouseJavaScript execution time🟥 4.3 s🟥 4.1 s↓ −4 %
LighthouseUses efficient cache policy on static assets🟨 31 resources found🟨 31 resources found↑ +0.1 %
LighthouseRemove duplicate modules in JavaScript bundles🟥 Potential savings of 88 KiB🟥 Potential savings of 87 KiB↓ −29.8 %
LighthouseMax Potential First Input Delay🟥 1,050 ms🟥 1,160 ms↑ +10.6 %
LighthouseReduce unused JavaScript🟥 Potential savings of 226 KiB🟥 Potential savings of 228 KiB↑ +6.4 %
LighthouseNetwork Round Trip Times🟩 60 ms🟩 50 ms↓ −16.4 %
TypeScriptSemantic errors🟥 36 errors🟥 37 errors↑ +2.8 %

654 other audits are unchanged.

# Conflicts:
#	packages/utils/src/lib/exit-process.int.test.ts
#	packages/utils/src/lib/exit-process.unit.test.ts
#	packages/utils/src/lib/profiler/profiler.unit.test.ts
@BioPhoton
BioPhoton marked this pull request as ready for review January 27, 2026 00:30

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON, but it could not run because Privacy Mode (Legacy) is turned on. To enable Bugbot Autofix, switch your privacy mode in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on February 26

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@code-pushupcode-pushup deleted a comment from cursorBotJan 27, 2026
# Conflicts:
#	packages/utils/docs/profiler.md
#	packages/utils/src/lib/profiler/constants.ts
#	packages/utils/src/lib/profiler/profiler.ts
#	packages/utils/src/lib/profiler/profiler.unit.test.ts
Comment threadpackages/utils/src/lib/wal.ts Outdated
Comment threadpackages/utils/src/lib/profiler/profiler-node.ts Outdated
Comment threadpackages/utils/src/lib/profiler/profiler-node.ts Outdated
Comment threadpackages/utils/src/lib/profiler/profiler-node.ts
Comment threadpackages/utils/src/lib/wal.ts
@github-actions

github-actionsBot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 125089c with previous commit e47bf34.

💼 Project utils

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Documentation🟡 60🟡 61↑ +0.7
Code coverage🟢 95🟢 95↑ +0.1

4 other categories are unchanged.

👍 2 groups improved, 👍 5 audits improved, 👎 2 audits regressed

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
JSDocs coverageDocumentation coverage🟡 60🟡 61↑ +0.7
Code coverageCode coverage metrics🟢 95🟢 95↑ +0.1

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
JSDocs coverageMethods coverage🟨 11 undocumented methods🟨 10 undocumented methods↓ −9.1 %
JSDocs coverageProperties coverage🟥 35 undocumented properties🟥 39 undocumented properties↑ +11.4 %
JSDocs coverageVariables coverage🟥 50 undocumented variables🟥 50 undocumented variables +0 %
JSDocs coverageFunctions coverage🟥 244 undocumented functions🟥 243 undocumented functions↓ −0.4 %
Code coverageBranch coverage🟩 92 %🟩 91.9 %↓ −0.2 %
Code coverageFunction coverage🟩 95.9 %🟩 96 %↑ +0.1 %
Code coverageLine coverage🟩 97.9 %🟩 98 %↑ +0.1 %

437 other audits are unchanged.


13 other projects are unchanged.

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON, but it could not run because Privacy Mode (Legacy) is turned on. To enable Bugbot Autofix, switch your privacy mode in the Cursor dashboard.

Comment threadpackages/utils/src/lib/wal.ts Outdated
Comment threadpackages/utils/docs/profiler.md Outdated
Comment threadpackages/utils/src/lib/wal.unit.test.ts Outdated
Comment threadpackages/utils/src/lib/profiler/constants.ts
Comment threadpackages/utils/src/lib/wal.ts
Comment threadpackages/utils/src/lib/profiler/profiler-node.ts Outdated
Comment threadpackages/utils/src/lib/exit-process.int.test.ts Outdated
Comment threadpackages/utils/src/lib/exit-process.unit.test.ts Outdated
Comment threadpackages/utils/src/lib/wal.unit.test.ts Outdated
Comment threadpackages/utils/src/lib/wal.ts
BioPhotonand others added 8 commits January 27, 2026 20:27
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
@BioPhoton
BioPhoton enabled auto-merge (squash) January 27, 2026 19:47
@BioPhoton
BioPhoton merged commit 00b97a2 into mainJan 27, 2026
27 of 28 checks passed
@BioPhoton
BioPhoton deleted the feat/utils/profiler-exit-handler branch January 27, 2026 23:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 Project documentationimprovements or additions to the project documentation🔬 testingwriting tests🧩 utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@BioPhoton@hanna-skryl