-
Notifications
You must be signed in to change notification settings - Fork 524
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
chore: remove patch and unpatch diag from instrumentations #2107
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2107 +/- ##
==========================================
- Coverage 90.97% 90.45% -0.53%
==========================================
Files 146 147 +1
Lines 7492 7576 +84
Branches 1502 1574 +72
==========================================
+ Hits 6816 6853 +37
- Misses 676 723 +47
|
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 notice there are a few instrumentations not included here that I think are intentional - can you confirm I have this right? For example, mongoose has a patchAggregateExec
that includes this._diag.debug('patched mongoose Aggregate exec function');
. I think this will at the top level use the shared diag from the main instrumentation package for patching the module itself, and there was just nothing to remove from there because it didn't have a general patch log... and then it will still have additional diag logging for those specific types of patches when it comes up, which seems to be by design already within that instrumentation. Does that sound accurate? A similar situation seems to exist for fastify and a couple others, though there were main patch logs to remove here that you took care of.
I think mongoose will still be able to use the shared unpatch diag log, and koa is missing an update because its syntax is a bit different api.diag.debug('Patching Koa');
Also just noticed Hapi also uses As a follow-up after this, I think we could get these instrumentations consistently using |
Thanks for the thorough review.
That is correct, the intention was to address only the patch and unpatch of the module (or module file) itself, and not the specific function patchs from the module exports which I intend to cleanup in a different PR. Not sure how much value we get from reporting specific function patches like mongoose and hapi does. I think we should either:
|
Thanks! I updated the koa and also few other places. I think now it is removed from all relevant places. please share if you spot one that I missed |
Absolutely, I intend to align everything to |
With the function patches I suppose it may be helpful when debugging to see if something specific is not getting patched as expected, similar to the purpose here for the module itself, but it's maybe more helpful for some instrumentations vs others.. It is something to consider whether we can get a more consistent practice there too, but I don't see it being quite as impactful as this change for the whole module log, or for general usage of |
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.
Thanks for working on this! It's looking great. I'm eager to see these tests pass with the updated instrumentation package once it's available 🚀
Compile error in instr-mongodb:
|
Speaking from a little experience with instr-hapi, I think those extra |
Thanks @JamieDanielson and @trentm I support addressing the individual diag prints as well, mainly I think we should remove them unless there is some non-standard patching logic which can aid debugging? As this PR already introduces quite some changes, I want to address the remaining patch diag prints in a followup PR. I rebased this branch from main after merging #2091 and fixed all the conflicts. Thanks again for helping iterate this and the great suggestions. |
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.
Looks good. 👍
I agree that we should address the function-specific logs in a follow-up and not increase the scope of this PR for now. Merging this will unblock the release 🙂
This PR implements open-telemetry/opentelemetry-js#4641 to the contrib instrumentations, so once the core repo PR is merged, we can quickly rebase this PR and apply the changes in contrib so we can release them together.