From 2d3bc35aa050bec81c50c890470a8ac3b4109d44 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 00:16:41 -0600 Subject: [PATCH 1/7] Bump vsce to 1.5.1, which is the latest --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dbcdbc9f..b4a9bc34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "ts-loader": "^9.2.2", "typescript": "^4.3.2", "util": "^0.12.4", - "vsce": "^2.5.0", + "vsce": "^2.5.1", "vscode-test": "^1.6.1", "webpack": "^5.38.1", "webpack-cli": "^4.7.0" @@ -4809,9 +4809,9 @@ "dev": true }, "node_modules/vsce": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-2.5.0.tgz", - "integrity": "sha512-KgsCX/C5nEUHXGrXac9KOGUXsWRlMEyoZZX0wJsagE4gSieaaHVAHxJu7Vh63a1UyRf6lQcNXmyOzRCYMmrF2Q==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-2.5.1.tgz", + "integrity": "sha512-vJ+xY93Wv3NhgeriMyIC2oMA+niifOI9XGIqEToIq/rFRoQnXlmO4PSyis/OxBl9hw8OKKC/VcI9CijfFufEkw==", "dev": true, "dependencies": { "azure-devops-node-api": "^11.0.1", @@ -9109,9 +9109,9 @@ "dev": true }, "vsce": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-2.5.0.tgz", - "integrity": "sha512-KgsCX/C5nEUHXGrXac9KOGUXsWRlMEyoZZX0wJsagE4gSieaaHVAHxJu7Vh63a1UyRf6lQcNXmyOzRCYMmrF2Q==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-2.5.1.tgz", + "integrity": "sha512-vJ+xY93Wv3NhgeriMyIC2oMA+niifOI9XGIqEToIq/rFRoQnXlmO4PSyis/OxBl9hw8OKKC/VcI9CijfFufEkw==", "dev": true, "requires": { "azure-devops-node-api": "^11.0.1", diff --git a/package.json b/package.json index 1d587177..30580136 100644 --- a/package.json +++ b/package.json @@ -286,7 +286,7 @@ "ts-loader": "^9.2.2", "typescript": "^4.3.2", "util": "^0.12.4", - "vsce": "^2.5.0", + "vsce": "^2.5.1", "vscode-test": "^1.6.1", "webpack": "^5.38.1", "webpack-cli": "^4.7.0" From 84bcff93469da71fe85960d584236b3df096cd03 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 12:29:41 -0600 Subject: [PATCH 2/7] Add telemetry for running a job, without any data about the job Only saying that a job was run, nothing about the job. --- package-lock.json | 16 +++++++++++++++- package.json | 5 +++-- src/extension.ts | 12 ++++++++++-- src/utils/runJob.ts | 4 +++- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4a9bc34..3ae34b87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ ], "dependencies": { "axios": "^0.21.4", - "js-md5": "0.7.3" + "js-md5": "0.7.3", + "vscode-extension-telemetry": "^0.4.3" }, "devDependencies": { "@cloudflare/binary-install": "^0.2.0", @@ -4883,6 +4884,14 @@ "semver": "bin/semver" } }, + "node_modules/vscode-extension-telemetry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.4.3.tgz", + "integrity": "sha512-opiIFOaAwyfACYMXByDqFMAlJ2iFMJR65/vIogJ960aLZWp9zaMdwY9CsY02EOYjHxPpjI7QeOQM3sYCb3xtJg==", + "engines": { + "vscode": "^1.60.0" + } + }, "node_modules/vscode-test": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz", @@ -9167,6 +9176,11 @@ } } }, + "vscode-extension-telemetry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.4.3.tgz", + "integrity": "sha512-opiIFOaAwyfACYMXByDqFMAlJ2iFMJR65/vIogJ960aLZWp9zaMdwY9CsY02EOYjHxPpjI7QeOQM3sYCb3xtJg==" + }, "vscode-test": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz", diff --git a/package.json b/package.json index 30580136..c8ff8437 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "local-ci", "displayName": "Local CI", "description": "Debug CircleCI® workflows locally, with Bash access during and after. Free preview, then paid.", - "version": "1.0.2", + "version": "1.1.0", "publisher": "LocalCI", "contributors": [ "Ryan Kienstra" @@ -293,6 +293,7 @@ }, "dependencies": { "axios": "^0.21.4", - "js-md5": "0.7.3" + "js-md5": "0.7.3", + "vscode-extension-telemetry": "^0.4.3" } } diff --git a/src/extension.ts b/src/extension.ts index b9575a35..a435bdf4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,4 +1,5 @@ import * as vscode from 'vscode'; +import TelemetryReporter from 'vscode-extension-telemetry'; import Delayer from './classes/Delayer'; import Job from './classes/Job'; import JobProvider from './classes/JobProvider'; @@ -30,14 +31,21 @@ import runJob from './utils/runJob'; import showLicenseInput from './utils/showLicenseInput'; import writeProcessFile from './utils/writeProcessFile'; +const extensionId = 'LocalCI.local-ci'; +const extensionVersion = '1.1.0'; +const key = ''; + export function activate(context: vscode.ExtensionContext): void { if (!context.globalState.get(TRIAL_STARTED_TIMESTAMP)) { context.globalState.update(TRIAL_STARTED_TIMESTAMP, new Date().getTime()); } const jobProvider = new JobProvider(context); + const reporter = new TelemetryReporter(extensionId, extensionVersion, key); + const reportRunJob = () => reporter.sendTelemetryEvent('runJob'); vscode.window.registerTreeDataProvider(JOB_TREE_VIEW_ID, jobProvider); context.subscriptions.push( + reporter, vscode.commands.registerCommand(`${JOB_TREE_VIEW_ID}.refresh`, () => jobProvider.refresh() ), @@ -131,7 +139,7 @@ export function activate(context: vscode.ExtensionContext): void { jobProvider.refresh(job); } - runJob(context, jobName); + runJob(context, jobName, reportRunJob); } ), vscode.commands.registerCommand(EXIT_JOB_COMMAND, (job: Job) => { @@ -145,7 +153,7 @@ export function activate(context: vscode.ExtensionContext): void { jobProvider.refresh(job); const jobName = job.getJobName(); disposeTerminalsForJob(jobName); - runJob(context, jobName); + runJob(context, jobName, reportRunJob); }), vscode.commands.registerCommand( 'local-ci.debug.repo', diff --git a/src/utils/runJob.ts b/src/utils/runJob.ts index f3597c91..b5b9b71b 100644 --- a/src/utils/runJob.ts +++ b/src/utils/runJob.ts @@ -26,7 +26,8 @@ import uncommittedWarning from './uncommittedWarning'; export default async function runJob( context: vscode.ExtensionContext, - jobName: string + jobName: string, + reportRunJob: () => void ): Promise { const configFilePath = await getConfigFilePath(context); const repoPath = path.dirname(path.dirname(configFilePath)); @@ -41,6 +42,7 @@ export default async function runJob( cwd: repoPath, }); terminal.show(); + reportRunJob(); const processFilePath = getProcessFilePath(configFilePath); const parsedProcessFile = getConfigFromPath(processFilePath); From d60e0659748f0741673f29c67e055a4a35b08c29 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 15:59:22 -0600 Subject: [PATCH 3/7] Add telemetry for activating the extension, and no jobs found Neither send any data, other than the event name. --- CHANGELOG.md | 5 +++++ src/constants/index.ts | 3 +++ src/extension.ts | 14 +++++++++----- src/utils/getJobs.ts | 10 ++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e84b0b50..4076625d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 1.1.0 - 6 December 2021 + +### Added +- Telemetry for activating, running a job, and no jobs. [#50](https://github.com/getlocalci/local-ci/pull/50/) + ## 1.0.2 - 5 December 2021 ### Added diff --git a/src/constants/index.ts b/src/constants/index.ts index 089c0eeb..2be28d3b 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -4,6 +4,8 @@ export const LICENSE_ERROR = 'localCiLicenseKeyError'; export const GET_LICENSE_COMMAND = 'local-ci.license.get'; export const ENTER_LICENSE_COMMAND = 'local-ci.license.enter'; export const EXIT_JOB_COMMAND = 'local-ci.job.exit'; +export const EXTENSION_ID = 'LocalCI.local-ci'; +export const EXTENSION_VERSION = '1.1.0'; // @todo: Look at an alternative, as docker inspect hangs sometimes: https://github.com/docker/for-linux/issues/397 export const GET_CONTAINER_FUNCTION = `get_container() { @@ -55,3 +57,4 @@ export const SCHEDULE_INTERVIEW_URL = export const SUPPRESS_UNCOMMITTED_FILE_WARNING = 'local-ci.suppress-warning.uncommitted'; export const SURVEY_URL = 'https://www.surveymonkey.com/r/localci'; +export const TELEMETRY_KEY = ''; diff --git a/src/extension.ts b/src/extension.ts index a435bdf4..4a6ea866 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -8,12 +8,15 @@ import { COMMITTED_IMAGE_NAMESPACE, ENTER_LICENSE_COMMAND, EXIT_JOB_COMMAND, + EXTENSION_ID, + EXTENSION_VERSION, GET_LICENSE_COMMAND, GET_LICENSE_KEY_URL, HELP_URL, JOB_TREE_VIEW_ID, RUN_JOB_COMMAND, SELECTED_CONFIG_PATH, + TELEMETRY_KEY, TRIAL_STARTED_TIMESTAMP, } from './constants'; import cleanUpCommittedImages from './utils/cleanUpCommittedImages'; @@ -31,16 +34,17 @@ import runJob from './utils/runJob'; import showLicenseInput from './utils/showLicenseInput'; import writeProcessFile from './utils/writeProcessFile'; -const extensionId = 'LocalCI.local-ci'; -const extensionVersion = '1.1.0'; -const key = ''; - export function activate(context: vscode.ExtensionContext): void { if (!context.globalState.get(TRIAL_STARTED_TIMESTAMP)) { context.globalState.update(TRIAL_STARTED_TIMESTAMP, new Date().getTime()); } const jobProvider = new JobProvider(context); - const reporter = new TelemetryReporter(extensionId, extensionVersion, key); + const reporter = new TelemetryReporter( + EXTENSION_ID, + EXTENSION_VERSION, + TELEMETRY_KEY + ); + reporter.sendTelemetryEvent('activate'); const reportRunJob = () => reporter.sendTelemetryEvent('runJob'); vscode.window.registerTreeDataProvider(JOB_TREE_VIEW_ID, jobProvider); diff --git a/src/utils/getJobs.ts b/src/utils/getJobs.ts index 7b59a3e2..80db0658 100644 --- a/src/utils/getJobs.ts +++ b/src/utils/getJobs.ts @@ -1,10 +1,12 @@ import * as vscode from 'vscode'; +import TelemetryReporter from 'vscode-extension-telemetry'; import Job from '../classes/Job'; import Warning from '../classes/Warning'; import Command from '../classes/Command'; import getAllConfigFilePaths from './getAllConfigFilePaths'; import getConfig from './getConfig'; import isWindows from './isWindows'; +import { EXTENSION_ID, EXTENSION_VERSION, TELEMETRY_KEY } from '../constants'; export default async function getJobs( context: vscode.ExtensionContext, @@ -38,6 +40,14 @@ export default async function getJobs( ) : []; + if (!jobs.length) { + new TelemetryReporter( + EXTENSION_ID, + EXTENSION_VERSION, + TELEMETRY_KEY + ).sendTelemetryEvent('noJobs'); + } + return jobs.length ? jobs.map((jobName) => new Job(jobName, jobName === runningJob)) : [ From 617cb28e0c98f1d9d1ba25eaa17abb480ac4b49d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 16:53:01 -0600 Subject: [PATCH 4/7] Add an instrumentation key for AppInsights --- src/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/index.ts b/src/constants/index.ts index 2be28d3b..4435d30a 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -57,4 +57,4 @@ export const SCHEDULE_INTERVIEW_URL = export const SUPPRESS_UNCOMMITTED_FILE_WARNING = 'local-ci.suppress-warning.uncommitted'; export const SURVEY_URL = 'https://www.surveymonkey.com/r/localci'; -export const TELEMETRY_KEY = ''; +export const TELEMETRY_KEY = '90189d4e-b560-4a92-aa2c-5a9df190b66a'; // Microsoft.AppInsights Instrumentation Key. From d7bb5bd6f1b493c9958d7023183d044517eaf61a Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 17:17:23 -0600 Subject: [PATCH 5/7] Add information about telemetry to README.md Also, add to CHANGELOG.md about opting out of telemetry. --- CHANGELOG.md | 2 +- README.md | 10 ++++++++++ src/constants/index.ts | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4076625d..878679e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 1.1.0 - 6 December 2021 ### Added -- Telemetry for activating, running a job, and no jobs. [#50](https://github.com/getlocalci/local-ci/pull/50/) +- Telemetry for activating, running a job, and no jobs, opt out with `"telemetry.enableTelemetry": false`. [#50](https://github.com/getlocalci/local-ci/pull/50/) ## 1.0.2 - 5 December 2021 diff --git a/README.md b/README.md index db8e5397..e54494f2 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,16 @@ If there's more than one `.circleci/config.yml` file, click the gear icon to sel ## Privacy +You can opt out of telemetry by adding this to your VS Code `settings.json`: + +`"telemetry.enableTelemetry": false` + +If you haven't opted out, this will send the following data via [VS Code telemetry](https://code.visualstudio.com/docs/getstarted/telemetry): + +* This extension is activated +* There are no jobs found, like with `.circleci/config.yml` file +* A CircleCI® job is run (but no data about the job, not even the name) + If you haven't entered a license key, like during the free preview, this extension has no interaction with Local CI's site. It does interact with CircleCI® and Docker to process and run the jobs. diff --git a/src/constants/index.ts b/src/constants/index.ts index 4435d30a..0c451cb5 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,11 +1,11 @@ +export const EXTENSION_VERSION = '1.1.0'; +export const EXTENSION_ID = 'LocalCI.local-ci'; export const COMMITTED_IMAGE_NAMESPACE = 'local-ci'; export const SELECTED_CONFIG_PATH = 'local-ci.config.path'; export const LICENSE_ERROR = 'localCiLicenseKeyError'; export const GET_LICENSE_COMMAND = 'local-ci.license.get'; export const ENTER_LICENSE_COMMAND = 'local-ci.license.enter'; export const EXIT_JOB_COMMAND = 'local-ci.job.exit'; -export const EXTENSION_ID = 'LocalCI.local-ci'; -export const EXTENSION_VERSION = '1.1.0'; // @todo: Look at an alternative, as docker inspect hangs sometimes: https://github.com/docker/for-linux/issues/397 export const GET_CONTAINER_FUNCTION = `get_container() { From 6e91946c2d8a587b0141597e12206053a38b5e7c Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 17:25:41 -0600 Subject: [PATCH 6/7] Make a bullet point more clear in telemetry --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e54494f2..7665faf4 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,8 @@ You can opt out of telemetry by adding this to your VS Code `settings.json`: If you haven't opted out, this will send the following data via [VS Code telemetry](https://code.visualstudio.com/docs/getstarted/telemetry): * This extension is activated -* There are no jobs found, like with `.circleci/config.yml` file -* A CircleCI® job is run (but no data about the job, not even the name) +* There are no jobs found, like if there's no `.circleci/config.yml` file +* A CircleCI® job is run (but it sends no data about the job, not even the name) If you haven't entered a license key, like during the free preview, this extension has no interaction with Local CI's site. From f6a4e6bc3d1f3594c4affb74f6397d58fc180c3a Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 5 Dec 2021 17:43:20 -0600 Subject: [PATCH 7/7] Change data to events, as they're only sending events --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7665faf4..bd5fb2d2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ You can opt out of telemetry by adding this to your VS Code `settings.json`: `"telemetry.enableTelemetry": false` -If you haven't opted out, this will send the following data via [VS Code telemetry](https://code.visualstudio.com/docs/getstarted/telemetry): +If you haven't opted out, this will send the following events via [VS Code telemetry](https://code.visualstudio.com/docs/getstarted/telemetry): * This extension is activated * There are no jobs found, like if there's no `.circleci/config.yml` file