From cb8f9155a05d6a10ccd538f5808cd09755bc8b06 Mon Sep 17 00:00:00 2001 From: laileni Date: Fri, 7 Mar 2025 14:26:58 -0800 Subject: [PATCH 1/4] Adding status field to UTG telemetry events --- .../amazonqCodeTest/CodeWhispererUTGChatManager.kt | 4 +++- .../controller/CodeTestChatController.kt | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt index 8b02c019c21..37cb29a65bf 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt @@ -55,6 +55,7 @@ import software.aws.toolkits.jetbrains.utils.isQConnected import software.aws.toolkits.resources.message import software.aws.toolkits.telemetry.AmazonqTelemetry import software.aws.toolkits.telemetry.MetricResult +import software.aws.toolkits.telemetry.Status import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.File @@ -583,7 +584,8 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin artifactsUploadDuration = session.artifactUploadDuration, buildPayloadBytes = session.srcPayloadSize, buildZipFileBytes = session.srcZipFileSize, - requestId = session.startTestGenerationRequestId + requestId = session.startTestGenerationRequestId, + status = if (e.message == message("testgen.message.cancelled")) Status.CANCELLED else Status.FAILED, ) session.isGeneratingTests = false } finally { diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt index 2807e2cf9c2..d380bbc368c 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt @@ -98,6 +98,7 @@ import software.aws.toolkits.telemetry.AmazonqTelemetry import software.aws.toolkits.telemetry.FeatureId import software.aws.toolkits.telemetry.InteractionType import software.aws.toolkits.telemetry.MetricResult +import software.aws.toolkits.telemetry.Status import software.aws.toolkits.telemetry.UiTelemetry import java.io.File import java.nio.file.Files @@ -310,7 +311,8 @@ class CodeTestChatController( credentialStartUrl = getStartUrl(project), result = MetricResult.Succeeded, perfClientLatency = (Instant.now().toEpochMilli() - session.startTimeOfTestGeneration), - requestId = id + requestId = id, + status = Status.ACCEPTED, ) } session.isGeneratingTests = false @@ -682,7 +684,8 @@ class CodeTestChatController( artifactsUploadDuration = session.artifactUploadDuration, buildPayloadBytes = session.srcPayloadSize, buildZipFileBytes = session.srcZipFileSize, - requestId = session.startTestGenerationRequestId + requestId = session.startTestGenerationRequestId, + status = Status.ACCEPTED, ) codeTestChatHelper.addAnswer( CodeTestChatMessageContent( @@ -878,7 +881,8 @@ class CodeTestChatController( artifactsUploadDuration = session.artifactUploadDuration, buildPayloadBytes = session.srcPayloadSize, buildZipFileBytes = session.srcZipFileSize, - requestId = session.startTestGenerationRequestId + requestId = session.startTestGenerationRequestId, + status = Status.REJECTED, ) sessionCleanUp(message.tabId) } From 5b06b08f47a98d6834947a38e4b4793ff776e146 Mon Sep 17 00:00:00 2001 From: laileni Date: Mon, 10 Mar 2025 18:13:31 -0700 Subject: [PATCH 2/4] Adding Feedback mechanism V2 version --- .../CodeWhispererUTGChatManager.kt | 15 +++++- .../controller/CodeTestChatController.kt | 54 ++++++++++++++++--- .../mynah-ui/ui/apps/codeTestChatConnector.ts | 17 +++++- .../src/mynah-ui/ui/forms/constants.ts | 1 + .../ui/feedback/TestGenFeedbackDialog.kt | 25 +++++++++ .../resources/MessagesBundle.properties | 3 ++ 6 files changed, 104 insertions(+), 11 deletions(-) create mode 100644 plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/ui/feedback/TestGenFeedbackDialog.kt diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt index 37cb29a65bf..89490b2c073 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt @@ -559,12 +559,23 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin e is JsonParseException -> message("testgen.error.generic_technical_error_message") else -> message("testgen.error.generic_error_message") } - + val buttonList = mutableListOf