Skip to content

Commit

Permalink
add telemetry events for editing connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Anemy committed Jan 11, 2024
1 parent 5deb989 commit 80e8a7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/telemetry/telemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions src/views/webviewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 80e8a7f

Please sign in to comment.