diff --git a/package-lock.json b/package-lock.json index e903bdb..2e274b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -87,6 +87,16 @@ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, + "applicationinsights": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-1.0.1.tgz", + "integrity": "sha1-U0Rrgw/o1dYZ7uKieLMdPSUDCSc=", + "requires": { + "diagnostic-channel": "0.2.0", + "diagnostic-channel-publishers": "0.2.1", + "zone.js": "0.7.6" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -464,6 +474,19 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "diagnostic-channel": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/diagnostic-channel/-/diagnostic-channel-0.2.0.tgz", + "integrity": "sha1-zJmvlhLCP7H/8TYSxy8sv6qNWhc=", + "requires": { + "semver": "^5.3.0" + } + }, + "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=" + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -2527,6 +2550,14 @@ } } }, + "vscode-extension-telemetry": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.18.tgz", + "integrity": "sha512-Vw3Sr+dZwl+c6PlsUwrTtCOJkgrmvS3OUVDQGcmpXWAgq9xGq6as0K4pUx+aGqTjzLAESmWSrs6HlJm6J6Khcg==", + "requires": { + "applicationinsights": "1.0.1" + } + }, "vscode-json-languageservice": { "version": "3.0.12", "resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-3.0.12.tgz", @@ -2633,6 +2664,11 @@ "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", "dev": true + }, + "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 8a13124..14120af 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "shelljs": "^0.3.0", "typed-rest-client": "1.0.7", "underscore": "1.9.1", + "vscode-extension-telemetry": "0.0.18", "vscode-languageclient": "5.0.1", "vscode-nls": "3.2.4", "vscode-uri": "1.0.6" diff --git a/src/extension.ts b/src/extension.ts index ba68ecd..bb9fc34 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -6,13 +6,25 @@ import * as languageclient from 'vscode-languageclient'; import * as logger from './logger'; import * as path from 'path'; -import * as schemacontributor from './schema-contributor' +import * as schemacontributor from './schema-contributor'; import * as vscode from 'vscode'; import * as schemaassociationservice from './schema-association-service'; +import TelemetryReporter from 'vscode-extension-telemetry'; + +const telemetryExtensionId = 'azure-pipelines'; +const telemetryExtensionVersion = '0.1.0'; +const telemetryKey = 'ae672644-d394-497c-8c57-98f6eac32342'; + +let reporter; export async function activate(context: vscode.ExtensionContext) { logger.log('Extension has been activated!', 'ExtensionActivated'); + reporter = new TelemetryReporter(telemetryExtensionId, telemetryExtensionVersion, telemetryKey); + context.subscriptions.push(reporter); + + reporter.sendTelemetryEvent('extension.activate'); + const serverOptions: languageclient.ServerOptions = getServerOptions(context); const clientOptions: languageclient.LanguageClientOptions = getClientOptions(); const client = new languageclient.LanguageClient('azure-pipelines', 'Azure Pipelines Support', serverOptions, clientOptions); @@ -44,6 +56,7 @@ export async function activate(context: vscode.ExtensionContext) { }); }).catch((reason) =>{ logger.log(JSON.stringify(reason), 'ClientOnReadyError'); + reporter.sendTelemetryEvent('extension.languageserver.onReadyError', {'reason': JSON.stringify(reason)}); }); // TODO: Can we get rid of this since it's set in package.json? @@ -83,4 +96,5 @@ function getClientOptions(): languageclient.LanguageClientOptions { // this method is called when your extension is deactivated export function deactivate() { + reporter.dispose(); }