@opentelemetry/instrumentation _onRequire does not receive the actual import name #4437
Labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
priority:p2
Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
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: