Skip to content

diagnostics_channel: add threadpool work event - #65982

Merged
nodejs-github-bot merged 4 commits into
nodejs:mainfrom
IlyasShabi:ishabi/threadpool-dc
Nov 17, 2026
Merged

nodejs-github-bot merged 4 commits into
nodejs:mainfrom
IlyasShabi:ishabi/threadpool-dc

Conversation

@IlyasShabi

@IlyasShabi IlyasShabi commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

This PR aims to add support for experimental threadpool.work.<type> diagnostics channel.
type: kind of threadpool work

The event exposes:

  • 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

@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.60759% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.68%. Comparing base (d3c4048) to head (0e550b7).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
src/threadpoolwork-inl.h 82.85% 0 Missing and 6 partials ⚠️
src/env.cc 84.21% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65982      +/-   ##
==========================================
+ Coverage   90.66%   90.68%   +0.02%     
==========================================
  Files         799      799              
  Lines      280252   280319      +67     
  Branches    54121    54136      +15     
==========================================
+ Hits       254088   254215     +127     
+ Misses      16285    16218      -67     
- Partials     9879     9886       +7     
Files with missing lines Coverage Δ
src/crypto/crypto_util.h 68.53% <100.00%> (ø)
src/env.h 98.76% <100.00%> (+0.06%) ⬆️
src/glob/node_glob.cc 75.45% <100.00%> (ø)
src/histogram.cc 86.63% <100.00%> (+0.39%) ⬆️
src/node_api.cc 77.10% <100.00%> (ø)
src/node_diagnostics_channel.cc 86.63% <100.00%> (+2.44%) ⬆️
src/node_diagnostics_channel.h 100.00% <100.00%> (+28.57%) ⬆️
src/node_file.cc 75.97% <100.00%> (+0.02%) ⬆️
src/node_internals.h 82.25% <100.00%> (+1.90%) ⬆️
src/node_sqlite.cc 82.74% <100.00%> (ø)
... and 3 more

... and 30 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.

@mcollina

Copy link
Copy Markdown
Member

yes

@mcollina

Copy link
Copy Markdown
Member

I think you are missing the documentation

@IlyasShabi

Copy link
Copy Markdown
Member Author

@IlyasShabi
IlyasShabi requested a review from mcollina September 14, 2026 13:05
@IlyasShabi

Copy link
Copy Markdown
Member Author

@mcollina could you please have a look?

@IlyasShabi
IlyasShabi requested review from Qard and bengl September 16, 2026 15:21
@IlyasShabi
IlyasShabi force-pushed the ishabi/threadpool-dc branch from ff193a0 to a1c60b9 Compare October 6, 2026 09:26
Comment thread doc/api/diagnostics_channel.md Resolved
@IlyasShabi
IlyasShabi force-pushed the ishabi/threadpool-dc branch from a1c60b9 to 8b8372f Compare October 9, 2026 08:54
@IlyasShabi
IlyasShabi requested a review from bengl October 9, 2026 09:28
@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 13, 2026
@IlyasShabi

Copy link
Copy Markdown
Member Author

@mcollina could you please check?

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

lgtm

@mcollina mcollina added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 4, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 4, 2026
@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 4, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 4, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 16, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 16, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@IlyasShabi IlyasShabi added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. commit-queue-squash PRs the Commit Queue should land as one squashed commit. commit-queue PRs queued for automated landing through the Commit Queue. and removed commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. labels Nov 17, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 6a536f9 into nodejs:main Nov 17, 2026
76 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 6a536f9

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 17, 2026
@IlyasShabi
IlyasShabi deleted the ishabi/threadpool-dc branch November 17, 2026 09:01
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
Signed-off-by: ishabi <ilyasshabi94@gmail.com>
PR-URL: #65982
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash PRs the Commit Queue should land as one squashed commit. 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.

5 participants