Skip to content

Commit ac29b7c

Browse files
committed
Adds metrics for AI functionality
1 parent 50edcb6 commit ac29b7c

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/constants.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,15 @@ export type TelemetryEvents = {
12841284
/** Sent when a VS Code command is executed by a GitLens provided action */
12851285
'command/core': { command: string };
12861286

1287+
/** Sent when explaining changes from */
1288+
explainChanges: {
1289+
changeType: 'wip' | 'stash' | 'commit' | `draft-${'patch' | 'stash' | 'suggested_pr_change'}`;
1290+
};
1291+
1292+
generateDraftMessage: {
1293+
draftType: 'patch' | 'stash' | 'suggested_pr_change';
1294+
};
1295+
12871296
/** Sent when the user takes an action on a launchpad item */
12881297
'launchpad/title/action': LaunchpadEventData & {
12891298
action: 'feedback' | 'open-on-gkdev' | 'refresh' | 'settings';

src/plus/webviews/patchDetails/patchDetailsWebview.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,14 @@ export class PatchDetailsWebviewProvider
822822
if (summary == null) throw new Error('Error retrieving content');
823823

824824
params = { summary: summary };
825+
826+
this.container.telemetry.sendEvent(
827+
'explainChanges',
828+
{
829+
changeType: `draft-${this._context.draft.type}`,
830+
},
831+
{ source: 'patchDetails' },
832+
);
825833
} catch (ex) {
826834
debugger;
827835
params = { error: { message: ex.message } };
@@ -864,6 +872,14 @@ export class PatchDetailsWebviewProvider
864872
if (summary == null) throw new Error('Error retrieving content');
865873

866874
params = extractDraftMessage(summary);
875+
876+
this.container.telemetry.sendEvent(
877+
'generateDraftMessage',
878+
{
879+
draftType: 'patch',
880+
},
881+
{ source: 'patchDetails' },
882+
);
867883
} catch (ex) {
868884
debugger;
869885
params = { error: { message: ex.message } };

src/webviews/commitDetails/commitDetailsWebview.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,14 @@ export class CommitDetailsWebviewProvider
10861086
if (summary == null) throw new Error('Error retrieving content');
10871087

10881088
params = { summary: summary };
1089+
1090+
this.container.telemetry.sendEvent(
1091+
'explainChanges',
1092+
{
1093+
changeType: isStash(this._context.commit) ? 'stash' : 'commit',
1094+
},
1095+
{ source: 'inspect' },
1096+
);
10891097
} catch (ex) {
10901098
debugger;
10911099
params = { error: { message: ex.message } };
@@ -1120,6 +1128,14 @@ export class CommitDetailsWebviewProvider
11201128
if (summary == null) throw new Error('Error retrieving content');
11211129

11221130
params = extractDraftMessage(summary);
1131+
1132+
this.container.telemetry.sendEvent(
1133+
'generateDraftMessage',
1134+
{
1135+
draftType: 'suggested_pr_change',
1136+
},
1137+
{ source: 'inspect' },
1138+
);
11231139
} catch (ex) {
11241140
debugger;
11251141
params = { error: { message: ex.message } };

0 commit comments

Comments
 (0)