Skip to content

feat(profiler): AsyncContextFrame used by profiler with Node.js 22+, on by default#7119

Merged
BridgeAR merged 5 commits intomasterfrom
szegedi/profiler-async-context-on-by-default
Dec 17, 2025
Merged

feat(profiler): AsyncContextFrame used by profiler with Node.js 22+, on by default#7119
BridgeAR merged 5 commits intomasterfrom
szegedi/profiler-async-context-on-by-default

Conversation

@szegedi
Copy link
Copy Markdown
Contributor

@szegedi szegedi commented Dec 16, 2025

What does this PR do?

  • Updates pprof-nodejs to 5.13.1, which allows enabling ACF sampling context already with Node.js 22
  • Lowers the requirement to enable ACF sampling context to Node.js 22.9.0.
  • When ACF is available on Linux and macOS, use it by default for profiling sampling context. In practical terms, this means either:
    • Node.js 24+ without explicit --no-async-context-frame command line switch, or
    • Node.js 22.9.0-23.99 with explicit --experimental-async-context-frame command line switch.

Motivation

ACF works well starting with Node.js 22.9.0. Also, it is time we turn it on by default where possible, as it has lower overhead and has been tested for long time internally.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.60%. Comparing base (2a5063a) to head (f6ff369).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
packages/dd-trace/src/profiling/config.js 28.57% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7119      +/-   ##
==========================================
- Coverage   84.78%   84.60%   -0.18%     
==========================================
  Files         521      521              
  Lines       22149    22157       +8     
==========================================
- Hits        18778    18746      -32     
- Misses       3371     3411      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 16, 2025

Overall package size

Self size: 4.35 MB
Deduped: 5.24 MB
No deduping: 5.24 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 1.15.0 | 127.66 kB | 856.24 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@szegedi szegedi force-pushed the szegedi/profiler-async-context-on-by-default branch from 869ee15 to 30f660f Compare December 16, 2025 13:50
@datadog-official
Copy link
Copy Markdown

datadog-official Bot commented Dec 16, 2025

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

❄️ 2 New flaky tests detected

esm with @azure/functions >=4 (4.0.0) propagates amqp messages through an event hub with a cardinality of one from with @azure/functions >=4 (4.0.0) (Datadog) (Fix with Cursor)
Process exited with status code 1.

Error: Process exited with status code 1.
    at ChildProcess.<anonymous> (packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js:349:18)
    at ChildProcess.emit (node:events:524:28)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12)
    at Process.callbackTrampoline (node:internal/async_hooks:130:17)
esm with @azure/functions >=4 (4.0.0) propagates eventdata through an event hub with a cardinality of one from with @azure/functions >=4 (4.0.0) (Datadog) (Fix with Cursor)
Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js)

Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-plugin-azure-functions/test/integration-test/eventhubs-test/eventhubs.spec.js)
    at listOnTimeout (node:internal/timers:581:17)
    at process.processTimers (node:internal/timers:519:7)

ℹ️ Info

🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4e2b086 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@szegedi szegedi marked this pull request as draft December 16, 2025 14:49
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

The linter is unhappy 😅

Comment thread packages/dd-trace/src/profiling/config.js Outdated
@szegedi szegedi force-pushed the szegedi/profiler-async-context-on-by-default branch from 30f660f to 3850f97 Compare December 17, 2025 13:32
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Dec 17, 2025

Benchmarks

Benchmark execution time: 2025-12-17 14:14:50

Comparing candidate commit 4e2b086 in PR branch szegedi/profiler-async-context-on-by-default with baseline commit 2a5063a in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 290 metrics, 30 unstable metrics.

@szegedi szegedi force-pushed the szegedi/profiler-async-context-on-by-default branch from f6ff369 to 3c04c3a Compare December 17, 2025 14:03
@szegedi szegedi force-pushed the szegedi/profiler-async-context-on-by-default branch from 3c04c3a to 4e2b086 Compare December 17, 2025 14:05
@szegedi szegedi marked this pull request as ready for review December 17, 2025 15:04
@szegedi szegedi changed the title feat(profiler): AsyncContextFrame used with Node.js 22+, on by default feat(profiler): AsyncContextFrame used by profiler with Node.js 22+, on by default Dec 17, 2025
@szegedi szegedi requested a review from BridgeAR December 17, 2025 16:03
@BridgeAR BridgeAR merged commit b08f6e9 into master Dec 17, 2025
921 of 924 checks passed
@BridgeAR BridgeAR deleted the szegedi/profiler-async-context-on-by-default branch December 17, 2025 22:22
dd-octo-sts Bot pushed a commit that referenced this pull request Dec 18, 2025
…on by default (#7119)

* Update to pprof 5.13.1

* Profiler can now use AsyncContextFrame starting with Node.js 22.9.0

* Use AsyncContextFrame-based profiling sample context tracking by default, where available.

* Add tests

* Do not use options.useAsyncContextFrame
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Dec 18, 2025
nina9753 pushed a commit that referenced this pull request Jan 15, 2026
…on by default (#7119)

* Update to pprof 5.13.1

* Profiler can now use AsyncContextFrame starting with Node.js 22.9.0

* Use AsyncContextFrame-based profiling sample context tracking by default, where available.

* Add tests

* Do not use options.useAsyncContextFrame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants