-
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
feat: add OTEL_NO_PATCH_MODULES #1153
feat: add OTEL_NO_PATCH_MODULES #1153
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1153 +/- ##
==========================================
+ Coverage 92.33% 92.37% +0.03%
==========================================
Files 119 119
Lines 3433 3447 +14
Branches 696 700 +4
==========================================
+ Hits 3170 3184 +14
Misses 263 263
|
@open-telemetry/javascript-maintainers & @open-telemetry/javascript-approvers I think we will soon have more and more new env variables we already have 3 PR opened all of them implementing more less the same functionality. I think we should unify all the environment properties to keep them in one place and have some |
Can we add a special case of some kind which disables all? Possibly edit: * might not be great because shell expansion may interfere |
@obecny I agree. Something like
@dyladan do you know where shell expansion would be an issue? I tried on a few different environments and didn't run into any issues. |
I was just envisioning a scenario where someone does like |
@@ -46,6 +52,14 @@ function filterPlugins(plugins: Plugins): Plugins { | |||
}, {}); | |||
} | |||
|
|||
function getIgnoreList(): string[] | '*' { | |||
const envIgnoreList: string = process.env[envPluginDisabledList] || ''; | |||
if (envIgnoreList === '*') { |
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.
Can we pull this out to a constant?
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.
Updated
`OPENTELEMETRY_NO_PATCH_MODULES` accepts a | ||
comma separated list of module names to disabled specific plugins. | ||
The names should match what you use to `require` the module into your application. | ||
For example, `OPENTELEMETRY_PATCH_MODULES=pg,https` will disable the postgres plugin and the https plugin. To disable **all** plugins, set the environment variable to `*`. |
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.
For example, `OPENTELEMETRY_PATCH_MODULES=pg,https` will disable the postgres plugin and the https plugin. To disable **all** plugins, set the environment variable to `*`. | |
For example, `OPENTELEMETRY_NO_PATCH_MODULES=pg,https` will disable the postgres plugin and the https plugin. To disable **all** plugins, set the environment variable to `*`. |
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.
updated. thanks!
packages/opentelemetry-node/src/instrumentation/PluginLoader.ts
Outdated
Show resolved
Hide resolved
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.
Added a minor comment, otherwise 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. Just one comment.
We currently have an OTEL_RESOURCE_LABELS
environment variable here. It appears from open-telemetry/opentelemetry-specification#572 that most languages are using OTEL_
as a prefix. Should we consider calling this OTEL_NO_PATCH_MODULES
?
Yes this is a good point, naming alignment would be great. I think shorter is better. @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.
lgtm
Which problem is this PR solving?
Short description of the changes
OPENTELEMETRY_NO_PATCH_MODULES
inPluginLoader
to selectively disable plugins for certain moduleshttps,mongodb,@grpc/grpc-js
will disable plugins (if installed) for these 3 modules