Skip to content

Commit 3afc0cb

Browse files
amungerpierceboggan
authored andcommitted
send telemetry from EH as well (#507)
* send telemetry from EH as well * send to GH endpoint
1 parent a1e6425 commit 3afc0cb

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

src/extension/conversation/vscode-node/userActions.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,6 @@ export class UserFeedbackService implements IUserFeedbackService {
150150
});
151151
}
152152

153-
const outcomes = new Map([
154-
[vscode.ChatEditingSessionActionOutcome.Accepted, 'accepted'],
155-
[vscode.ChatEditingSessionActionOutcome.Rejected, 'rejected'],
156-
[vscode.ChatEditingSessionActionOutcome.Saved, 'saved']
157-
]);
158-
159153
/* __GDPR__
160154
"panel.edit.feedback" : {
161155
"owner": "joyceerhl",
@@ -191,6 +185,32 @@ export class UserFeedbackService implements IUserFeedbackService {
191185
}
192186
}
193187
break;
188+
case 'chatEditingHunkAction': {
189+
const outcome = outcomes.get(e.action.outcome);
190+
if (outcome) {
191+
192+
const properties = {
193+
requestId: result.metadata?.responseId ?? '',
194+
languageId: document?.languageId ?? '',
195+
outcome,
196+
};
197+
const measurements = {
198+
hasRemainingEdits: e.action.hasRemainingEdits ? 1 : 0,
199+
isNotebook: this.notebookService.hasSupportedNotebooks(e.action.uri) ? 1 : 0,
200+
isNotebookCell: e.action.uri.scheme === Schemas.vscodeNotebookCell ? 1 : 0,
201+
lineCount: e.action.lineCount
202+
};
203+
204+
sendUserActionTelemetry(
205+
this.telemetryService,
206+
document ?? vscode.window.activeTextEditor?.document,
207+
properties,
208+
measurements,
209+
'edit.hunk.action'
210+
);
211+
}
212+
break;
213+
}
194214
}
195215

196216
if (e.action.kind === 'copy' || e.action.kind === 'insert') {
@@ -554,3 +574,9 @@ function reportInlineEditSurvivalEvent(res: EditSurvivalResult, sharedProps: Tel
554574
didBranchChange: res.didBranchChange ? 1 : 0,
555575
});
556576
}
577+
578+
const outcomes = new Map([
579+
[vscode.ChatEditingSessionActionOutcome.Accepted, 'accepted'],
580+
[vscode.ChatEditingSessionActionOutcome.Rejected, 'rejected'],
581+
[vscode.ChatEditingSessionActionOutcome.Saved, 'saved']
582+
]);

src/extension/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,15 @@ declare module 'vscode' {
480480
outcome: ChatEditingSessionActionOutcome;
481481
}
482482

483+
export interface ChatEditingHunkAction {
484+
// eslint-disable-next-line local/vscode-dts-string-type-literals
485+
kind: 'chatEditingHunkAction';
486+
uri: Uri;
487+
hasRemainingEdits: boolean;
488+
outcome: ChatEditingHunkActionOutcome;
489+
lineCount: number;
490+
}
491+
483492
export enum ChatEditingSessionActionOutcome {
484493
Accepted = 1,
485494
Rejected = 2,
@@ -488,7 +497,7 @@ declare module 'vscode' {
488497

489498
export interface ChatUserActionEvent {
490499
readonly result: ChatResult;
491-
readonly action: ChatCopyAction | ChatInsertAction | ChatApplyAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction | ChatEditorAction | ChatEditingSessionAction;
500+
readonly action: ChatCopyAction | ChatInsertAction | ChatApplyAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction | ChatEditorAction | ChatEditingSessionAction | ChatEditingHunkAction;
492501
}
493502

494503
export interface ChatPromptReference {

0 commit comments

Comments
 (0)