From 0905e664ac4fb6715a482db011a468a571393f1d Mon Sep 17 00:00:00 2001 From: Paula Stachova Date: Thu, 22 Aug 2024 13:34:01 +0200 Subject: [PATCH 1/2] fix: add telemetry events for survey VSCODE-595 --- src/mdbExtensionController.ts | 11 ++++++++++- src/telemetry/telemetryService.ts | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/mdbExtensionController.ts b/src/mdbExtensionController.ts index 78b9cb741..7b3a7df77 100644 --- a/src/mdbExtensionController.ts +++ b/src/mdbExtensionController.ts @@ -33,7 +33,9 @@ import launchMongoShell from './commands/launchMongoShell'; import type SchemaTreeItem from './explorer/schemaTreeItem'; import { StatusView } from './views'; import { StorageController, StorageVariables } from './storage'; -import TelemetryService from './telemetry/telemetryService'; +import TelemetryService, { + TelemetryEventTypes, +} from './telemetry/telemetryService'; import type PlaygroundsTreeItem from './explorer/playgroundsTreeItem'; import PlaygroundResultProvider from './editors/playgroundResultProvider'; import WebviewController from './views/webviewController'; @@ -845,6 +847,13 @@ export default class MDBExtensionController implements vscode.Disposable { ); if (result?.title === action) { void vscode.env.openExternal(vscode.Uri.parse(link)); + this._telemetryService.track(TelemetryEventTypes.SURVEY_CLICKED, { + survey_id: surveyId, + }); + } else { + this._telemetryService.track(TelemetryEventTypes.SURVEY_DISMISSED, { + survey_id: surveyId, + }); } // whether action was taken or the prompt dismissed, we won't show this again diff --git a/src/telemetry/telemetryService.ts b/src/telemetry/telemetryService.ts index a38b55a89..f3bcb1bf4 100644 --- a/src/telemetry/telemetryService.ts +++ b/src/telemetry/telemetryService.ts @@ -77,6 +77,10 @@ type ConnectionEditedTelemetryEventProperties = { success: boolean; }; +type SurveyActionProperties = { + survey_id: string; +}; + type SavedConnectionsLoadedProperties = { // Total number of connections saved on disk saved_connections: number; @@ -102,7 +106,8 @@ export type TelemetryEventProperties = | PlaygroundSavedTelemetryEventProperties | PlaygroundLoadedTelemetryEventProperties | KeytarSecretsMigrationFailedProperties - | SavedConnectionsLoadedProperties; + | SavedConnectionsLoadedProperties + | SurveyActionProperties; export enum TelemetryEventTypes { PLAYGROUND_CODE_EXECUTED = 'Playground Code Executed', @@ -120,6 +125,8 @@ export enum TelemetryEventTypes { PLAYGROUND_CREATED = 'Playground Created', KEYTAR_SECRETS_MIGRATION_FAILED = 'Keytar Secrets Migration Failed', SAVED_CONNECTIONS_LOADED = 'Saved Connections Loaded', + SURVEY_CLICKED = 'Survey link clicked', + SURVEY_DISMISSED = 'Survey prompt dismissed', } /** From c96155b9b0e1d8c5ad90dd22f0b9ab03e29a62c2 Mon Sep 17 00:00:00 2001 From: Paula Stachova Date: Thu, 22 Aug 2024 13:44:45 +0200 Subject: [PATCH 2/2] chore: update comment --- src/mdbExtensionController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mdbExtensionController.ts b/src/mdbExtensionController.ts index 7b3a7df77..2a6391f25 100644 --- a/src/mdbExtensionController.ts +++ b/src/mdbExtensionController.ts @@ -825,7 +825,7 @@ export default class MDBExtensionController implements vscode.Disposable { this._storageController.get(StorageVariables.GLOBAL_SURVEY_SHOWN) === surveyId; - // Show the overview page when it hasn't been show to the + // Show the survey when it hasn't been show to the // user yet, and they have saved connections // -> they haven't just started using this extension if (