Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telemetry(dev): add tracking for empty path file scenario #5625

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
tverney marked this conversation as resolved.
Show resolved Hide resolved
}
23 changes: 20 additions & 3 deletions packages/core/src/amazonqFeatureDev/session/sessionState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 @@ -70,6 +71,10 @@ function registerNewFiles(
workspaceFolderPrefixes === undefined ? '' : zipFilePath.substring(0, zipFilePath.indexOf(path.sep))
const folder = workspaceFolderPrefixes === undefined ? workspaceFolders[0] : workspaceFolderPrefixes[prefix]
if (folder === undefined) {
telemetry.amazonq_wsOrphanedDocuments.emit({
tverney marked this conversation as resolved.
Show resolved Hide resolved
amazonqConversationId: conversationId,
credentialStartUrl: AuthUtil.instance.startUrl,
})
getLogger().error(`No workspace folder found for file: ${zipFilePath} and prefix: ${prefix}`)
continue
}
Expand Down Expand Up @@ -161,7 +166,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 @@ -348,7 +359,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
14 changes: 14 additions & 0 deletions packages/core/src/shared/telemetry/vscodeTelemetry.json
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,20 @@
}
]
},
{
"name": "amazonq_wsOrphanedDocuments",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to my other comment, can we move this to the common definition in https://github.com/aws/aws-toolkit-common

Copy link
Contributor Author

@tverney tverney Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll add there and then import here. Should I expect soon we remove then the generate part from vs code and just use from the common?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@tverney tverney Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpinkney-aws should we merge common first or can I already include here those changes?

"description": "LLM generated orphaned documents for workspace scenario. This is useful to track how many times this is reached.",
"unit": "Count",
"metadata": [
{
"type": "amazonqConversationId"
},
{
"type": "credentialStartUrl",
"required": false
}
]
},
{
"name": "amazonq_approachThumbsUp",
"description": "User clicked on the thumbs up button, to mention that they are satisfied",
Expand Down
Loading