Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrument modules loaded via process.getBuiltinModule? #4742

Closed
timfish opened this issue May 30, 2024 · 3 comments
Closed

Instrument modules loaded via process.getBuiltinModule? #4742

timfish opened this issue May 30, 2024 · 3 comments

Comments

@timfish
Copy link
Contributor

timfish commented May 30, 2024

Node has added process.getBuiltinModule(id) to allow synchronous loading of built-in modules:
nodejs/node#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.

Copy link

github-actions bot commented Aug 5, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Aug 5, 2024
@timfish
Copy link
Contributor Author

timfish commented Aug 14, 2024

Looks like this was added to require-in-the-middle a few weeks ago:
elastic/require-in-the-middle#92

So we just need to update to v7.4.0 and this can be closed?

@timfish
Copy link
Contributor Author

timfish commented Aug 14, 2024

Ok so we're using a caret for the require-in-the-middle version so if users update their dependencies they will get the latest version.

@timfish timfish closed this as completed Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant