feat(instrumentation-mongoose)!: add instrumentation of static methods
Which problem is this PR solving?
Currently Mongoose instrumentation does not track static methods like insertMany and bulkWrite
Short description of the changes
Added patchModelStatic to allow instrumentation of static model methods.
Changed tested versions of mongoose because some older versions have weird timeouts with callbacks when suppressTracing is used in tests.
Related issues
Fixes #2488
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: Vovcharaa / name: Nazar Vovk (eb21cd01514e0a63c42336d0b62eab76110d8170, 167682d42bab7dee9891b1b3ebf80b89c6c7c5e6, 7475099175c25d50cf92456c3511fdda6a6ae520, 7bd1296d45fe5bc92a4657f1a0e07f56537d6f17, e1f15c110478843a9a1ed1da41e165f25da82330)
Hi @blumamir, Is there any chance that you'll be able to review it soon?
Hi. I'm also interested in this feature.
Is there anyone who can review this? @pichlermarc
Hi @Vovcharaa - @blumamir owns this component, they are the first contact point for reviews.
Regardless, a few things that stand out from a high-level perspective:
- I don't think not testing certain versions is the way to go, as we'd not notice if we'd crash the end-user's app on certain versions of mongoose.
- the PR is marked as breaking (
!in the PR title), but the changes actually all seem non-breaking to me, what's the reason for that? 🤔
Hi @pichlermarc I marked PR as breaking because I removed older versions from tests. I thought it is enough to mark them as not supported anymore.
Codecov Report
Attention: Patch coverage is 86.48649% with 5 lines in your changes missing coverage. Please review.
Project coverage is 89.68%. Comparing base (
11a2999) to head (e1f15c1). Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...gins/node/instrumentation-mongoose/src/mongoose.ts | 85.71% | 5 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #2748 +/- ##
==========================================
- Coverage 89.69% 89.68% -0.02%
==========================================
Files 184 184
Lines 8966 9003 +37
Branches 1835 1845 +10
==========================================
+ Hits 8042 8074 +32
- Misses 924 929 +5
| Files with missing lines | Coverage Δ | |
|---|---|---|
| plugins/node/instrumentation-mongoose/src/utils.ts | 76.08% <100.00%> (+1.08%) |
:arrow_up: |
| ...gins/node/instrumentation-mongoose/src/mongoose.ts | 94.70% <85.71%> (-2.34%) |
:arrow_down: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@pichlermarc @blumamir Could you pls allow tests to run?
@pichlermarc @blumamir, for some unknown reason, suppressTracing works weird with callback tests. It suppresses what it should not. I fixed it by enabling instrumentation after injecting test data into the database to avoid using suppressTracing in tests.
@pichlermarc As I see @blumamir quite rarely reviews PRs in this repo, could you, please, approve tests and merge this PR in case everything is good? This PR already has component owner approval.