Skip to content

Commit

Permalink
add more telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless committed Nov 27, 2024
1 parent 0d9e316 commit 63ddcd0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
10 changes: 10 additions & 0 deletions libs/vscode/nx-cloud-view/src/lib/cloud-recent-cipe-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from 'vscode';
import { ActorRef, EventObject } from 'xstate';
import { formatMillis } from './format-time';
import { getTelemetry } from '@nx-console/vscode/telemetry';

abstract class BaseRecentCIPETreeItem extends TreeItem {
abstract type: 'CIPE' | 'runGroup' | 'run' | 'label';
Expand Down Expand Up @@ -325,6 +326,9 @@ export class CloudRecentCIPEProvider extends AbstractTreeProvider<BaseRecentCIPE
if (!treeItem.isCIPETreeItem()) {
return;
}
getTelemetry().logUsage('cloud.view-cipe', {
source: 'cloud-view',
});
commands.executeCommand('vscode.open', treeItem.cipe.cipeUrl);
}
),
Expand All @@ -334,6 +338,9 @@ export class CloudRecentCIPEProvider extends AbstractTreeProvider<BaseRecentCIPE
if (!treeItem.isRunTreeItem()) {
return;
}
getTelemetry().logUsage('cloud.view-run', {
source: 'cloud-view',
});
commands.executeCommand('vscode.open', treeItem.run.runUrl);
}
),
Expand All @@ -344,6 +351,9 @@ export class CloudRecentCIPEProvider extends AbstractTreeProvider<BaseRecentCIPE
return;
}
if (treeItem.cipe.commitUrl) {
getTelemetry().logUsage('cloud.view-cipe-commit', {
source: 'cloud-view',
});
commands.executeCommand('vscode.open', treeItem.cipe.commitUrl);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const pollingMachine = setup({
},
actors: {
getRecentCIPEData: fromPromise(async () => {
console.log(`getting data - ${new Date().toISOString()}`);
return await getRecentCIPEData();
}),
},
Expand Down
8 changes: 6 additions & 2 deletions libs/vscode/nx-cloud-view/src/lib/init-nx-cloud-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,14 @@ function showMessageWithResultAndCommit(
selection: 'View Results' | 'View Commit' | undefined
) => {
if (selection === 'View Results') {
telemetry.logUsage('cloud.view-cipe-results');
telemetry.logUsage('cloud.view-cipe', {
source: 'notification',
});
commands.executeCommand('vscode.open', resultUrl);
} else if (selection === 'View Commit') {
telemetry.logUsage('cloud.view-cipe-commit');
telemetry.logUsage('cloud.view-cipe-commit', {
source: 'notification',
});
commands.executeCommand('vscode.open', commitUrl);
}
};
Expand Down
7 changes: 5 additions & 2 deletions libs/vscode/telemetry/src/lib/telemetry-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export type TelemetryEvents =
| 'cloud.finish-setup'
| 'cloud.show-affected-docs'
| 'cloud.show-cipe-notification'
| 'cloud.view-cipe-results'
| 'cloud.view-cipe'
| 'cloud.view-cipe-commit'
| 'cloud.view-run'
// graph
| 'graph.show-all'
| 'graph.show-affected'
Expand Down Expand Up @@ -63,4 +64,6 @@ export type TelemetryEventSource =
| 'nx-commands-panel'
| 'welcome-view'
| 'migrate-angular-prompt'
| 'editor-toolbar';
| 'editor-toolbar'
| 'notification'
| 'cloud-view';

0 comments on commit 63ddcd0

Please sign in to comment.