Skip to content

Commit 8e266d1

Browse files
committed
fix(amazonqFeatureDev): include telemetry for empty scenario
1 parent 56228d7 commit 8e266d1

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

packages/core/src/amazonqFeatureDev/session/sessionState.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ function registerNewFiles(
5656
fs: VirtualFileSystem,
5757
newFileContents: NewFileZipContents[],
5858
uploadId: string,
59-
workspaceFolders: CurrentWsFolders
59+
workspaceFolders: CurrentWsFolders,
60+
conversationId: string
6061
): NewFileInfo[] {
6162
const result: NewFileInfo[] = []
6263
const workspaceFolderPrefixes = getWorkspaceFoldersByPrefixes(workspaceFolders)
@@ -76,6 +77,10 @@ function registerNewFiles(
7677
Object.values(workspaceFolderPrefixes).find((val) => val.index === 0)?.name ?? ''
7778
]
7879
if (folder === undefined) {
80+
telemetry.amazonq_wsOrphanedDocuments.emit({
81+
amazonqConversationId: conversationId,
82+
credentialStartUrl: AuthUtil.instance.startUrl,
83+
})
7984
getLogger().error(`No workspace folder found for file: ${zipFilePath} and prefix: ${prefix}`)
8085
continue
8186
}
@@ -169,7 +174,13 @@ abstract class CodeGenBase {
169174
case CodeGenerationStatus.COMPLETE: {
170175
const { newFileContents, deletedFiles, references } =
171176
await this.config.proxyClient.exportResultArchive(this.conversationId)
172-
const newFileInfo = registerNewFiles(fs, newFileContents, this.uploadId, workspaceFolders)
177+
const newFileInfo = registerNewFiles(
178+
fs,
179+
newFileContents,
180+
this.uploadId,
181+
workspaceFolders,
182+
this.conversationId
183+
)
173184
telemetry.setNumberOfFilesGenerated(newFileInfo.length)
174185

175186
return {
@@ -356,7 +367,13 @@ export class MockCodeGenState implements SessionState {
356367
zipFilePath: f.zipFilePath,
357368
fileContent: f.fileContent,
358369
}))
359-
this.filePaths = registerNewFiles(action.fs, newFileContents, this.uploadId, this.config.workspaceFolders)
370+
this.filePaths = registerNewFiles(
371+
action.fs,
372+
newFileContents,
373+
this.uploadId,
374+
this.config.workspaceFolders,
375+
this.conversationId
376+
)
360377
this.deletedFiles = [
361378
{
362379
zipFilePath: 'src/this-file-should-be-deleted.ts',

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,20 @@
969969
}
970970
]
971971
},
972+
{
973+
"name": "amazonq_wsOrphanedDocuments",
974+
"description": "LLM generated orphaned documents for workspace scenario. This is useful to track how many times this is reached.",
975+
"unit": "Count",
976+
"metadata": [
977+
{
978+
"type": "amazonqConversationId"
979+
},
980+
{
981+
"type": "credentialStartUrl",
982+
"required": false
983+
}
984+
]
985+
},
972986
{
973987
"name": "amazonq_approachThumbsUp",
974988
"description": "User clicked on the thumbs up button, to mention that they are satisfied",

0 commit comments

Comments
 (0)