Skip to content
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

Merged
merged 4 commits into from
Sep 23, 2018
Merged

Upgrade appinsights #58999

merged 4 commits into from
Sep 23, 2018

Conversation

ramya-rao-a
Copy link
Contributor

@ramya-rao-a ramya-rao-a commented Sep 20, 2018

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

// 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

Copy link
Contributor Author

@ramya-rao-a ramya-rao-a Sep 21, 2018

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?

Copy link
Member

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?

Copy link
Member

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

Copy link
Contributor Author

@ramya-rao-a ramya-rao-a Sep 21, 2018

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

image

The application insights module gets loaded even before https://github.com/Microsoft/vscode/blob/master/scripts/code-cli.bat#L24

Thoughts?
cc @joaomoreno @jrieken

Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@bpasero bpasero left a 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.

@ramya-rao-a
Copy link
Contributor Author

@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

image

The application insights module gets loaded even before https://github.com/Microsoft/vscode/blob/master/scripts/code-cli.bat#L24

Thoughts?
cc @joaomoreno @jrieken

@bpasero
Copy link
Member

bpasero commented Sep 22, 2018

@ramya-rao-a

Pushed a commit to make the change as you suggested.

Thanks lgtm

@ramya-rao-a ramya-rao-a merged commit ae52629 into master Sep 23, 2018
@joaomoreno joaomoreno deleted the ramyar/appinsights branch September 24, 2018 07:59
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use the latest applicationInsights module
4 participants