Skip to content

feat(node): Allow to pass registerEsmLoaderHooks to preload #12998

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

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Jul 22, 2024

As mentioned in here: #12912 (comment) there is no way today to exclude/include esm modules when preloading today.

This PR adds the option to pass registerEsmLoaderHooks as option to preloadOpenTelemetry, which allows to exclude/include packages there as well. Users can then write their own custom preload script and configure this there, if wanted.

Naming

I chose to use the same option naming here than for init, although the semantics are a bit different - here we can't actually disable the wrapping (because that's the only reason to even call this). We can also use a different name if we want, but I thought this would maybe be easier to understand that this is the same thing 🤔

@mydea mydea requested review from timfish and AbhiPrasad July 22, 2024 08:27
@mydea mydea self-assigned this Jul 22, 2024
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

LGTM and agree on keeping the name aligned with the init option.

Users can then write their own custom preload script and configure this there, if wanted.

Sounds fair, given this won't be a widely used option. We should just make sure to document this because right now, we only show how to set integrations and debug via env variables.

@mydea mydea merged commit 81e20c3 into develop Jul 22, 2024
106 checks passed
@mydea mydea deleted the fn/otel-preload branch July 22, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants