From d5065e6976ab8bf3289d70be4a34110a53b224c5 Mon Sep 17 00:00:00 2001
From: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Date: Mon, 4 May 2020 08:27:26 -0700
Subject: [PATCH] Use vscode-extension-telemetry for our exceptions & error
telemetry (#11524)
* Add pipenv discovery telemetry
(update when getInterpreters signature change gets merged)
* Update package.json
* Use firstParty optional arg
* News file
* Sanitize paths using telemetry package
* Remove outdated warnings, typos
* More descriptive test names
* Only send one event, fix unit tests
* Don't make unnecessary changes
* Forgot some
* Fix build warnings
---
gulpfile.js | 14 +-
news/3 Code Health/11436.md | 1 +
package-lock.json | 84 ++++++++---
package.json | 2 +-
src/client/telemetry/index.ts | 108 ++++++--------
.../telemetry/vscode-extension-telemetry.d.ts | 33 ----
src/test/telemetry/index.unit.test.ts | 141 ++++--------------
7 files changed, 157 insertions(+), 226 deletions(-)
create mode 100644 news/3 Code Health/11436.md
delete mode 100644 src/client/telemetry/vscode-extension-telemetry.d.ts
diff --git a/gulpfile.js b/gulpfile.js
index f2f91140595b..a290b648282a 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -287,7 +287,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 [
@@ -300,10 +302,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');
}
diff --git a/news/3 Code Health/11436.md b/news/3 Code Health/11436.md
new file mode 100644
index 000000000000..4d5ba9f74640
--- /dev/null
+++ b/news/3 Code Health/11436.md
@@ -0,0 +1 @@
+Update telemetry on errors and exceptions to use [vscode-extension-telemetry](https://www.npmjs.com/package/vscode-extension-telemetry).
diff --git a/package-lock.json b/package-lock.json
index 67d1bea0bd20..a473af1e77df 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4657,13 +4657,14 @@
}
},
"applicationinsights": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-1.0.6.tgz",
- "integrity": "sha512-VQT3kBpJVPw5fCO5n+WUeSx0VHjxFtD7znYbILBlVgOS9/cMDuGFmV2Br3ObzFyZUDGNbEfW36fD1y2/vAiCKw==",
+ "version": "1.7.4",
+ "resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-1.7.4.tgz",
+ "integrity": "sha512-XFLsNlcanpjFhHNvVWEfcm6hr7lu9znnb6Le1Lk5RE03YUV9X2B2n2MfM4kJZRrUdV+C0hdHxvWyv+vWoLfY7A==",
"requires": {
+ "cls-hooked": "^4.2.2",
+ "continuation-local-storage": "^3.2.1",
"diagnostic-channel": "0.2.0",
- "diagnostic-channel-publishers": "0.2.1",
- "zone.js": "0.7.6"
+ "diagnostic-channel-publishers": "^0.3.3"
}
},
"aproba": {
@@ -5230,11 +5231,28 @@
"integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==",
"dev": true
},
+ "async-hook-jl": {
+ "version": "1.7.6",
+ "resolved": "https://registry.npmjs.org/async-hook-jl/-/async-hook-jl-1.7.6.tgz",
+ "integrity": "sha512-gFaHkFfSxTjvoxDMYqDuGHlcRyUuamF8s+ZTtJdDzqjws4mCt7v0vuV79/E2Wr2/riMQgtG4/yUtXWs1gZ7JMg==",
+ "requires": {
+ "stack-chain": "^1.3.7"
+ }
+ },
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
},
+ "async-listener": {
+ "version": "0.6.10",
+ "resolved": "https://registry.npmjs.org/async-listener/-/async-listener-0.6.10.tgz",
+ "integrity": "sha512-gpuo6xOyF4D5DE5WvyqZdPA3NGhiT6Qf07l7DCB0wwDEsLvDIbCr6j9S5aj5Ch96dLace5tXVzWBZkxU/c5ohw==",
+ "requires": {
+ "semver": "^5.3.0",
+ "shimmer": "^1.1.0"
+ }
+ },
"async-settle": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz",
@@ -6807,6 +6825,16 @@
}
}
},
+ "cls-hooked": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/cls-hooked/-/cls-hooked-4.2.2.tgz",
+ "integrity": "sha512-J4Xj5f5wq/4jAvcdgoGsL3G103BtWpZrMo8NEinRltN+xpTZdI+M38pyQqhuFU/P792xkMFvnKSf+Lm81U1bxw==",
+ "requires": {
+ "async-hook-jl": "^1.7.6",
+ "emitter-listener": "^1.0.1",
+ "semver": "^5.4.1"
+ }
+ },
"clsx": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.0.4.tgz",
@@ -7148,6 +7176,15 @@
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
+ "continuation-local-storage": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz",
+ "integrity": "sha512-jx44cconVqkCEEyLSKWwkvUXwO561jXMa3LPjTPsm5QR22PA0/mhe33FT4Xb5y74JDvt/Cq+5lm8S8rskLv9ZA==",
+ "requires": {
+ "async-listener": "^0.6.0",
+ "emitter-listener": "^1.1.1"
+ }
+ },
"convert-source-map": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
@@ -8690,9 +8727,9 @@
}
},
"diagnostic-channel-publishers": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.2.1.tgz",
- "integrity": "sha1-ji1geottef6IC1SLxYzGvrKIxPM="
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.3.4.tgz",
+ "integrity": "sha512-SZ1zMfFiEabf4Qx0Og9V1gMsRoqz3O+5ENkVcNOfI+SMJ3QhQsdEoKX99r0zvreagXot2parPxmrwwUM/ja8ug=="
},
"diagnostics": {
"version": "1.1.1",
@@ -9059,6 +9096,14 @@
"minimalistic-crypto-utils": "^1.0.0"
}
},
+ "emitter-listener": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/emitter-listener/-/emitter-listener-1.1.2.tgz",
+ "integrity": "sha512-Bt1sBAGFHY9DKY+4/2cV6izcKJUf5T7/gkdmkxzX/qv9CcGH8xSwVRW5mtX03SWJtRTWSOpzCuWN9rBFYZepZQ==",
+ "requires": {
+ "shimmer": "^1.2.0"
+ }
+ },
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@@ -20668,6 +20713,11 @@
}
}
},
+ "shimmer": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz",
+ "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw=="
+ },
"shortid": {
"version": "2.2.14",
"resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.14.tgz",
@@ -21260,6 +21310,11 @@
"figgy-pudding": "^3.5.1"
}
},
+ "stack-chain": {
+ "version": "1.3.7",
+ "resolved": "https://registry.npmjs.org/stack-chain/-/stack-chain-1.3.7.tgz",
+ "integrity": "sha1-0ZLJ/06moiyUxN1FkXHj8AzqEoU="
+ },
"stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
@@ -24563,11 +24618,11 @@
"integrity": "sha512-+OMm11R1bGYbpIJ5eQIkwoDGFF4GvBz3Ztl6/VM+/RNNb2Gjk2c0Ku+oMmfhlTmTlPCpgHBsH4JqVCbUYhu5bA=="
},
"vscode-extension-telemetry": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.0.tgz",
- "integrity": "sha512-WVCnP+uLxlqB6UD98yQNV47mR5Rf79LFxpuZhSPhEf0Sb4tPZed3a63n003/dchhOwyCTCBuNN4n8XKJkLEI1Q==",
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.4.tgz",
+ "integrity": "sha512-9U2pUZ/YwZBfA8CkBrHwMxjnq9Ab+ng8daJWJzEQ6CAxlZyRhmck23bx2lqqpEwGWJCiuceQy4k0Me6llEB4zw==",
"requires": {
- "applicationinsights": "1.0.6"
+ "applicationinsights": "1.7.4"
}
},
"vscode-jsonrpc": {
@@ -25681,11 +25736,6 @@
}
}
}
- },
- "zone.js": {
- "version": "0.7.6",
- "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.7.6.tgz",
- "integrity": "sha1-+7w50+AmHQmG8boGMG6zrrDSIAk="
}
}
}
diff --git a/package.json b/package.json
index 0fb6a6b87a17..4aa24c139cf2 100644
--- a/package.json
+++ b/package.json
@@ -2978,7 +2978,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",
diff --git a/src/client/telemetry/index.ts b/src/client/telemetry/index.ts
index 89a918976ca9..386f3fb352e9 100644
--- a/src/client/telemetry/index.ts
+++ b/src/client/telemetry/index.ts
@@ -1,15 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-// tslint:disable:no-reference no-any import-name no-any function-name
-///
= {};
+ let eventNameSent = eventName as string;
- if (ex && (eventName as any) !== 'ERROR') {
- // When sending `ERROR` telemetry event no need to send custom properties.
+ if (ex) {
+ // When sending telemetry events for exceptions no need to send custom properties.
// Else we have to review all properties every time as part of GDPR.
// Assume we have 10 events all with their own properties.
// As we have errors for each event, those properties are treated as new data items.
// Hence they need to be classified as part of the GDPR process, and thats unnecessary and onerous.
- const props: Record ${filename.substring(EXTENSION_ROOT_DIR.length)}`;
- } else {
- // We don't really care about files outside our extension.
- filename = `