-
Notifications
You must be signed in to change notification settings - Fork 457
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
bug: mongodb instrumentation breaks for node v14 #1759
Comments
I was wondering why the TAV passed I think it's because it doesn't set the env var |
Discussed in the SIG today and for now let's put the AsyncResource.bind polyfill in a file in the mongodb instrumentation package. It can have a comment that if any other instrumentation needs to use it, we could discuss moving the polyfill to the 'instrumentation' or a new 'instrumentation-helpers' package. |
why is |
Hi @Flarna I've missed that option. Thanks for pointing it out :) We could move then to |
It's not delegating to |
The main argument for using The |
I think Besides that instrumentations should be not bound to AsyncResource/AsyncHooks as there might be other context managers used in the final application. But I agree that this is more a matter of taste. APM without There might come the time where |
What version of OpenTelemetry are you using?
"@opentelemetry/instrumentation-mongodb": "0.37.1",
What version of Node are you using?
v14.21
What did you do?
checkout the main branch and install then
cd plugins/node/opentelemetry-instrumentation-mongodb nvm use v14.21.3 npm i mongodb@^5.0.0 RUN_MONGODB_TESTS=true npm run test-v5
What did you expect to see?
Tests ran correctly with the following output (attached from a run with node v18)
What did you see instead?
Tests failing with this output and process didn't exit
Additional context
There is a previous PR which introduced a patch to handle properly concurrent queries without loosing the context. The PR makes use of
AsynResource.bind
API which turns out it behaves differently from v17.8 and up. Previous versions mix the params in a way thatmongodb
callbacks receive the result as 1st param (which is expected to be an error param) and triggers a failure.Other agents like DD and Elastic have used a polyfill to have same behaviour in
AsynResource.bind
https://github.com/elastic/apm-agent-nodejs/pull/3692/files#diff-009816e1fad4583e0fb0de567eef5f23fd783b6c78aa56785459438c9db9cde8
The text was updated successfully, but these errors were encountered: