Skip to content

Commit d6336e4

Browse files
authored
feat(telemetry): include user intent for copy and insert code interactions (#5654)
## Problem Need to gather acceptance metrics on generated unit tests ## Solution Include user intent on copy and insert code interactions in telemetry to form an acceptance rate --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 00f0303 commit d6336e4

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export class ChatController {
249249
CodeWhispererTracker.getTracker().enqueue({
250250
conversationID: this.telemetryHelper.getConversationId(message.tabID) ?? '',
251251
messageID: message.messageId,
252+
userIntent: message.userIntent,
252253
time: new Date(),
253254
fileUrl: editor.document.uri,
254255
startPosition: cursorStart,

packages/core/src/codewhispererChat/controllers/chat/model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface InsertCodeAtCursorPosition {
3939
command: string | undefined
4040
tabID: string
4141
messageId: string
42+
userIntent: UserIntent | undefined
4243
code: string
4344
insertionTargetType: string | undefined
4445
codeReference: CodeReference[] | undefined
@@ -51,6 +52,7 @@ export interface CopyCodeToClipboard {
5152
command: string | undefined
5253
tabID: string
5354
messageId: string
55+
userIntent: UserIntent | undefined
5456
code: string
5557
insertionTargetType: string | undefined
5658
codeReference: CodeReference[] | undefined
@@ -148,6 +150,7 @@ export interface TriggerPayload {
148150
export interface InsertedCode {
149151
readonly conversationID: string
150152
readonly messageID: string
153+
readonly userIntent: UserIntent | undefined
151154
readonly time: Date
152155
readonly fileUrl: vscode.Uri
153156
readonly startPosition: vscode.Position

packages/core/src/codewhispererChat/controllers/chat/telemetryHelper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class CWCTelemetryHelper {
158158
cwsprChatConversationId: conversationId ?? '',
159159
credentialStartUrl: AuthUtil.instance.startUrl,
160160
cwsprChatMessageId: message.messageId,
161+
cwsprChatUserIntent: this.getUserIntentForTelemetry(message.userIntent),
161162
cwsprChatInteractionType: 'insertAtCursor',
162163
cwsprChatAcceptedCharactersLength: message.code.length,
163164
cwsprChatAcceptedNumberOfLines: message.code.split('\n').length,
@@ -175,6 +176,7 @@ export class CWCTelemetryHelper {
175176
cwsprChatConversationId: conversationId ?? '',
176177
credentialStartUrl: AuthUtil.instance.startUrl,
177178
cwsprChatMessageId: message.messageId,
179+
cwsprChatUserIntent: this.getUserIntentForTelemetry(message.userIntent),
178180
cwsprChatInteractionType: 'copySnippet',
179181
cwsprChatAcceptedCharactersLength: message.code.length,
180182
cwsprChatInteractionTarget: message.insertionTargetType,

packages/core/src/codewhispererChat/view/messages/messageListener.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export class UIMessageListener {
152152
command: msg.command,
153153
tabID: msg.tabID,
154154
messageId: msg.messageId,
155+
userIntent: msg.userIntent,
155156
code: msg.code,
156157
insertionTargetType: msg.insertionTargetType,
157158
codeReference: msg.codeReference,
@@ -166,6 +167,7 @@ export class UIMessageListener {
166167
command: msg.command,
167168
tabID: msg.tabID,
168169
messageId: msg.messageId,
170+
userIntent: msg.userIntent,
169171
code: msg.code,
170172
insertionTargetType: msg.insertionTargetType,
171173
codeReference: msg.codeReference,

packages/core/src/shared/telemetry/vscodeTelemetry.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,10 @@
821821
{
822822
"type": "cwsprChatMessageId"
823823
},
824+
{
825+
"type": "cwsprChatUserIntent",
826+
"required": false
827+
},
824828
{
825829
"type": "cwsprChatInteractionType"
826830
},

0 commit comments

Comments
 (0)