-
Notifications
You must be signed in to change notification settings - Fork 826
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
@opentelemetry/instrumentation _onRequire does not receive the actual import name #4437
Comments
if you use node in ESM mode it's needed to specify a loader, see here. But not using this ESM hook in an ESM app is for sure a reason that it can't work. |
Unfortunately, the underlying library that supports it does not appear to quite work |
I added the dependencies label here because this bug appears to be in IITM which we really can't anything about until it is fixed there. |
The IITM bug appears to be fixed by now 💡 |
@gajus there have been some changes to IITM since this issue was opened. Can you confirm whether this is still an issue? |
We abandoned the efforts of adopting opentelemetry for now, so don't have a place to replicate this. |
What happened?
I've been debugging for days why tracing does not work as expected.
I've realized that some auto instrumentations are never actually applied.
After a lot of digging, I've landed on issue being that the module name is never matched in the
_onRequire
function.opentelemetry-js/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts
Lines 173 to 219 in 43e598e
If I add a
console.log
here:The only things printed are:
Meanwhile, in our codebase we import it as:
It appears that the require path gets translated somehow before it can be matched.
This means that
getNodeAutoInstrumentations
never applies the Fastify instrumentation.Interestingly, not all imports are affected...
graphql
✅@grpc/grpc-js
✅but these are the exceptions, most never resolve to the actual module name.
ioredis
is another example:I am able to replicate this with as little code as:
If I update the file
server.cjs
, then it works as expected:Obviously, that's not an option.
The text was updated successfully, but these errors were encountered: