-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Upgrade appinsights #58999
Upgrade appinsights #58999
Conversation
c5277da
to
05a1228
Compare
// Set the below before requiring applicationinsights in the shared process | ||
process.env['APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL'] = 'true'; // Skip monkey patching of 3rd party modules by appinsights | ||
global['diagnosticsSource'] = {}; // Prevents diagnostic channel (which patches "require") from initializing entirely | ||
|
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.
This is the workaround to avoid the monkey patching that gets done by the newer version of application insights. It needs to be placed before application insights module gets imported. Based on the way we load things, this is definitely the safest place for the workaround, but maybe not the best.
Any ideas on any other place thats right for this?
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.
@bpasero Maybe the bootstrap files?
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.
@ramya-rao-a you can add a helper method to bootstrap.js and then call it from where we need it, looks like:
src/cli.js
src/vs/code/electron-browser/sharedProcess/sharedProcess.js
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.
@bpasero Pushed a commit to make the change as you suggested.
It works as expected for the shared process, but not for the cli.
I added some console logs in the modules that do the patching and below is what I see when running the cli
The application insights module gets loaded even before https://github.com/Microsoft/vscode/blob/master/scripts/code-cli.bat#L24
Thoughts?
cc @joaomoreno @jrieken
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
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.
Fine, with my comment.
@bpasero Pushed a commit to make the change as you suggested. It works as expected for the shared process, but not for the cli. The application insights module gets loaded even before https://github.com/Microsoft/vscode/blob/master/scripts/code-cli.bat#L24 Thoughts? |
Thanks lgtm |
This PR upgrades the version of appinsights we use. Fixes #44052 & #55417
I have tested the telemetry gets logged as expected.
What's pending in this review is the right place to add the workaround we need to ensure the newer version of application insights does not patch any modules. See microsoft/ApplicationInsights-node.js#425