Skip to content

Commit 99eb8a3

Browse files
authored
Log duration of normal sessions (#1188)
1 parent d2c3ed2 commit 99eb8a3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/extension.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi
4343
initRecommendations(context);
4444
initDaemon(context);
4545

46+
activatedTimestamp = Date.now();
4647
if(context.storageUri) {
4748
const javaWorkspaceStoragePath = path.join(context.storageUri.fsPath, "..", "redhat.java");
4849
cleanJavaWorkspaceIndicator = path.join(javaWorkspaceStoragePath, "jdt_ws", ".cleanWorkspace");
49-
activatedTimestamp = Date.now();
5050
}
5151

5252
context.subscriptions.push(vscode.languages.registerCodeActionsProvider({ scheme: "file", language: "java", pattern: "**/*.java" }, new CodeActionProvider()));
@@ -100,14 +100,15 @@ function initializeTelemetry(_context: vscode.ExtensionContext) {
100100
}
101101

102102
export async function deactivate() {
103+
const now = Date.now();
104+
const data = {
105+
name: "sessionStatus",
106+
timestamp: now.toString(),
107+
time: now - activatedTimestamp
108+
}
103109
if (cleanJavaWorkspaceIndicator && fs.existsSync(cleanJavaWorkspaceIndicator)) {
104-
const now = Date.now();
105-
106-
sendInfo("", {
107-
name: "cleanJavaLSWorkspace",
108-
timestamp: now.toString(),
109-
time: now - activatedTimestamp
110-
});
110+
data.name = "cleanJavaLSWorkspace";
111111
}
112+
sendInfo("", data);
112113
await disposeTelemetryWrapper();
113114
}

0 commit comments

Comments
 (0)