docs(instrumentation): register ESM hooks via module.register() with --import - #7034
docs(instrumentation): register ESM hooks via module.register() with --import#7034The-Alchemist wants to merge 2 commits into
Conversation
|
Welcome, contributor! Thank you for your contribution to opentelemetry-js. Important reminders:
|
…--import --import of hook.mjs does not install loader hooks, so ESM instrumentation is silently skipped. Document a register() preload and add a child-process test covering loader, bare --import, and module.register() startup. Signed-off-by: Karl Pietrzak <karl@medplum.com>
d46c055 to
c6b09d7
Compare
Pull request dashboard statusWaiting on reviewers · refreshed 2026-09-03 20:21 UTC Review the latest changes. Status above doesn't look right?
|
Signed-off-by: Karl Pietrzak <karl@medplum.com>
Summary
follow up from ESM support documentation update: use --import for Node v24 #6909
--import @opentelemetry/instrumentation/hook.mjsdoes not register exported loader hooks, so ESM instrumentation is silently skipped.Document a user-owned
register-otel-hook.mjspreload that callsmodule.register('@opentelemetry/instrumentation/hook.mjs', import.meta.url)and use that with--importon Node 24+.Add a child-process integration test covering
--experimental-loader(patched), bare--import hook.mjs(unpatched), and--importof themodule.register()preload (patched).We verify's @JacksonWeber concern that
--importofhook.mjsmay silently disable ESM instrumentation.Test plan
npx mocha test/node/HookCliRegistration.test.tsin@opentelemetry/instrumentationnpm testin@opentelemetry/instrumentationnpm run lintin@opentelemetry/instrumentation