Skip to content

Commit 781f89e

Browse files
authored
send firstCompletionDisplayLatency in multiple reject cases (#7821)
## Problem ## Solution --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent fceeae7 commit 781f89e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/amazonq/src/app/inline/EditRendering/displayImage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ export async function displaySvgDecoration(
352352
discarded: false,
353353
},
354354
},
355+
totalSessionDisplayTime: Date.now() - session.requestStartTime,
356+
firstCompletionDisplayLatency: session.firstCompletionDisplayLatency,
355357
isInlineEdit: true,
356358
}
357359
languageClient.sendNotification('aws/logInlineCompletionSessionResults', params)

packages/amazonq/src/app/inline/completion.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ export class InlineCompletionManager implements Disposable {
170170
const onInlineRejection = async () => {
171171
try {
172172
vsCodeState.isCodeWhispererEditing = true
173-
if (this.sessionManager.getActiveSession() === undefined) {
173+
const session = this.sessionManager.getActiveSession()
174+
if (session === undefined) {
174175
return
175176
}
176-
const requestStartTime = this.sessionManager.getActiveSession()!.requestStartTime
177+
const requestStartTime = session.requestStartTime
177178
const totalSessionDisplayTime = performance.now() - requestStartTime
178179
await commands.executeCommand('editor.action.inlineSuggest.hide')
179180
// TODO: also log the seen state for other suggestions in session
@@ -182,9 +183,9 @@ export class InlineCompletionManager implements Disposable {
182183
CodeWhispererConstants.platformLanguageIds,
183184
this.inlineCompletionProvider
184185
)
185-
const sessionId = this.sessionManager.getActiveSession()?.sessionId
186+
const sessionId = session.sessionId
186187
const itemId = this.sessionManager.getActiveRecommendation()[0]?.itemId
187-
if (!sessionId || !itemId) {
188+
if (!itemId) {
188189
return
189190
}
190191
const params: LogInlineCompletionSessionResultsParams = {
@@ -196,6 +197,7 @@ export class InlineCompletionManager implements Disposable {
196197
discarded: false,
197198
},
198199
},
200+
firstCompletionDisplayLatency: session.firstCompletionDisplayLatency,
199201
totalSessionDisplayTime: totalSessionDisplayTime,
200202
}
201203
this.languageClient.sendNotification(this.logSessionResultMessageName, params)
@@ -343,6 +345,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
343345
discarded: !prevSession.displayed,
344346
},
345347
},
348+
firstCompletionDisplayLatency: prevSession.firstCompletionDisplayLatency,
346349
totalSessionDisplayTime: performance.now() - prevSession.requestStartTime,
347350
}
348351
this.languageClient.sendNotification(this.logSessionResultMessageName, params)

0 commit comments

Comments
 (0)