From b570897bbcbba12ce993b71a102d3a11a7a11294 Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Mon, 27 Dec 2021 17:29:54 +0000 Subject: [PATCH] Add telemetry for getting started --- src/vs/gitpod/node/gitpodInsightsAppender.ts | 36 +++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/vs/gitpod/node/gitpodInsightsAppender.ts b/src/vs/gitpod/node/gitpodInsightsAppender.ts index e034d172007d5..a1bbadd51f5c2 100644 --- a/src/vs/gitpod/node/gitpodInsightsAppender.ts +++ b/src/vs/gitpod/node/gitpodInsightsAppender.ts @@ -19,7 +19,7 @@ import * as WebSocket from 'ws'; import { ConsoleLogger, listen as doListen } from 'vscode-ws-jsonrpc'; import * as grpc from '@grpc/grpc-js'; import * as util from 'util'; -import { mixin } from 'vs/base/common/objects'; +import { filter, mixin } from 'vs/base/common/objects'; class SupervisorConnection { readonly deadlines = { @@ -161,9 +161,10 @@ export class GitpodInsightsAppender implements ITelemetryAppender { this._withAIClient((aiClient) => { data = mixin(data, this._defaultData); data = validateTelemetryData(data); - const gitpodTrackEvent = mapTelemetryData(eventName, data.properties); - if (gitpodTrackEvent) { - aiClient.trackEvent(gitpodTrackEvent); + const mappedEvent = mapTelemetryData(eventName, data.properties); + if (mappedEvent) { + mappedEvent.properties = filter(mappedEvent.properties, (_, v) => v !== undefined && v !== null); + aiClient.trackEvent(mappedEvent); } }); } @@ -328,6 +329,33 @@ function mapTelemetryData(eventName: string, data: any): RemoteTrackMessage | un timestamp: data.timestamp }, }; + case 'gettingStarted.ActionExecuted': + return { + event: 'vscode_getting_started', + properties: { + kind: 'action_executed', + command: data.command, + argument: data.argument, + workspaceId: data.workspaceId, + workspaceInstanceId: data.workspaceInstanceId, + sessionID: data.sessionID, + timestamp: data.timestamp + }, + }; + case 'editorClosed': + if ((data.typeId) !== 'workbench.editors.gettingStartedInput') { + return undefined; + } + return { + event: 'vscode_getting_started', + properties: { + kind: 'editor_closed', + workspaceId: data.workspaceId, + workspaceInstanceId: data.workspaceInstanceId, + sessionID: data.sessionID, + timestamp: data.timestamp + }, + }; } return undefined;