Skip to content

Commit 5af3acb

Browse files
akosyakovjeanp413
authored andcommitted
[analytics] correct vscode_session attributes
- generate session id, otheriwse it is stubbed by dummy value - rename id to session id to avoid conflicts with segment id - add instance id to correlates with logs and other analytics
1 parent 6f53005 commit 5af3acb

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

extensions/gitpod-remote/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,4 @@
229229
"gitpod-shared": "0.0.1",
230230
"vscode-nls": "^5.0.0"
231231
}
232-
}
232+
}

extensions/gitpod-shared/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"@types/node": "^10.12.21",
16+
"@types/uuid": "^8.3.1",
1617
"@types/ws": "^7.2.6"
1718
},
1819
"dependencies": {
@@ -21,6 +22,7 @@
2122
"bufferutil": "^4.0.1",
2223
"reconnecting-websocket": "^4.4.0",
2324
"utf-8-validate": "^5.0.2",
25+
"uuid": "^8.3.1",
2426
"vscode-nls": "^5.0.0",
2527
"ws": "^7.3.1",
2628
"yaml": "^1.10.0"

extensions/gitpod-shared/src/extension.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import * as vscode from 'vscode';
66
import { createGitpodExtensionContext, GitpodExtensionContext, registerDefaultLayout, registerNotifications, registerWorkspaceCommands, registerWorkspaceSharing, registerWorkspaceTimeout } from './features';
7-
import { performance } from 'perf_hooks';
7+
import * as uuid from 'uuid';
88

99
export { GitpodExtensionContext, SupervisorConnection, registerTasks } from './features';
1010
export * from './gitpod-plugin-model';
@@ -41,9 +41,11 @@ function registerUsageAnalytics(context: GitpodExtensionContext): void {
4141
if (context.devMode && vscode.env.uiKind === vscode.UIKind.Web) {
4242
return;
4343
}
44+
const sessionId = uuid.v4();
4445
const properties = {
45-
id: vscode.env.sessionId,
46+
sessionId,
4647
workspaceId: context.info.getWorkspaceId(),
48+
instanceId: context.info.getInstanceId(),
4749
appName: vscode.env.appName,
4850
uiKind: vscode.env.uiKind === vscode.UIKind.Web ? 'web' : 'desktop',
4951
devMode: context.devMode,
@@ -53,7 +55,7 @@ function registerUsageAnalytics(context: GitpodExtensionContext): void {
5355
event: 'vscode_session',
5456
properties: {
5557
...properties,
56-
timestamp: performance.now(),
58+
timestamp: Date.now(),
5759
focused: vscode.window.state.focused,
5860
phase,
5961
}

extensions/gitpod-shared/src/features.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ export async function registerTasks(context: GitpodExtensionContext, createTermi
724724
{
725725
name: taskTerminal.getTitle(),
726726
pty,
727-
iconPath: new vscode.ThemeIcon('tools')
727+
iconPath: new vscode.ThemeIcon('terminal')
728728
},
729729
parentTerminal
730730
);

extensions/gitpod-web/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,7 @@
441441
"dependencies": {
442442
"gitpod-shared": "0.0.1",
443443
"node-fetch": "^2.6.1",
444-
"uuid": "^8.3.1",
445444
"vscode-jsonrpc": "^5.0.1",
446445
"vscode-nls": "^5.0.0"
447446
}
448-
}
447+
}

extensions/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@
103103
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.1.tgz#83ecf4ec22a8c218c71db25f316619fe5b986011"
104104
integrity sha512-7cTXwKP/HLOPVgjg+YhBdQ7bMiobGMuoBmrGmqwIWJv8elC6t1DfVc/mn4fD9UE1IjhwmhaQ5pGVXkmXbH0rhg==
105105

106+
"@types/uuid@^8.3.1":
107+
version "8.3.1"
108+
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.1.tgz#1a32969cf8f0364b3d8c8af9cc3555b7805df14f"
109+
integrity sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==
110+
106111
"@types/ws@^7.2.6":
107112
version "7.4.7"
108113
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702"

0 commit comments

Comments
 (0)