Skip to content

Commit d2e3904

Browse files
committed
fix(amazonqFeatureDev): include telemetry for empty scenario
1 parent 00f0303 commit d2e3904

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)
@@ -70,6 +71,10 @@ function registerNewFiles(
7071
workspaceFolderPrefixes === undefined ? '' : zipFilePath.substring(0, zipFilePath.indexOf(path.sep))
7172
const folder = workspaceFolderPrefixes === undefined ? workspaceFolders[0] : workspaceFolderPrefixes[prefix]
7273
if (folder === undefined) {
74+
telemetry.amazonq_wsOrphanedDocuments.emit({
75+
amazonqConversationId: conversationId,
76+
credentialStartUrl: AuthUtil.instance.startUrl,
77+
})
7378
getLogger().error(`No workspace folder found for file: ${zipFilePath} and prefix: ${prefix}`)
7479
continue
7580
}
@@ -161,7 +166,13 @@ abstract class CodeGenBase {
161166
case CodeGenerationStatus.COMPLETE: {
162167
const { newFileContents, deletedFiles, references } =
163168
await this.config.proxyClient.exportResultArchive(this.conversationId)
164-
const newFileInfo = registerNewFiles(fs, newFileContents, this.uploadId, workspaceFolders)
169+
const newFileInfo = registerNewFiles(
170+
fs,
171+
newFileContents,
172+
this.uploadId,
173+
workspaceFolders,
174+
this.conversationId
175+
)
165176
telemetry.setNumberOfFilesGenerated(newFileInfo.length)
166177

167178
return {
@@ -348,7 +359,13 @@ export class MockCodeGenState implements SessionState {
348359
zipFilePath: f.zipFilePath,
349360
fileContent: f.fileContent,
350361
}))
351-
this.filePaths = registerNewFiles(action.fs, newFileContents, this.uploadId, this.config.workspaceFolders)
362+
this.filePaths = registerNewFiles(
363+
action.fs,
364+
newFileContents,
365+
this.uploadId,
366+
this.config.workspaceFolders,
367+
this.conversationId
368+
)
352369
this.deletedFiles = [
353370
{
354371
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
@@ -944,6 +944,20 @@
944944
}
945945
]
946946
},
947+
{
948+
"name": "amazonq_wsOrphanedDocuments",
949+
"description": "LLM generated orphaned documents for workspace scenario. This is useful to track how many times this is reached.",
950+
"unit": "Count",
951+
"metadata": [
952+
{
953+
"type": "amazonqConversationId"
954+
},
955+
{
956+
"type": "credentialStartUrl",
957+
"required": false
958+
}
959+
]
960+
},
947961
{
948962
"name": "amazonq_approachThumbsUp",
949963
"description": "User clicked on the thumbs up button, to mention that they are satisfied",

0 commit comments

Comments
 (0)