Skip to content

Commit

Permalink
Add telemetry for getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 committed Apr 5, 2022
1 parent b90f35a commit fd94f1a
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/vs/gitpod/node/gitpodInsightsAppender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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);
}
});
}
Expand Down Expand Up @@ -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 ((<string>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;
Expand Down

0 comments on commit fd94f1a

Please sign in to comment.