-
Notifications
You must be signed in to change notification settings - Fork 140
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
[Shim] Fix JSON Config #1203
[Shim] Fix JSON Config #1203
Conversation
JacksonWeber
commented
Sep 6, 2023
•
edited
Loading
edited
- Add remaining JSON config values.
- Fix JSON config file path and stop us from overwriting defined env vars with undefined values from the JSON file.
isInitialized = true; | ||
const individualOptOuts: string = ShimJsonConfig.getInstance().noPatchModules; |
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.
Why are you adding the check here? you should be checking for config options in the subscriber code not here in publishers side
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.
Rationale was that we used to disable diagnostic channels on the publisher side, however I agree it makes sense to disable them at a subscriber level. Will update that.
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.
Refactored this to use the publisher's enable
functions (specifically not calling them if noDiagnosticChannel is set to true) in the same way as noPatchModules
.
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.
Not seeing those changes here, is there a commit missing?
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.
Changed such that we still do this check on the publisher side (line 26 is where we do the check for noDiagnosticChannel). It takes advantage of the same enable()
methods each of the subscribers has. If we don't want to do this check for noDiagnosticChannel here we could move the logic for both noDiagnosticChannel and noPatchModules to each individual subscriber, but after looking into moving the code to the subscribers it seems like it'd make this logic more complicated than necessary.
@@ -4,14 +4,17 @@ | |||
// Don't reference modules from these directly. Use only for types. | |||
import * as DiagChannelPublishers from "diagnostic-channel-publishers"; | |||
import { Logger } from "../../shared/logging"; | |||
import { ShimJsonConfig } from "../../shim/jsonConfig"; |
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.
JSON config should never used outside of our Internal config class, value could be overridden using JS code so this ignores that
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.
noDiagnosticChannel and noPatchModules cannot be configured via defaultClient.config.noDiagnosticChannel
or defaultClient.config.noPatchModules
, only via env var or JSON config, so I don't believe this could be overridden before being read here. Were you referring to another way it could be overridden?
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