Skip to content

diagnostics_channel: add threadpool work event - #65982

Open
IlyasShabi wants to merge 1 commit into
nodejs:mainfrom
IlyasShabi:ishabi/threadpool-dc
Open

diagnostics_channel: add threadpool work event#65982
IlyasShabi wants to merge 1 commit into
nodejs:mainfrom
IlyasShabi:ishabi/threadpool-dc

Conversation

@IlyasShabi

Copy link
Copy Markdown
Member

This PR aims to add support for experimental threadpool.work diagnostics channel.

The event exposes:

  • type: kind of threadpool work
  • enqueued: submission timestamp
  • started: execution start timestamp
  • ended: execution end timestamp

These timestamps allow diagnostics tools to distinguish queue time from native execution time. Cancelled work reports started and ended as null.

The channel and subscriber state are cached per Environment so the unsubscribed path remains minimal.

Benchmark

Unsubscribed configurations showed no significant regressions. Most subscribed configurations were also within noise; zlib at n=10000 measured a 3.48% regression on local machine (will share the onces from CI)

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Sep 11, 2026
Signed-off-by: ishabi <ilyasshabi94@gmail.com>

@mcollina mcollina 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.

while this is a good generic API, I'm not convinced. Shouldn't we add one for each usage?

cc @bengl @Qard ?

@IlyasShabi

Copy link
Copy Markdown
Member Author

@mcollina You mean separate channels named threadpool.work.<type>? This is also a valid approach and would let consumers subscribe only to relevant work and remove type from the payload.

@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.70968% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.19%. Comparing base (b3fb344) to head (946f372).
⚠️ Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
src/threadpoolwork-inl.h 88.57% 0 Missing and 4 partials ⚠️
src/env.cc 81.25% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65982      +/-   ##
==========================================
+ Coverage   90.16%   90.19%   +0.02%     
==========================================
  Files         771      771              
  Lines      265434   265513      +79     
  Branches    50450    50478      +28     
==========================================
+ Hits       239332   239468     +136     
+ Misses      17045    17003      -42     
+ Partials     9057     9042      -15     
Files with missing lines Coverage Δ
src/env.h 97.36% <100.00%> (+0.14%) ⬆️
src/node_diagnostics_channel.cc 86.66% <100.00%> (+3.01%) ⬆️
src/node_diagnostics_channel.h 100.00% <100.00%> (+42.85%) ⬆️
src/node_internals.h 81.66% <100.00%> (+1.30%) ⬆️
src/env.cc 82.15% <81.25%> (+0.05%) ⬆️
src/threadpoolwork-inl.h 91.22% <88.57%> (-4.23%) ⬇️

... and 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants