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

fix(instr-mongodb): fix function patch missing one argument introduced in v6.8.0 #2314

Merged

Conversation

david-luna
Copy link
Contributor

Which problem is this PR solving?

mongodb@6.8.0 introduced a new feature for lazy parsing documents. This feature relies on a new parameter on an internal API that the instrumentation was not passing to the original method resulting in an exception being thrown. Ref: #2309

this PR contains a fix to make sure the command original API gets all parameters when called. It uses Function.prototype.apply to call the original function so we do not stump on the same issue if any other param is added.

Short description of the changes

  • use Function.prototype.apply to not lose any parameters when calling the original API
  • added some extra types
  • updated tests since one of them was inspecting data which is not parsed yet

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.42%. Comparing base (dfb2dff) to head (5c09e15).
Report is 184 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2314      +/-   ##
==========================================
- Coverage   90.97%   90.42%   -0.55%     
==========================================
  Files         146      148       +2     
  Lines        7492     7323     -169     
  Branches     1502     1518      +16     
==========================================
- Hits         6816     6622     -194     
- Misses        676      701      +25     
Files Coverage Δ
...try-instrumentation-mongodb/src/instrumentation.ts 47.81% <100.00%> (-5.46%) ⬇️
...etry-instrumentation-mongodb/src/internal-types.ts 100.00% <ø> (ø)

... and 60 files with indirect coverage changes

@pichlermarc pichlermarc changed the title fix(instr-mongodb): fix function patch missing one argument introduced in v6.6.0 fix(instr-mongodb): fix function patch missing one argument introduced in v6.8.0 Jul 3, 2024
@pichlermarc pichlermarc added the bug Something isn't working label Jul 3, 2024
Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@david-luna thanks for working on this. The fix looks good, just a few nits from my side. 👍

david-luna and others added 3 commits July 3, 2024 16:44
…b-v5-v6.test.ts

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
…b-v5-v6.test.ts

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
…b-v5-v6.test.ts

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
@david-luna david-luna merged commit 9dc55da into open-telemetry:main Jul 3, 2024
19 checks passed
@david-luna david-luna deleted the dluna/2309-mongodb-command-issue branch July 3, 2024 16:56
@dyladan dyladan mentioned this pull request Jul 3, 2024
timokoessler added a commit to AikidoSec/firewall-node that referenced this pull request Jul 12, 2024
hansott added a commit to AikidoSec/firewall-node that referenced this pull request Jul 15, 2024
…spaces

* 'workspaces' of github.com:AikidoSec/node-RASP:
  fix opentelemetry test open-telemetry/opentelemetry-js-contrib#2314
  Update lockfile
  fix missing packages
  Revert "Try to fix end2end tests"
  Try to fix end2end tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:instrumentation-mongodb
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants