Skip to content

Commit

Permalink
Make MPLS and vscode-extension-telemetry work together 🤝 (#11823)
Browse files Browse the repository at this point in the history
* Revert "Revert vscode-extension-telemetry changes for the release (#11602)"
This reverts commit 71d1793.
* Remove entry from changelog + add new news entry
* Update LS code to use periods instead of slashes
* Revert "Update LS code to use periods instead of slashes"
This reverts commit 1356651.
* Replace slashes before sending telemetry instead
* Too fast too furious
  • Loading branch information
kimadeline committed May 19, 2020
1 parent bcac5c1 commit df6c38d
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 244 deletions.
14 changes: 11 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ function getAllowedWarningsForWebPack(buildConfig) {
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/validation.js',
'WARNING in ./node_modules/any-promise/register.js',
'WARNING in ./node_modules/log4js/lib/appenders/index.js',
'WARNING in ./node_modules/log4js/lib/clustering.js'
'WARNING in ./node_modules/log4js/lib/clustering.js',
'WARNING in ./node_modules/diagnostic-channel-publishers/dist/src/azure-coretracing.pub.js',
'WARNING in ./node_modules/applicationinsights/out/AutoCollection/NativePerformance.js'
];
case 'extension':
return [
Expand All @@ -315,10 +317,16 @@ function getAllowedWarningsForWebPack(buildConfig) {
'remove-files-plugin@1.4.0:',
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/buffer-util.js',
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/validation.js',
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/Validation.js'
'WARNING in ./node_modules/@jupyterlab/services/node_modules/ws/lib/Validation.js',
'WARNING in ./node_modules/diagnostic-channel-publishers/dist/src/azure-coretracing.pub.js',
'WARNING in ./node_modules/applicationinsights/out/AutoCollection/NativePerformance.js'
];
case 'debugAdapter':
return ['WARNING in ./node_modules/vscode-uri/lib/index.js'];
return [
'WARNING in ./node_modules/vscode-uri/lib/index.js',
'WARNING in ./node_modules/diagnostic-channel-publishers/dist/src/azure-coretracing.pub.js',
'WARNING in ./node_modules/applicationinsights/out/AutoCollection/NativePerformance.js'
];
default:
throw new Error('Unknown WebPack Configuration');
}
Expand Down
1 change: 1 addition & 0 deletions news/3 Code Health/11597.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update telemetry on errors and exceptions to use [vscode-extension-telemetry](https://www.npmjs.com/package/vscode-extension-telemetry).
84 changes: 67 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2992,7 +2992,7 @@
"untildify": "^3.0.2",
"vscode-debugadapter": "^1.28.0",
"vscode-debugprotocol": "^1.28.0",
"vscode-extension-telemetry": "0.1.0",
"vscode-extension-telemetry": "0.1.4",
"vscode-jsonrpc": "^5.0.1",
"vscode-languageclient": "^6.2.0-next.2",
"vscode-languageserver": "^6.2.0-next.2",
Expand Down
5 changes: 4 additions & 1 deletion src/client/activation/languageClientMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,12 @@ function captureTelemetryForLSPMethod(method: string, debounceMilliseconds: numb
this.lastCaptured.set(method, now);
this.eventCount += 1;

// Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry.
const formattedMethod = method.replace(/\//g, '.');

const properties = {
lsVersion: this.serverVersion || 'unknown',
method: method
method: formattedMethod
};

const stopWatch = new StopWatch();
Expand Down
7 changes: 6 additions & 1 deletion src/client/activation/languageServer/languageServerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ export class DotNetLanguageServerProxy implements ILanguageServerProxy {
if (settings.downloadLanguageServer) {
this.languageClient.onTelemetry((telemetryEvent) => {
const eventName = telemetryEvent.EventName || EventName.PYTHON_LANGUAGE_SERVER_TELEMETRY;
sendTelemetryEvent(eventName, telemetryEvent.Measurements, telemetryEvent.Properties);
const formattedProperties = {
...telemetryEvent.Properties,
// Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry.
method: telemetryEvent.Properties.method?.replace(/\//g, '.')
};
sendTelemetryEvent(eventName, telemetryEvent.Measurements, formattedProperties);
});
}
await this.registerTestServices();
Expand Down
7 changes: 6 additions & 1 deletion src/client/activation/node/languageServerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy {
if (settings.downloadLanguageServer) {
this.languageClient.onTelemetry((telemetryEvent) => {
const eventName = telemetryEvent.EventName || EventName.LANGUAGE_SERVER_TELEMETRY;
sendTelemetryEvent(eventName, telemetryEvent.Measurements, telemetryEvent.Properties);
const formattedProperties = {
...telemetryEvent.Properties,
// Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry.
method: telemetryEvent.Properties.method?.replace(/\//g, '.')
};
sendTelemetryEvent(eventName, telemetryEvent.Measurements, formattedProperties);
});
}
await this.registerTestServices();
Expand Down
Loading

0 comments on commit df6c38d

Please sign in to comment.