Skip to content

Commit 9ee3138

Browse files
committed
Sends telemetry event when an issue is opened in web browser
(#3774, #3775)
1 parent c778a86 commit 9ee3138

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

docs/telemetry-events.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,19 @@ void
13581358
}
13591359
```
13601360

1361+
### startWork/issue/action
1362+
1363+
> Sent when the user takes an action on a StartWork issue
1364+
1365+
```typescript
1366+
{
1367+
'instance': number,
1368+
'type': 'branch' | 'branch-worktree' | 'issue' | 'issue-worktree',
1369+
'items.count': number,
1370+
'action': 'soft-open'
1371+
}
1372+
```
1373+
13611374
### startWork/issue/chosen
13621375

13631376
> Sent when the user chooses an issue to start work in the second step

src/constants.telemetry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ export type TelemetryEvents = {
324324
connected: boolean;
325325
type: StartWorkType;
326326
};
327+
/** Sent when the user takes an action on a StartWork issue */
328+
'startWork/issue/action': StartWorkEventData & {
329+
action: 'soft-open';
330+
connected: boolean;
331+
} & Partial<Record<`item.${string}`, string | number | boolean>>;
327332
/** Sent when the user chooses an issue to start work in the second step */
328333
'startWork/issue/chosen': StartWorkEventData & {
329334
connected: boolean;

src/plus/startWork/startWork.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ export class StartWorkCommand extends QuickCommand<State> {
507507
switch (button) {
508508
case OpenOnGitHubQuickInputButton:
509509
case OpenOnJiraQuickInputButton:
510+
this.sendItemActionTelemetry('soft-open', item, state, context);
510511
this.open(item);
511512
return undefined;
512513
default:
@@ -529,6 +530,35 @@ export class StartWorkCommand extends QuickCommand<State> {
529530
void openUrl(item.item.issue.url);
530531
}
531532

533+
private sendItemActionTelemetry(
534+
action: 'soft-open',
535+
item: StartWorkItem,
536+
state: StepState<State>,
537+
context: Context,
538+
) {
539+
this.container.telemetry.sendEvent(
540+
'startWork/issue/action',
541+
{
542+
...context.telemetryContext!,
543+
action: action,
544+
connected: true,
545+
type: state.type,
546+
'item.id': getStartWorkItemIdHash(item),
547+
'item.type': item.item.issue.type,
548+
'item.provider': item.item.issue.provider.id,
549+
'item.assignees.count': item.item.issue.assignees?.length ?? undefined,
550+
'item.createdDate': item.item.issue.createdDate.getTime(),
551+
'item.updatedDate': item.item.issue.updatedDate.getTime(),
552+
553+
'item.comments.count': item.item.issue.commentsCount ?? undefined,
554+
'item.upvotes.count': item.item.issue.thumbsUpCount ?? undefined,
555+
556+
'item.issue.state': item.item.issue.state,
557+
},
558+
this.source,
559+
);
560+
}
561+
532562
private async getConnectedIntegrations(): Promise<Map<SupportedStartWorkIntegrationIds, boolean>> {
533563
const connected = new Map<SupportedStartWorkIntegrationIds, boolean>();
534564
await Promise.allSettled(

0 commit comments

Comments
 (0)