From 80e8a7f224a82b59168b8e9e1c29ecad92b1084f Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Thu, 11 Jan 2024 14:53:24 -0500 Subject: [PATCH] add telemetry events for editing connection --- src/telemetry/telemetryService.ts | 2 ++ src/views/webviewController.ts | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/telemetry/telemetryService.ts b/src/telemetry/telemetryService.ts index 94f62688e..97c0f84f3 100644 --- a/src/telemetry/telemetryService.ts +++ b/src/telemetry/telemetryService.ts @@ -105,6 +105,8 @@ export enum TelemetryEventTypes { EXTENSION_LINK_CLICKED = 'Link Clicked', EXTENSION_COMMAND_RUN = 'Command Run', NEW_CONNECTION = 'New Connection', + CONNECTION_EDITED = 'Connection Edited', + OPEN_EDIT_CONNECTION = 'Open Edit Connection', PLAYGROUND_SAVED = 'Playground Saved', PLAYGROUND_LOADED = 'Playground Loaded', DOCUMENT_UPDATED = 'Document Updated', diff --git a/src/views/webviewController.ts b/src/views/webviewController.ts index 0bef29b4d..d067e9b54 100644 --- a/src/views/webviewController.ts +++ b/src/views/webviewController.ts @@ -16,6 +16,7 @@ import { openLink } from '../utils/linkHelper'; import type { StorageController } from '../storage'; import type TelemetryService from '../telemetry/telemetryService'; import { getFeatureFlagsScript } from '../featureFlags'; +import { TelemetryEventTypes } from '../telemetry/telemetryService'; const log = createLogger('webview controller'); @@ -156,6 +157,7 @@ export default class WebviewController { this._connectionController.cancelConnectionAttempt(); return; case MESSAGE_TYPES.EDIT_AND_CONNECT_CONNECTION: + this._telemetryService.track(TelemetryEventTypes.CONNECTION_EDITED); await this._connectionController.updateConnectionAndConnect({ connectionId: message.connectionId, connectionOptions: message.connectionOptions, @@ -257,7 +259,11 @@ export default class WebviewController { context: vscode.ExtensionContext; }) => { const webviewPanel = this.openWebview(context); + + // Wait for the panel to open. await new Promise((resolve) => setTimeout(resolve, 200)); + this._telemetryService.track(TelemetryEventTypes.OPEN_EDIT_CONNECTION); + void webviewPanel.webview.postMessage({ command: MESSAGE_TYPES.OPEN_EDIT_CONNECTION, connection,