Skip to content

Commit

Permalink
Adds command tracking for home
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Jan 14, 2025
1 parent 08af6be commit b0c52f4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/telemetry-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,17 @@ or
}
```

### home/command

> Sent when a Home command is executed
```typescript
{
'command': string,
'webview': string
}
```

### home/createBranch

> Sent when the user chooses to create a branch from the home view
Expand Down
2 changes: 2 additions & 0 deletions src/constants.telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
/** Sent when the user changes the selected tab (mode) on the Graph Details view */
'graphDetails/mode/changed': GraphDetailsModeChangedEvent;

/** Sent when a Home command is executed */
'home/command': CommandEventData;
/** Sent when the new Home view preview is toggled on/off */
'home/preview/toggled': HomePreviewToggledEvent;
/** Sent when the user chooses to create a branch from the home view */
Expand Down
11 changes: 11 additions & 0 deletions src/system/vscode/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export function registerCommand(command: Commands, callback: CommandCallback, th
'context.mode': context?.mode,
'context.submode': context?.submode,
});
} else if (command.startsWith('gitlens.home.')) {
Container.instance.telemetry.sendEvent('home/command', {
command: command,
'context.mode': context?.mode,
'context.submode': context?.submode,
});
}

void Container.instance.usage.track(`command:${command}:executed`).catch();
Expand Down Expand Up @@ -75,6 +81,11 @@ export function registerWebviewCommand(command: Commands, callback: CommandCallb
command: command,
webview: webview ?? '<missing>',
});
} else if (webview === 'gitlens.views.home' || command.startsWith('gitlens.home.')) {
Container.instance.telemetry.sendEvent('home/command', {
command: command,
webview: webview ?? '<missing>',
});
}

void Container.instance.usage.track(`command:${command}:executed`).catch();
Expand Down

0 comments on commit b0c52f4

Please sign in to comment.