From 46de10c8e409744ad16d2b0234be48f2a9ab6042 Mon Sep 17 00:00:00 2001 From: Ashish Reddy Podduturi Date: Wed, 8 Jan 2025 15:51:54 -0800 Subject: [PATCH] Adding Telemetry metric for files out of workspace scope. --- package.json | 2 +- .../amazonqTest/chat/controller/controller.ts | 18 +++- .../chat/controller/messenger/messenger.ts | 5 +- .../src/codewhisperer/util/telemetryHelper.ts | 2 + packages/toolkit/package.json | 83 +++++++++---------- 5 files changed, 60 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index cb669449f9d..e14641a45c4 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "mergeReports": "ts-node ./scripts/mergeReports.ts" }, "devDependencies": { - "@aws-toolkits/telemetry": "^1.0.289", + "@aws-toolkits/telemetry": "^1.0.293", "@playwright/browser-chromium": "^1.43.1", "@stylistic/eslint-plugin": "^2.11.0", "@types/he": "^1.2.3", diff --git a/packages/core/src/amazonqTest/chat/controller/controller.ts b/packages/core/src/amazonqTest/chat/controller/controller.ts index 35e234cc01a..2f8a40e9492 100644 --- a/packages/core/src/amazonqTest/chat/controller/controller.ts +++ b/packages/core/src/amazonqTest/chat/controller/controller.ts @@ -246,6 +246,7 @@ export class TestController { TelemetryHelper.instance.sendTestGenerationToolkitEvent( session, true, + true, isCancel ? 'Cancelled' : 'Failed', session.startTestGenerationRequestId, performance.now() - session.testGenerationStartTime, @@ -456,7 +457,14 @@ export class TestController { unsupportedMessage = `I'm sorry, but /test only supports Python and Java
I will still generate a suggestion below.` } this.messenger.sendMessage(unsupportedMessage, tabID, 'answer') - await this.onCodeGeneration(session, message.prompt, tabID, fileName, filePath) + await this.onCodeGeneration( + session, + message.prompt, + tabID, + fileName, + filePath, + workspaceFolder !== undefined + ) } else { this.messenger.sendCapabilityCard({ tabID }) this.messenger.sendMessage(testGenSummaryMessage(fileName), message.tabID, 'answer-part') @@ -722,6 +730,7 @@ export class TestController { TelemetryHelper.instance.sendTestGenerationToolkitEvent( session, true, + true, 'Succeeded', session.startTestGenerationRequestId, session.latencyOfTestGeneration, @@ -799,7 +808,8 @@ export class TestController { message: string, tabID: string, fileName: string, - filePath: string + filePath: string, + fileInWorkspace: boolean ) { try { // TODO: Write this entire gen response to basiccommands and call here. @@ -827,7 +837,8 @@ export class TestController { tabID, randomUUID.toString(), triggerPayload, - fileName + fileName, + fileInWorkspace ) } finally { this.messenger.sendChatInputEnabled(tabID, true) @@ -843,6 +854,7 @@ export class TestController { TelemetryHelper.instance.sendTestGenerationToolkitEvent( session, true, + true, 'Succeeded', session.startTestGenerationRequestId, session.latencyOfTestGeneration, diff --git a/packages/core/src/amazonqTest/chat/controller/messenger/messenger.ts b/packages/core/src/amazonqTest/chat/controller/messenger/messenger.ts index 10b496b69d3..da47074acc2 100644 --- a/packages/core/src/amazonqTest/chat/controller/messenger/messenger.ts +++ b/packages/core/src/amazonqTest/chat/controller/messenger/messenger.ts @@ -183,7 +183,8 @@ export class Messenger { tabID: string, triggerID: string, triggerPayload: TriggerPayload, - fileName: string + fileName: string, + fileInWorkspace: boolean ) { let message = '' let messageId = response.$metadata.requestId ?? '' @@ -277,6 +278,7 @@ export class Messenger { TelemetryHelper.instance.sendTestGenerationToolkitEvent( session, false, + fileInWorkspace, 'Cancelled', messageId, performance.now() - session.testGenerationStartTime, @@ -291,6 +293,7 @@ export class Messenger { TelemetryHelper.instance.sendTestGenerationToolkitEvent( session, false, + fileInWorkspace, 'Succeeded', messageId, performance.now() - session.testGenerationStartTime diff --git a/packages/core/src/codewhisperer/util/telemetryHelper.ts b/packages/core/src/codewhisperer/util/telemetryHelper.ts index 6505e248f28..a6b5e0e6d98 100644 --- a/packages/core/src/codewhisperer/util/telemetryHelper.ts +++ b/packages/core/src/codewhisperer/util/telemetryHelper.ts @@ -61,6 +61,7 @@ export class TelemetryHelper { public sendTestGenerationToolkitEvent( session: Session, isSupportedLanguage: boolean, + isFileInWorkspace: boolean, result: 'Succeeded' | 'Failed' | 'Cancelled', requestId?: string, perfClientLatency?: number, @@ -81,6 +82,7 @@ export class TelemetryHelper { cwsprChatProgrammingLanguage: session.fileLanguage ?? 'plaintext', hasUserPromptSupplied: session.hasUserPromptSupplied, isSupportedLanguage: isSupportedLanguage, + isFileInWorkspace: isFileInWorkspace, result: result, artifactsUploadDuration: artifactsUploadDuration, buildPayloadBytes: buildPayloadBytes, diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index b93cd063334..ee916f4ffbe 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -4128,277 +4128,270 @@ "fontCharacter": "\\f1b9" } }, - "aws-amazonq-transform-landing-page-icon": { - "description": "AWS Contributed Icon", - "default": { - "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1ba" - } - }, "aws-amazonq-transform-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bb" + "fontCharacter": "\\f1ba" } }, "aws-amazonq-transform-step-into-dark": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bc" + "fontCharacter": "\\f1bb" } }, "aws-amazonq-transform-step-into-light": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bd" + "fontCharacter": "\\f1bc" } }, "aws-amazonq-transform-variables-dark": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1be" + "fontCharacter": "\\f1bd" } }, "aws-amazonq-transform-variables-light": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1bf" + "fontCharacter": "\\f1be" } }, "aws-applicationcomposer-icon": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c0" + "fontCharacter": "\\f1bf" } }, "aws-applicationcomposer-icon-dark": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c1" + "fontCharacter": "\\f1c0" } }, "aws-apprunner-service": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c2" + "fontCharacter": "\\f1c1" } }, "aws-cdk-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c3" + "fontCharacter": "\\f1c2" } }, "aws-cloudformation-stack": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c4" + "fontCharacter": "\\f1c3" } }, "aws-cloudwatch-log-group": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c5" + "fontCharacter": "\\f1c4" } }, "aws-codecatalyst-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c6" + "fontCharacter": "\\f1c5" } }, "aws-codewhisperer-icon-black": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c7" + "fontCharacter": "\\f1c6" } }, "aws-codewhisperer-icon-white": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c8" + "fontCharacter": "\\f1c7" } }, "aws-codewhisperer-learn": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1c9" + "fontCharacter": "\\f1c8" } }, "aws-ecr-registry": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1ca" + "fontCharacter": "\\f1c9" } }, "aws-ecs-cluster": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cb" + "fontCharacter": "\\f1ca" } }, "aws-ecs-container": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cc" + "fontCharacter": "\\f1cb" } }, "aws-ecs-service": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cd" + "fontCharacter": "\\f1cc" } }, "aws-generic-attach-file": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1ce" + "fontCharacter": "\\f1cd" } }, "aws-iot-certificate": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1cf" + "fontCharacter": "\\f1ce" } }, "aws-iot-policy": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d0" + "fontCharacter": "\\f1cf" } }, "aws-iot-thing": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d1" + "fontCharacter": "\\f1d0" } }, "aws-lambda-function": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d2" + "fontCharacter": "\\f1d1" } }, "aws-mynah-MynahIconBlack": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d3" + "fontCharacter": "\\f1d2" } }, "aws-mynah-MynahIconWhite": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d4" + "fontCharacter": "\\f1d3" } }, "aws-mynah-logo": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d5" + "fontCharacter": "\\f1d4" } }, "aws-redshift-cluster": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d6" + "fontCharacter": "\\f1d5" } }, "aws-redshift-cluster-connected": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d7" + "fontCharacter": "\\f1d6" } }, "aws-redshift-database": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d8" + "fontCharacter": "\\f1d7" } }, "aws-redshift-redshift-cluster-connected": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1d9" + "fontCharacter": "\\f1d8" } }, "aws-redshift-schema": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1da" + "fontCharacter": "\\f1d9" } }, "aws-redshift-table": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1db" + "fontCharacter": "\\f1da" } }, "aws-s3-bucket": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1dc" + "fontCharacter": "\\f1db" } }, "aws-s3-create-bucket": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1dd" + "fontCharacter": "\\f1dc" } }, "aws-schemas-registry": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1de" + "fontCharacter": "\\f1dd" } }, "aws-schemas-schema": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1df" + "fontCharacter": "\\f1de" } }, "aws-stepfunctions-preview": { "description": "AWS Contributed Icon", "default": { "fontPath": "./resources/fonts/aws-toolkit-icons.woff", - "fontCharacter": "\\f1e0" + "fontCharacter": "\\f1df" } } },