-
Notifications
You must be signed in to change notification settings - Fork 804
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
Prevent loading plugins for incorrect module #626 #653
Conversation
Codecov Report
@@ Coverage Diff @@
## master #653 +/- ##
==========================================
+ Coverage 92.62% 92.65% +0.03%
==========================================
Files 221 228 +7
Lines 10241 10312 +71
Branches 925 943 +18
==========================================
+ Hits 9486 9555 +69
- Misses 755 757 +2
|
packages/opentelemetry-core/src/trace/instrumentation/BasePlugin.ts
Outdated
Show resolved
Hide resolved
df15a55
to
a7230b4
Compare
a7230b4
to
7dd415c
Compare
Tests are failling because |
7dd415c
to
cc9211c
Compare
81e3f7c
to
76f575c
Compare
@open-telemetry/javascript-approvers Same as the other one, if someone else could review it would be really nice ! |
if (!utils.isSupportedVersion(version, plugin.supportedVersions)) { | ||
this.logger.error( |
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 believe this should be a warning not an error. An error implies something is broken, where a warning is just telling the user they may be doing something they should not.
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 would like some more input on that, i personnaly prefer to raise an error since the plugin wont work.
cc @open-telemetry/javascript-approvers
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.
cc @mayurkale22
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.
lgtm, left a comments with regards to copy only
packages/opentelemetry-node/test/instrumentation/PluginLoader.test.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-node/src/instrumentation/PluginLoader.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-node/src/instrumentation/PluginLoader.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-types/src/trace/instrumentation/Plugin.ts
Outdated
Show resolved
Hide resolved
7fc728f
to
8d4e560
Compare
@mayurkale22 If you have no objection on the error level above, i believe it's good to merge (tests are failing on 8 for one of our dependency like usual and the lint because api isnt published yet) |
Sorry for the delay, just approved the PR. |
b78c6bb
to
1fd364e
Compare
@vmarchaud please resolve the conflicts, looks good to go |
1fd364e
to
8250be1
Compare
…-telemetry#653) * fix: do not load plugin when they patch a different module than defined in config open-telemetry#626
open-telemetry#653) Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com> Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
we needed to avoid loading a plugin if the module name in the config was different than the one that the plugin instrument.
It requires that every package expose
moduleName
as the name of the module they instrument so i changes theBasePlugin
interface andPlugin
type.