-
Notifications
You must be signed in to change notification settings - Fork 836
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(plugin): add supportedVersions property #237
feat(plugin): add supportedVersions property #237
Conversation
Codecov Report
@@ Coverage Diff @@
## master #237 +/- ##
==========================================
- Coverage 98.79% 98.77% -0.03%
==========================================
Files 55 55
Lines 2161 2118 -43
Branches 151 149 -2
==========================================
- Hits 2135 2092 -43
Misses 26 26
|
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.
Nice! How do you set the supportedVersions
? Is it going to be part of PluginConfig
(pull/229)?
It would be nice If you can add 1-2 tests in PluginLoader.test.ts
.
packages/opentelemetry-node-tracer/test/instrumentation/utils.test.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-types/src/trace/instrumentation/Plugin.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-types/src/trace/instrumentation/Plugin.ts
Outdated
Show resolved
Hide resolved
When developer write a plugin, it need to specify all supported versions, see Plugin interface and BasicPlugin abstract class. When the hook is triggered, we check if the version is satisfied.
|
Ok, got it, thanks for the clarification. 👍 |
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.
Otherthan few minors, LGTM.
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. To verify, empty array []
means that no versions are supported and so no patching would be done?
Closes open-telemetry#132 Signed-off-by: Olivier Albertini <olivier.albertini@montreal.ca>
81b0d0d
to
d1f8dcd
Compare
Yeah sounds not safe... So I added a test and now it's the same behaviour than undefined |
Done. |
Actually, I think it makes sense for it not to do patching in this case since it'd be explicitly set to "no versions". On the other hand, I'm not sure why a non-patching plugin would exist in first place. What do you think? |
from markwolff from mayurkale22 Signed-off-by: Olivier Albertini <olivier.albertini@montreal.ca>
d1f8dcd
to
8547b6d
Compare
It's interesting! Let's say, developer sets some supportedVersions... and client find a version that is not supported but works for some reasons. It could override this without waiting a PR approval etc.. ? We could create a separate issue for that if it's needed. Let me know. |
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 the addressing the comments and adding more tests.
Agreed. I like the current approach. |
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 but i would rename the node_modules
folder in test since it can be confusing, the require
could just use the full path, but it's non-blocking for me
In order to reduce possible frustrations, |
Co-authored-by: Naseem <naseem@transit.app> Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Co-authored-by: Naseem <naseem@transit.app> Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Co-authored-by: Naseem <naseem@transit.app> Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Co-authored-by: Naseem <naseem@transit.app> Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Which problem is this PR solving?
It's backward compatible. supportedVersion is optional in plugins. If not defined, all versions are supported. See related tests.
Closes #132
Signed-off-by: Olivier Albertini olivier.albertini@montreal.ca