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: mysql2 instrumentation #521

Merged
merged 11 commits into from Jun 14, 2021

Conversation

rauno56
Copy link
Member

@rauno56 rauno56 commented Jun 4, 2021

Which problem is this PR solving?

Adds autoinstrumentation for mysql2.

Short description of the changes

This is pretty much the same as opentelemetry-instrumentation-mysql2, but I simplified it by only wrapping Connection.prototype. This exact code might actually work for mysql as well.

@rauno56 rauno56 requested a review from a team as a code owner June 4, 2021 17:30
@vmarchaud
Copy link
Member

vmarchaud commented Jun 4, 2021

If patched modules are close, i think we should just add support for mysql2 inside mysql instrumentation, WDYT ?

@codecov
Copy link

codecov bot commented Jun 4, 2021

Codecov Report

Merging #521 (15a555c) into main (676dbbc) will increase coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #521      +/-   ##
==========================================
+ Coverage   94.77%   94.82%   +0.05%     
==========================================
  Files         152      157       +5     
  Lines        9342     9862     +520     
  Branches      921      957      +36     
==========================================
+ Hits         8854     9352     +498     
- Misses        488      510      +22     
Impacted Files Coverage Δ
...telemetry-instrumentation-mysql/test/mysql.test.ts
...elemetry-instrumentation-mysql2/test/mysql.test.ts 98.31% <0.00%> (ø)
...etry-instrumentation-mysql2/src/instrumentation.ts 95.00% <0.00%> (ø)
.../opentelemetry-instrumentation-mysql2/src/utils.ts 100.00% <0.00%> (ø)
node/opentelemetry-instrumentation-mysql2/test.js 0.00% <0.00%> (ø)
...pentelemetry-instrumentation-mysql2/src/version.ts 100.00% <0.00%> (ø)
...telemetry-instrumentation-mysql/test/index.test.ts 98.28% <0.00%> (ø)

@rauno56 rauno56 force-pushed the feat/mysql2-instrumentation branch from f703b66 to 1913815 Compare June 4, 2021 18:05
@rauno56
Copy link
Member Author

rauno56 commented Jun 4, 2021

Yes... It would be totally fine, unless... Types.
Could still be done, but I'd take it on outside of this PR.

@vmarchaud
Copy link
Member

Yes... It would be totally fine, unless... Types.

Not sure to understand why types are a problem ?

@rauno56
Copy link
Member Author

rauno56 commented Jun 7, 2021

We don't have a good precedent of 2-package instrumentation - I mainly don't want to start that discussion here.

To answer your question: Because those do not match between the two packages. Not saying it's not doable, it absolutely is with unions and whatnot, but transforming the code to work with mysql2 was already a task and I don't see a good reason to push more into a PR.

@vmarchaud
Copy link
Member

FYI we have both http (that handle https too) and grpc (that handle grpc-js and grpc c++) that have this behavior and we don't have any issue with it.
I totally think that since you already written as a separate package it doesnt matter but i was more asking if you tried and there was issue.

Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

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

lgtm

@rauno56
Copy link
Member Author

rauno56 commented Jun 7, 2021

Thanks for pointing this out, @vmarchaud. I'll look into that at some point! :)

@vmarchaud vmarchaud requested a review from a team June 9, 2021 08:18
@vmarchaud
Copy link
Member

cc @open-telemetry/javascript-approvers would appreciate some review so we can ship this with the next release :) thanks

@vmarchaud vmarchaud merged commit 3ea5298 into open-telemetry:main Jun 14, 2021
@vmarchaud vmarchaud added the enhancement New feature or request label Jun 14, 2021
@rauno56 rauno56 deleted the feat/mysql2-instrumentation branch June 17, 2021 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants