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 all 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
}
24 changes: 21 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,11 @@ function registerNewFiles(
workspaceFolderPrefixes === undefined ? '' : zipFilePath.substring(0, zipFilePath.indexOf(path.sep))
const folder = workspaceFolderPrefixes === undefined ? workspaceFolders[0] : workspaceFolderPrefixes[prefix]
if (folder === undefined) {
telemetry.amazonq_trackScenarioCountUsage.emit({
amazonqConversationId: conversationId,
credentialStartUrl: AuthUtil.instance.startUrl,
scenarioType: 'wsOrphanedDocuments',
})
getLogger().error(`No workspace folder found for file: ${zipFilePath} and prefix: ${prefix}`)
continue
}
Expand Down Expand Up @@ -161,7 +167,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 +360,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
25 changes: 25 additions & 0 deletions packages/core/src/shared/telemetry/vscodeTelemetry.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@
"name": "totalFiles",
"type": "int",
"description": "The total number of files being sent to Amazon Q"
},
{
"name": "scenarioType",
"type": "string",
"allowedValues": ["wsOrphanedDocuments"],
"description": "Scenarios to count in telemetry"
}
],
"metrics": [
Expand Down Expand Up @@ -939,6 +945,25 @@
}
]
},
{
"name": "amazonq_trackScenarioCountUsage",
"description": "Count how many times a scenario is reached.",
"unit": "Count",
"metadata": [
{
"type": "amazonqConversationId",
"required": true
},
{
"type": "credentialStartUrl",
"required": false
},
{
"type": "scenarioType",
"required": true
}
]
},
{
"name": "amazonq_approachThumbsUp",
"description": "User clicked on the thumbs up button, to mention that they are satisfied",
Expand Down
Loading