Skip to content

Commit 970fee0

Browse files
authored
telemetry(amazonq): Adding requestId to telemetry if UTG fails at StartTestGeneration API (#5327)
* Adding requestId if UTG fails at StartTestGeneration API due to validation exception. * Minor edits
1 parent d1006f6 commit 970fee0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import kotlinx.coroutines.CoroutineScope
1616
import kotlinx.coroutines.Job
1717
import kotlinx.coroutines.delay
1818
import kotlinx.coroutines.launch
19+
import software.amazon.awssdk.core.exception.SdkServiceException
1920
import software.amazon.awssdk.services.codewhispererruntime.model.GetTestGenerationResponse
2021
import software.amazon.awssdk.services.codewhispererruntime.model.Range
2122
import software.amazon.awssdk.services.codewhispererruntime.model.StartTestGenerationResponse
@@ -144,6 +145,11 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
144145
} catch (e: Exception) {
145146
LOG.error(e) { "Unexpected error while creating test generation job" }
146147
val errorMessage = getTelemetryErrorMessage(e, CodeWhispererConstants.FeatureName.TEST_GENERATION)
148+
149+
// Sending requestId to telemetry if there is Validation Exception
150+
if (e is SdkServiceException) {
151+
session.startTestGenerationRequestId = e.requestId()
152+
}
147153
throw CodeTestException(
148154
"CreateTestJobError: $errorMessage",
149155
"CreateTestJobError",

0 commit comments

Comments
 (0)