-
Notifications
You must be signed in to change notification settings - Fork 539
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
instrumentation-fastify fails to initialise if "type" is set to "module" in package.json #1519
Comments
support for instrumenting ESM was recently merged (see open-telemetry/opentelemetry-js#3698) but it's not yet in a release. Please retest once a new release is out. |
New release is out. Can you please confirm if this is fixed? |
Closing this as it should work as of the latest release. |
This appears to still be a problem. We converted the Fastify example to ESM and see the HTTP modules being patched, but not fastify. nlindley/opentelemetry-js-contrib@main...fastify-esm |
Downgrading |
A working version can be seen here: nlindley/opentelemetry-js-contrib@main...fastify-esm-working |
We have some more details and some minimal reproductions for the Fastify instrumentation. When using the default import, the instrumentation crashes the app when a new instance is created by invoking When using the named import, the instrumentation does not crash, but the library is not wrapped and no spans are created. https://github.com/nlindley/otel-esm-examples/tree/master/fastify-named |
FYI I opened a PR to fix this issue: #1624 This may be relevant for other instrumentations as well, you cannot depend on |
This seems to still be an issue when using the named Using the latest version of the Fastify instrumentation, I see that the default export is successfully patched, but the named export does not seem to patch beyond the constructor. It appears that the library is not fully wrapped and no spans are created through the Fastify instrumentation. Given how Fastify provides its constructor through the default export (a function with an applied Here is an updated minimal reproduction demonstrating the default export successfully patching: and another reproduction demonstrating that the named export does not fully patch: |
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. |
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. |
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. |
This is still an issue. |
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. |
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. |
This issue was closed because it has been stale for 14 days with no activity. |
What version of OpenTelemetry are you using?
Latest versions available:
What version of Node are you using?
v18.16.0
What did you do?
Tried to use
@opentelemetry/instrumentation-fastify
on a new project did not understand why the instrumentation did not work.What did you expect to see?
@opentelemetry/instrumentation-fastify Applying patch for [email protected]
What did you see instead?
nothing
Additional context
instrumentation-http works in both modes:
The text was updated successfully, but these errors were encountered: