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

feat(instrumentation-mongodb): Lighten scrubbed data #2653

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

onurtemizkan
Copy link
Contributor

Which problem is this PR solving?

Resolves: #2281
Resolves: #2516

  • _scrubStatement scrubs all data, including binary data, and with large datasets it can create performance issues.
  • Also, it seems it can also end up scrubbing circular references, which can be added by mongoose. (eg: __parentArray)

Short description of the changes

This PR updates the behaviour as described in @trentm's comment.

  • Sets a depth limit of 10 for recursion inside deeply nested objects. Please let me know if that needs to be configurable.
  • Skips Buffer and Uint8Array data while scrubbing.
  • Skips mongoose-added keys, which are marked as non-enumerable from mongoose versions after 5.13.14.

Note: I was not able to test with mongoose versions under 5.13.14 in the unit tests due to type mismatches between [email protected] and mongoose < 5.13.14 devDependencies.

@onurtemizkan onurtemizkan requested a review from a team as a code owner January 16, 2025 17:24
@github-actions github-actions bot added pkg:instrumentation-mongodb pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Jan 16, 2025
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.97%. Comparing base (4f1e605) to head (ce6b786).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2653   +/-   ##
=======================================
  Coverage   90.96%   90.97%           
=======================================
  Files         172      172           
  Lines        8137     8144    +7     
  Branches     1649     1652    +3     
=======================================
+ Hits         7402     7409    +7     
  Misses        735      735           
Files with missing lines Coverage Δ
...try-instrumentation-mongodb/src/instrumentation.ts 48.93% <100.00%> (+0.97%) ⬆️

Copy link
Contributor

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:instrumentation-mongodb pkg-status:unmaintained:autoclose-scheduled pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.
Projects
None yet
1 participant