Skip to content

Conversation

@joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented Jan 17, 2026

This adds a trackPromises option that allows users to completely opt out of the promise hooks that are installed whenever an async hook is added. For those who do not need to track promises, this avoids the excessive hook invocation and the heavy overhead from it.

This option was previously already implemented internally to skip the noise from promise hooks when debugging async operations via the V8 inspector. This patch just exposes it.

Refs: #57148

@nodejs-github-bot nodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. needs-ci PRs that need a full CI run. labels Jan 17, 2026
This adds a trackPromises option that allows users to completely opt
out of the promise hooks that are installed whenever an async hook is
added. For those who do not need to track promises, this avoids
the excessive hook invocation and the heavy overhead from it.

This option was previously already implemented internally to skip the
noise from promise hooks when debugging async operations via the
V8 inspector. This patch just exposes it.
@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (1bd7f62) to head (57550f3).
⚠️ Report is 63 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #61415    +/-   ##
========================================
  Coverage   88.51%   88.52%            
========================================
  Files         704      704            
  Lines      208739   208897   +158     
  Branches    40274    40339    +65     
========================================
+ Hits       184770   184917   +147     
- Misses      15968    15969     +1     
- Partials     8001     8011    +10     
Files with missing lines Coverage Δ
lib/async_hooks.js 100.00% <100.00%> (ø)
lib/internal/inspector_async_hook.js 100.00% <100.00%> (ø)

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

@Flarna Flarna added the semver-minor PRs that contain new features and should be released in the next minor version. label Jan 18, 2026
will not have the `before` and `after` callbacks fired on them. For more details
see the details of the V8 [PromiseHooks][] API.
### Disabling promise execution tracking
Copy link
Member

Choose a reason for hiding this comment

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

FWIW promise tracking might still be enabled because some other async_hooks instance is using it (e.g. domain, ALS in older node.js versions or if --no-async-context-frame is set).

not sure if it is worth to mention this somewhere here.

Copy link
Member Author

@joyeecheung joyeecheung Jan 19, 2026

Choose a reason for hiding this comment

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

This is an option and the default (tracking it by default) has not been changed - even when it is changed, the internal call sites can just specify it to be true explicitly, so I think it probably doesn't need documentation changes.

@joyeecheung joyeecheung added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jan 19, 2026
@Flarna Flarna added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooks Issues and PRs related to the async hooks subsystem. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants