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

Does not seem to work in ESM context #541

Open
danielberndt opened this issue Feb 3, 2022 · 1 comment
Open

Does not seem to work in ESM context #541

danielberndt opened this issue Feb 3, 2022 · 1 comment
Labels
type: enhancement New feature or request

Comments

@danielberndt
Copy link

danielberndt commented Feb 3, 2022

I didn't dig super deep into it, but after upgrading our fastify-based api server to ESM, this library stopped auto instrumentalizing all relevant services (fastify, http, https).

Is the instrumentalization architecture compatible with ESM?

Looking a bit into the code require.main does not seem to exist in ESM:

let resolvedPath = require.resolve(m, { paths: require.main.paths });

TypeError: Cannot read properties of undefined (reading 'paths')

Having enabledInstrumentations: ["http", "https", "fastify"], in the setup config does not seem to have an effect either.

So I'm not 100% sure how ESM-compatible this library is.

@danielberndt danielberndt added the type: bug Something isn't working label Feb 3, 2022
@vreynolds
Copy link
Contributor

Require in the middle magic is not compatible with ESM 😢 At this point, ESM support is most likely to come in OpenTelemetry (there's an ongoing effort).

This means we don't have a good answer for folks at this point in time. I expect we will see more people upgrade to modules as support matures across frameworks, so this is something we'll need to have an answer for soon.

@vreynolds vreynolds added type: enhancement New feature or request and removed type: bug Something isn't working labels Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants