Skip to content

Commit d697f44

Browse files
authored
telemetry(amazonq dev): track empty path file scenario aws#5625
## Problem When customer use workspaces to generate files, RTS and LLM cannot decide which folder to deliver the generated file. We're for now tracking how many times we reach for accountability and prioritization. ## Solution Add telemetry to count and save the conversationIds that reach this specific workspace usage. PS: This is only included in VS Code since the Workspaces capability is only used here.
1 parent 78c448b commit d697f44

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q /dev: include telemetry for workspace usage when generating new files"
4+
}

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ function registerNewFiles(
6161
fs: VirtualFileSystem,
6262
newFileContents: NewFileZipContents[],
6363
uploadId: string,
64-
workspaceFolders: CurrentWsFolders
64+
workspaceFolders: CurrentWsFolders,
65+
conversationId: string
6566
): NewFileInfo[] {
6667
const result: NewFileInfo[] = []
6768
const workspaceFolderPrefixes = getWorkspaceFoldersByPrefixes(workspaceFolders)
@@ -81,6 +82,12 @@ function registerNewFiles(
8182
Object.values(workspaceFolderPrefixes).find((val) => val.index === 0)?.name ?? ''
8283
]
8384
if (folder === undefined) {
85+
telemetry.toolkit_trackScenario.emit({
86+
count: 1,
87+
amazonqConversationId: conversationId,
88+
credentialStartUrl: AuthUtil.instance.startUrl,
89+
scenario: 'wsOrphanedDocuments',
90+
})
8491
getLogger().error(`No workspace folder found for file: ${zipFilePath} and prefix: ${prefix}`)
8592
continue
8693
}
@@ -174,7 +181,13 @@ abstract class CodeGenBase {
174181
case CodeGenerationStatus.COMPLETE: {
175182
const { newFileContents, deletedFiles, references } =
176183
await this.config.proxyClient.exportResultArchive(this.conversationId)
177-
const newFileInfo = registerNewFiles(fs, newFileContents, this.uploadId, workspaceFolders)
184+
const newFileInfo = registerNewFiles(
185+
fs,
186+
newFileContents,
187+
this.uploadId,
188+
workspaceFolders,
189+
this.conversationId
190+
)
178191
telemetry.setNumberOfFilesGenerated(newFileInfo.length)
179192

180193
return {
@@ -378,7 +391,13 @@ export class MockCodeGenState implements SessionState {
378391
zipFilePath: f.zipFilePath,
379392
fileContent: f.fileContent,
380393
}))
381-
this.filePaths = registerNewFiles(action.fs, newFileContents, this.uploadId, this.config.workspaceFolders)
394+
this.filePaths = registerNewFiles(
395+
action.fs,
396+
newFileContents,
397+
this.uploadId,
398+
this.config.workspaceFolders,
399+
this.conversationId
400+
)
382401
this.deletedFiles = [
383402
{
384403
zipFilePath: 'src/this-file-should-be-deleted.ts',

0 commit comments

Comments
 (0)