-
Notifications
You must be signed in to change notification settings - Fork 533
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-mysql2): Fix mysql2 instrumentation connection prototype #2578
fix(instr-mysql2): Fix mysql2 instrumentation connection prototype #2578
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2578 +/- ##
==========================================
- Coverage 90.75% 90.75% -0.01%
==========================================
Files 169 169
Lines 8018 8023 +5
Branches 1632 1633 +1
==========================================
+ Hits 7277 7281 +4
- Misses 741 742 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I also just finished fixing this on my working copy before heading out to lunch, looks like you beat my by half an hour 🙂
Looks good, thanks 🙌 Let's wait for TAV to complete and then we should be good to go 🙂
Huh, weird - tests in TAV seem to be still failing but it's not yet possible to see which versions they're failing at. 🤔 |
I think I missed something that keeps failing tests
Forgot to link the issue in the PR, sorry. TAV tests seem to be stuck so maybe my fix is not solving all issues :( |
No worries 🙂 I've also pushed my change (it's very similar to yours) - the only difference I can tell is that I'm checking that the base is |
|
||
// if `baseClass` has no prototype means connection is not extending | ||
// another class so the functions we need to patch are already there | ||
if (typeof baseClass.prototype === 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think in older versions you get EventEmitter
as a base. That may be why the TAV tests are failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted the check to make it more explicit. It will return the base class prototype if it has the query
function (execute
goes together). Otherwise it falls back to the Connection
prototype.
Note: I had trouble running it locally since docker image mysql:5.7
has no support for linux/arm64/v8
platform. Is it possible to update the image version in @opentelemetry/contrib-test-utils
?
closing this one in favor of #2579 |
Which problem is this PR solving?
mysql2@3.11.5
introduced a internal refactoring to solve circular dependencies within the package.ref: sidorares/node-mysql2#3081
The changes include a new
BaseConnection
class which contains the methods we need to patch (query, execute). TheConnection
class is extending it therefore the instrumentation gets the wrong prototype when patching.Fixes: #2572
Short description of the changes
mysql2
to v3.11.5