-
Notifications
You must be signed in to change notification settings - Fork 544
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: add sqlcommenter comment to mysql2 queries #1523
feat: add sqlcommenter comment to mysql2 queries #1523
Conversation
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.
This LGTM. thank you for handling this.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1523 +/- ##
==========================================
- Coverage 96.13% 93.70% -2.43%
==========================================
Files 14 49 +35
Lines 906 2702 +1796
Branches 197 504 +307
==========================================
+ Hits 871 2532 +1661
- Misses 35 170 +135
|
Is there anything blocking this PR at the moment given the coverage regressions aren't coming from the patch ? |
Yes. there is a conflict in |
Which problem is this PR solving?
This PR adds support for inserting sqlcommenter comments in the
mysql2
instrumentation the same way #1286 did forpg
.Short description of the changes
The common logic for detecting and writing SQL comments has been extracted to a
sql-common
package which is now depended on by both themysql2
andpg
instrumentations. I'm not super confident about the way new packages should be created (versioning, dependencies, etc etc) so let me know if anything there needs to be changed.I'm also planning to also add support to the
mysql
instrumentation at some point after this is merged, and potentially improve the comment detection logic to reduce false positives.The new config option essentially works the exact same way as the existing one for
pg
. It's not enabled for prepared queries for fairly obvious reasons.I had to change some of the MySQL options used for the local and CI containers to be able to check the comments are successfully added by looking at the log. The CI variant feels a little dirty but GitHub apparently doesn't support passing arguments to service containers so it's the best way I could think of.