diff --git a/package-lock.json b/package-lock.json index 649e39db0..00c90e2ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.34.0", "license": "MPL-2.0", "dependencies": { - "@vscode/extension-telemetry": "^0.4.9", + "@vscode/extension-telemetry": "^0.9.8", "@zodios/core": "^10.9.2", "@zodios/plugins": "^10.6.0", "axios": "^1.7.4", @@ -1141,6 +1141,107 @@ "node": ">= 12" } }, + "node_modules/@microsoft/1ds-core-js": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-4.3.4.tgz", + "integrity": "sha512-3gbDUQgAO8EoyQTNcAEkxpuPnioC0May13P1l1l0NKZ128L9Ts/sj8QsfwCRTjHz0HThlA+4FptcAJXNYUy3rg==", + "dependencies": { + "@microsoft/applicationinsights-core-js": "3.3.4", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.2 < 2.x", + "@nevware21/ts-utils": ">= 0.11.3 < 2.x" + } + }, + "node_modules/@microsoft/1ds-post-js": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-4.3.4.tgz", + "integrity": "sha512-nlKjWricDj0Tn68Dt0P8lX9a+X7LYrqJ6/iSfQwMfDhRIGLqW+wxx8gxS+iGWC/oc8zMQAeiZaemUpCwQcwpRQ==", + "dependencies": { + "@microsoft/1ds-core-js": "4.3.4", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.2 < 2.x", + "@nevware21/ts-utils": ">= 0.11.3 < 2.x" + } + }, + "node_modules/@microsoft/applicationinsights-channel-js": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.3.4.tgz", + "integrity": "sha512-Z4nrxYwGKP9iyrYtm7iPQXVOFy4FsEsX0nDKkAi96Qpgw+vEh6NH4ORxMMuES0EollBQ3faJyvYCwckuCVIj0g==", + "dependencies": { + "@microsoft/applicationinsights-common": "3.3.4", + "@microsoft/applicationinsights-core-js": "3.3.4", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.2 < 2.x", + "@nevware21/ts-utils": ">= 0.11.3 < 2.x" + }, + "peerDependencies": { + "tslib": ">= 1.0.0" + } + }, + "node_modules/@microsoft/applicationinsights-common": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-common/-/applicationinsights-common-3.3.4.tgz", + "integrity": "sha512-4ms16MlIvcP4WiUPqopifNxcWCcrXQJ2ADAK/75uok2mNQe6ZNRsqb/P+pvhUxc8A5HRlvoXPP1ptDSN5Girgw==", + "dependencies": { + "@microsoft/applicationinsights-core-js": "3.3.4", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-utils": ">= 0.11.3 < 2.x" + }, + "peerDependencies": { + "tslib": ">= 1.0.0" + } + }, + "node_modules/@microsoft/applicationinsights-core-js": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.3.4.tgz", + "integrity": "sha512-MummANF0mgKIkdvVvfmHQTBliK114IZLRhTL0X0Ep+zjDwWMHqYZgew0nlFKAl6ggu42abPZFK5afpE7qjtYJA==", + "dependencies": { + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.2 < 2.x", + "@nevware21/ts-utils": ">= 0.11.3 < 2.x" + }, + "peerDependencies": { + "tslib": ">= 1.0.0" + } + }, + "node_modules/@microsoft/applicationinsights-shims": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-shims/-/applicationinsights-shims-3.0.1.tgz", + "integrity": "sha512-DKwboF47H1nb33rSUfjqI6ryX29v+2QWcTrRvcQDA32AZr5Ilkr7whOOSsD1aBzwqX0RJEIP1Z81jfE3NBm/Lg==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.9.4 < 2.x" + } + }, + "node_modules/@microsoft/applicationinsights-web-basic": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.3.4.tgz", + "integrity": "sha512-OpEPXr8vU/t/M8T9jvWJzJx/pCyygIiR1nGM/2PTde0wn7anl71Gxl5fWol7K/WwFEORNjkL3CEyWOyDc+28AA==", + "dependencies": { + "@microsoft/applicationinsights-channel-js": "3.3.4", + "@microsoft/applicationinsights-common": "3.3.4", + "@microsoft/applicationinsights-core-js": "3.3.4", + "@microsoft/applicationinsights-shims": "3.0.1", + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-async": ">= 0.5.2 < 2.x", + "@nevware21/ts-utils": ">= 0.11.3 < 2.x" + }, + "peerDependencies": { + "tslib": ">= 1.0.0" + } + }, + "node_modules/@microsoft/dynamicproto-js": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.3.tgz", + "integrity": "sha512-JTWTU80rMy3mdxOjjpaiDQsTLZ6YSGGqsjURsY6AUQtIj0udlF/jYmhdLZu8693ZIC0T1IwYnFa0+QeiMnziBA==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.10.4 < 2.x" + } + }, "node_modules/@mswjs/cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-1.1.0.tgz", @@ -1167,6 +1268,19 @@ "node": ">=18" } }, + "node_modules/@nevware21/ts-async": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.5.3.tgz", + "integrity": "sha512-UsF7eerLsVfid7iV1oXF80qXBwHNBeqSqfh/nPZgirRU1MACmSsj83EZKS2ViFHVfSGG6WIuXMGBP6KciXfYhA==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.11.5 < 2.x" + } + }, + "node_modules/@nevware21/ts-utils": { + "version": "0.11.5", + "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.11.5.tgz", + "integrity": "sha512-7nIzWKR50mf3htOg53kwPLqD5iJaRfVyBvb1NJhlIncyP1WzK8vAQbU9rqIsRtv7td1CnqspdP6IWNEjOjaeug==" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1690,11 +1804,16 @@ } }, "node_modules/@vscode/extension-telemetry": { - "version": "0.4.10", - "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.4.10.tgz", - "integrity": "sha512-XgyUoWWRQExTmd9DynIIUQo1NPex/zIeetdUAXeBjVuW9ioojM1TcDaSqOa/5QLC7lx+oEXwSU1r0XSBgzyz6w==", + "version": "0.9.8", + "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.8.tgz", + "integrity": "sha512-7YcKoUvmHlIB8QYCE4FNzt3ErHi9gQPhdCM3ZWtpw1bxPT0I+lMdx52KHlzTNoJzQ2NvMX7HyzyDwBEiMgTrWQ==", + "dependencies": { + "@microsoft/1ds-core-js": "^4.3.4", + "@microsoft/1ds-post-js": "^4.3.4", + "@microsoft/applicationinsights-web-basic": "^3.3.4" + }, "engines": { - "vscode": "^1.60.0" + "vscode": "^1.75.0" } }, "node_modules/@vscode/test-cli": { @@ -8987,8 +9106,7 @@ "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/tsscmp": { "version": "1.0.6", diff --git a/package.json b/package.json index 0c1659117..876add61d 100644 --- a/package.json +++ b/package.json @@ -955,7 +955,7 @@ "changelog:build": "changie batch auto && changie merge && npm i --package-lock-only" }, "dependencies": { - "@vscode/extension-telemetry": "^0.4.9", + "@vscode/extension-telemetry": "^0.9.8", "@zodios/core": "^10.9.2", "@zodios/plugins": "^10.6.0", "axios": "^1.7.4", diff --git a/src/extension.ts b/src/extension.ts index ee64e53c3..167e77e3f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -61,7 +61,7 @@ export async function activate(context: vscode.ExtensionContext): Promise } const manifest = context.extension.packageJSON; - reporter = new TelemetryReporter(context.extension.id, manifest.version, manifest.appInsightsKey); + reporter = new TelemetryReporter(manifest.appInsightsKey); context.subscriptions.push(reporter); // always register commands needed to control terraform-ls @@ -102,7 +102,11 @@ export async function activate(context: vscode.ExtensionContext): Promise initializationFailedHandler: (error: ResponseError | Error) => { initializationError = error; - reporter.sendTelemetryException(error); + reporter.sendTelemetryErrorEvent('initializationError', { + message: error.message, + stack: error.stack, + code: error instanceof ResponseError ? error.code.toString() : undefined, + }); let msg = 'Failure to start terraform-ls. Please check your configuration settings and reload this window'; @@ -235,12 +239,17 @@ export async function deactivate(): Promise { } catch (error) { if (error instanceof Error) { outputChannel.appendLine(error.message); - reporter.sendTelemetryException(error); + reporter.sendTelemetryErrorEvent('deactivate', { + message: error.message, + stack: error.stack, + }); vscode.window.showErrorMessage(error.message); lsStatus.setLanguageServerState(error.message, false, vscode.LanguageStatusSeverity.Error); } else if (typeof error === 'string') { outputChannel.appendLine(error); - reporter.sendTelemetryException(new Error(error)); + reporter.sendTelemetryErrorEvent('deactivate', { + message: error, + }); vscode.window.showErrorMessage(error); lsStatus.setLanguageServerState(error, false, vscode.LanguageStatusSeverity.Error); } diff --git a/src/features/telemetry.ts b/src/features/telemetry.ts index 02197a42c..57f44892e 100644 --- a/src/features/telemetry.ts +++ b/src/features/telemetry.ts @@ -52,7 +52,11 @@ export class TelemetryFeature implements StaticFeature { return; } - this.reporter.sendRawTelemetryEvent(event.name, event.properties); + const thing: Record = {}; + for (const [key, value] of Object.entries(event.properties)) { + thing[key] = String(value); + } + this.reporter.sendRawTelemetryEvent(event.name, thing); }), ); } diff --git a/src/providers/tfc/applyProvider.ts b/src/providers/tfc/applyProvider.ts index 8d5a7019d..8d54729d1 100644 --- a/src/providers/tfc/applyProvider.ts +++ b/src/providers/tfc/applyProvider.ts @@ -164,7 +164,10 @@ export class ApplyTreeDataProvider implements vscode.TreeDataProvider