Skip to content

Commit

Permalink
telemetry(amazonq dev): track empty path file scenario #5625
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
tverney authored Oct 9, 2024
1 parent 78c448b commit d697f44
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Amazon Q /dev: include telemetry for workspace usage when generating new files"
}
25 changes: 22 additions & 3 deletions packages/core/src/amazonqFeatureDev/session/sessionState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function registerNewFiles(
fs: VirtualFileSystem,
newFileContents: NewFileZipContents[],
uploadId: string,
workspaceFolders: CurrentWsFolders
workspaceFolders: CurrentWsFolders,
conversationId: string
): NewFileInfo[] {
const result: NewFileInfo[] = []
const workspaceFolderPrefixes = getWorkspaceFoldersByPrefixes(workspaceFolders)
Expand All @@ -81,6 +82,12 @@ function registerNewFiles(
Object.values(workspaceFolderPrefixes).find((val) => val.index === 0)?.name ?? ''
]
if (folder === undefined) {
telemetry.toolkit_trackScenario.emit({
count: 1,
amazonqConversationId: conversationId,
credentialStartUrl: AuthUtil.instance.startUrl,
scenario: 'wsOrphanedDocuments',
})
getLogger().error(`No workspace folder found for file: ${zipFilePath} and prefix: ${prefix}`)
continue
}
Expand Down Expand Up @@ -174,7 +181,13 @@ abstract class CodeGenBase {
case CodeGenerationStatus.COMPLETE: {
const { newFileContents, deletedFiles, references } =
await this.config.proxyClient.exportResultArchive(this.conversationId)
const newFileInfo = registerNewFiles(fs, newFileContents, this.uploadId, workspaceFolders)
const newFileInfo = registerNewFiles(
fs,
newFileContents,
this.uploadId,
workspaceFolders,
this.conversationId
)
telemetry.setNumberOfFilesGenerated(newFileInfo.length)

return {
Expand Down Expand Up @@ -378,7 +391,13 @@ export class MockCodeGenState implements SessionState {
zipFilePath: f.zipFilePath,
fileContent: f.fileContent,
}))
this.filePaths = registerNewFiles(action.fs, newFileContents, this.uploadId, this.config.workspaceFolders)
this.filePaths = registerNewFiles(
action.fs,
newFileContents,
this.uploadId,
this.config.workspaceFolders,
this.conversationId
)
this.deletedFiles = [
{
zipFilePath: 'src/this-file-should-be-deleted.ts',
Expand Down

0 comments on commit d697f44

Please sign in to comment.