-
Notifications
You must be signed in to change notification settings - Fork 825
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(instrumentation): add back support for absolute paths via require-in-the-middle
#3457
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3457 +/- ##
==========================================
+ Coverage 93.37% 93.75% +0.37%
==========================================
Files 248 248
Lines 7547 7552 +5
Branches 1574 1576 +2
==========================================
+ Hits 7047 7080 +33
+ Misses 500 472 -28
|
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.
Is it possible to add a test for absolute path support?
@Flarna I've added a couple tests of enable/disable, which includes a test for absolute path support. |
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'm not sure to see why we can't handle absolute path with the singleton ? wouldn't it be as simple as checking for exact match here ?
Looks like it’s only happening in this specific case, sweet :):):) |
This should make it so that the AWS lambda instrumentation can keep using this module right? |
Exactly. |
Which problem is this PR solving?
In #3161, we replaced
require-in-the-middle
(RITM) withRequireInTheMiddleSingleton
; one of the differences between the two is thatRequireInTheMiddleSingleton
does not support module names with absolute paths (i.e. what@opentelemetry/instrumentation-aws-lambda
uses). This PR adds back support for module names with absolute paths.Fixes open-telemetry/opentelemetry-js-contrib#1285
Short description of the changes
This PR adds fallback behavior: when an instrumentation plugin wants to instrument a module that is an absolute path, we will fall back to using RITM directly. The downside is that this will create additional instances of RITM, which we want to avoid, but
@opentelemetry/instrumentation-aws-lambda
is the only plugin that uses an absolute path, and we don't anticipate others.In open-telemetry/opentelemetry-js-contrib#1285, we discussed a few options for resolving the need to instrument absolute paths. This PR represents option 2:
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I have tested this against
@opentelemetry/instrumentation-aws-lambda
and other instrumentation plugins.Checklist: