opentelemetry-js
opentelemetry-js copied to clipboard
Instrument modules loaded via `process.getBuiltinModule`?
Node has added process.getBuiltinModule(id)
to allow synchronous loading of built-in modules:
https://github.com/nodejs/node/pull/52762
The idea is that library authors will now more easily be able to create cross runtime libraries that can conditionally load Node APIs only when running in Node:
if (globalThis.process?.getBuiltinModule) {
// Running in Node.js, use the Node.js fs module.
const fs = globalThis.process.getBuiltinModule('fs');
}
OpenTelemetry instruments modules via require-in-the-middle
and import-in-the-middle
but built-in modules loaded via this new API will not be instrumented as it doesn't go through require
.