Skip to content

feat(utils): add NodeJS profiler - #1219

Merged
BioPhoton merged 39 commits into
mainfrom
feat/utils/profiler-perf-buffer
Jan 27, 2026
Merged

feat(utils): add NodeJS profiler#1219
BioPhoton merged 39 commits into
mainfrom
feat/utils/profiler-perf-buffer

Conversation

@BioPhoton

@BioPhotonBioPhoton commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

Related: #1197

This PR includes:

  • adding NodeJSProfiler class
  • implemented performanceObserver for NodeJSProfiler
  • revamp PerformanceObserverSink - add getStatus for better testing, more robust and memory friendly buffer logic

Followup PRs:


Note

Introduces a Node.js runtime profiler with buffered write-ahead logging and a redesigned performance observer.

  • Adds NodejsProfiler (extends Profiler) with WAL sink integration, runtime enable/disable, state transitions, flush() and stats access; supports debug transition markers via CP_PROFILER_DEBUG
  • Replaces PerformanceObserverSink internals with bounded queue, proactive flushing (flushThreshold), maxQueueSize, encode-failure debug marks, and getStats(); validates configuration and handles sink errors gracefully
  • Expands WAL AppendableSink contract to include isClosed, optional open/close, and recovery APIs; updates mocks to MockAppendableSink/MockTraceEventFileSink
  • Adds comprehensive unit/integration tests and new profiler.md docs covering configuration, API, and Node.js usage
  • Minor: default exitOnFatal/exitOnSignal set to false in exit handlers

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

- Add explanation that sink determines output format (DevTools TraceEvent, OpenTelemetry, etc.)
- Improve documentation clarity for flexible serialization capabilities
- Fix duplicate imports in profiler unit test
- Replace method implementations with vi.fn() spy functions
- Add vi import from vitest
- Enables better testing with call tracking and assertions
@github-actionsgithub-actionsBot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🧩 utils labels Jan 16, 2026
@nx-cloud

nx-cloudBot commented Jan 16, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit ae5b099

CommandStatusDurationResult
nx affected -t int-test --parallel=3✅ Succeeded1m 31sView ↗

☁️ Nx Cloud last updated this comment at 2026-01-27 14:49:02 UTC

@pkg-pr-new

pkg-pr-newBot commented Jan 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@code-pushup/ci

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

@code-pushup/cli

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

@code-pushup/core

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

@code-pushup/create-cli

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

@code-pushup/models

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

@code-pushup/nx-plugin

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

@code-pushup/axe-plugin

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

@code-pushup/coverage-plugin

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

@code-pushup/eslint-plugin

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

@code-pushup/js-packages-plugin

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

@code-pushup/jsdocs-plugin

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

@code-pushup/lighthouse-plugin

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

@code-pushup/typescript-plugin

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

@code-pushup/utils

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

commit: ae5b099

@github-actions

github-actionsBot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 61ecb4f with previous commit e677d4f.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Documentation🔴 46🟡 53↑ +6.7
Performance🔴 36🔴 34↓ −2.2
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
👍 1 group improved, 👎 2 groups regressed, 👍 7 audits improved, 👎 7 audits regressed, 13 audits changed without impacting score

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
JSDocs coverageDocumentation coverage🔴 46🟡 53↑ +6.7
LighthousePerformance🔴 36🔴 34↓ −2.2
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 490 ms🟥 Root document took 630 ms↑ +28.9 %
JSDocs coverageProperties coverage🟥 41 undocumented properties🟥 38 undocumented properties↓ −7.3 %
JSDocs coverageMethods coverage🟨 15 undocumented methods🟨 11 undocumented methods↓ −26.7 %
JSDocs coverageClasses coverage🟨 6 undocumented classes🟨 5 undocumented classes↓ −16.7 %
LighthouseSpeed Index🟥 6.8 s🟥 7.8 s↑ +14.6 %
LighthouseFirst Contentful Paint🟥 3.1 s🟥 3.2 s↑ +5.3 %
LighthouseTime to Interactive🟥 13.3 s🟥 14.1 s↑ +6 %
LighthouseTotal Blocking Time🟥 1,810 ms🟥 2,010 ms↑ +11.6 %
JSDocs coverageVariables coverage🟥 280 undocumented variables🟥 273 undocumented variables↓ −2.5 %
JSDocs coverageTypes coverage🟥 262 undocumented types🟥 261 undocumented types↓ −0.4 %
JSDocs coverageFunctions coverage🟥 582 undocumented functions🟥 582 undocumented functions +0 %
Code coverageLine coverage🟩 92.6 %🟩 92.7 %↑ +0.1 %
Code coverageBranch coverage🟨 89.2 %🟨 89.2 %↓ −0.1 %
Code coverageFunction coverage🟩 94.3 %🟩 94.3 %↓ −0.1 %
LighthouseAvoids enormous network payloads🟩 Total size was 2,091 KiB🟩 Total size was 2,087 KiB↓ −0.2 %
LighthouseMetrics🟩 100%🟩 100%↑ +6 %
LighthouseMinimizes main-thread work🟥 12.1 s🟥 11.4 s↓ −6 %
LighthouseUses efficient cache policy on static assets🟨 31 resources found🟨 31 resources found↓ −0.1 %
LighthouseServer Backend Latencies🟩 660 ms🟩 290 ms↓ −56 %
LighthouseLargest Contentful Paint🟥 11.8 s🟥 11.4 s↓ −3 %
LighthouseJavaScript execution time🟥 4.9 s🟥 4.6 s↓ −5.6 %
LighthouseMax Potential First Input Delay🟥 1,300 ms🟥 1,150 ms↓ −11.8 %
LighthouseReduce unused JavaScript🟥 Potential savings of 226 KiB🟥 Potential savings of 226 KiB↑ +6.6 %
LighthouseReduce unused CSS🟥 Potential savings of 125 KiB🟥 Potential savings of 125 KiB↑ +8.3 %
LighthouseNetwork Round Trip Times🟩 0 ms🟩 50 ms↑ +2020.8 %
LighthouseRemove duplicate modules in JavaScript bundles🟥 Potential savings of 85 KiB🟥 Potential savings of 88 KiB↑ +6.7 %
TypeScriptSemantic errors🟥 25 errors🟥 36 errors↑ +44 %

652 other audits are unchanged.

@BioPhoton
BioPhoton marked this pull request as ready for review January 16, 2026 22:22
@github-actions

github-actionsBot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 61ecb4f with previous commit e677d4f.

💼 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🟡 51🟡 60↑ +8.6
Code coverage🟢 95🟢 95↓ −0.1

4 other categories are unchanged.

👍 1 group improved, 👎 1 group regressed, 👍 7 audits improved, 👎 2 audits regressed

🗃️ Groups

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

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
JSDocs coverageProperties coverage🟥 38 undocumented properties🟥 35 undocumented properties↓ −7.9 %
JSDocs coverageMethods coverage🟨 15 undocumented methods🟨 11 undocumented methods↓ −26.7 %
JSDocs coverageClasses coverage🟨 3 undocumented classes🟨 2 undocumented classes↓ −33.3 %
JSDocs coverageVariables coverage🟥 57 undocumented variables🟥 50 undocumented variables↓ −12.3 %
JSDocs coverageTypes coverage🟨 56 undocumented types🟨 55 undocumented types↓ −1.8 %
JSDocs coverageFunctions coverage🟥 244 undocumented functions🟥 244 undocumented functions +0 %
Code coverageBranch coverage🟩 92.2 %🟩 92 %↓ −0.2 %
Code coverageFunction coverage🟩 96 %🟩 95.9 %↓ −0.1 %
Code coverageLine coverage🟩 97.9 %🟩 97.9 %↑ +0.1 %

435 other audits are unchanged.


13 other projects are unchanged.

Comment threadpackages/utils/docs/profiler.md Outdated
Comment threadpackages/utils/src/lib/profiler/profiler.int.test.ts Outdated
Comment threadpackages/utils/docs/profiler.md Outdated
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Comment threadpackages/utils/docs/profiler.md Outdated
Comment threadpackages/utils/docs/profiler.md Outdated
# Conflicts:
#	packages/utils/src/lib/profiler/profiler.int.test.ts
#	packages/utils/src/lib/profiler/profiler.unit.test.ts
Comment threadpackages/utils/src/lib/profiler/profiler.int.test.ts Outdated
Comment threadpackages/utils/mocks/sink.mock.ts Outdated
Comment threadpackages/utils/src/lib/performance-observer.ts Outdated
Comment threadpackages/utils/src/lib/profiler/profiler.ts
Comment threadpackages/utils/src/lib/performance-observer.ts
Comment threadpackages/utils/src/lib/performance-observer.ts
BioPhotonand others added 4 commits January 27, 2026 00:22
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>
# Conflicts:
#	packages/utils/mocks/sink.mock.ts
#	packages/utils/src/lib/performance-observer.int.test.ts
#	packages/utils/src/lib/performance-observer.ts
#	packages/utils/src/lib/performance-observer.unit.test.ts
#	packages/utils/src/lib/profiler/constants.ts
#	packages/utils/src/lib/profiler/profiler.ts
#	packages/utils/src/lib/profiler/profiler.unit.test.ts
#	packages/utils/src/lib/sink-source.type.ts
Comment threadpackages/utils/src/lib/profiler/profiler.ts Outdated
Comment threadpackages/utils/src/lib/profiler/profiler.ts Outdated
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
@cursor

cursorBot commented Jan 27, 2026

Copy link
Copy Markdown

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 26.

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

Comment threadpackages/utils/src/lib/profiler/profiler.ts Outdated
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
@BioPhoton
BioPhoton enabled auto-merge (squash) January 27, 2026 14:34
@BioPhoton
BioPhoton merged commit ea196f9 into mainJan 27, 2026
35 of 36 checks passed
@BioPhoton
BioPhoton deleted the feat/utils/profiler-perf-buffer branch January 27, 2026 14:49
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