Repository navigation
fix(instrumentations): rewrite ESM source through _compile shim - #11397
pabloerhard wants to merge 1 commit into
Conversation
Overall package sizeSelf size: 9.56 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.5.3 | 131.25 kB | 531.9 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11397 +/- ##
==========================================
+ Coverage 89.61% 99.15% +9.54%
==========================================
Files 1128 1136 +8
Lines 184036 188446 +4410
Branches 86 86
==========================================
+ Hits 164923 186862 +21939
+ Misses 19113 1584 -17529
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 59d0d59 | Docs | View more details | Give us feedback! |
BenchmarksBenchmark execution time: 2026-11-24 00:47:21 Comparing candidate commit 59d0d59 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2475 metrics, 12 unstable metrics.
|
What does this PR do?
With only
-r dd-trace/init, rewrite static ESM dependencies loaded throughrequire()on supported Node.js versions. Install a synchronous load hook only while_compileprocesses the ESM entry point, and remove it infinally. Nestedrequire()calls reuse the hook. If the explicit Datadog loader is already registered, it stays in charge.Motivation
Module._compilesees an ESM entry point reached throughrequire(), but not the files it imports (for example,postgres4’ssrc/pool.js). This is a scoped alternative to #11396: no permanent hook at startup, no handover between hooks, and no change to standaloneimportbehavior.Additional Notes
npm run test:instrumentations:misc: 779 passed on Node 26.12.npm run type:check:cipassed. Full lint flagged a test in the OpenFeature submodule; local EditorConfig validation was blocked because Docker was unavailable.