@@ -247,25 +247,27 @@ export class TestController {
247247 if ( session . stopIteration ) {
248248 telemetryErrorMessage = getTelemetryReasonDesc ( data . error . uiMessage . replaceAll ( '```' , '' ) )
249249 }
250- telemetry . amazonq_utgGenerateTests . emit ( {
251- cwsprChatProgrammingLanguage : session . fileLanguage ?? 'plaintext' ,
252- jobId : session . listOfTestGenerationJobId [ 0 ] , // For RIV, UTG does only one StartTestGeneration API call
253- jobGroup : session . testGenerationJobGroupName ,
254- requestId : session . startTestGenerationRequestId ,
255- hasUserPromptSupplied : session . hasUserPromptSupplied ,
256- isCodeBlockSelected : session . isCodeBlockSelected ,
257- buildPayloadBytes : session . srcPayloadSize ,
258- buildZipFileBytes : session . srcZipFileSize ,
259- artifactsUploadDuration : session . artifactsUploadDuration ,
260- perfClientLatency : performance . now ( ) - session . testGenerationStartTime ,
261- result : isCancel ? 'Cancelled' : 'Failed' ,
262- reason : data . error . code ,
263- reasonDesc : telemetryErrorMessage ,
264- isSupportedLanguage : true ,
265- credentialStartUrl : AuthUtil . instance . startUrl ,
266- httpStatusCode : data . error . statusCode ?? 0 , // If status code is 0, need to investigate where this is originating from.
267- reason : data . error . code ,
268- } )
250+ TelemetryHelper . instance . sendTestGenerationToolkitEvent (
251+ session ,
252+ true ,
253+ isCancel ? 'Cancelled' : 'Failed' ,
254+ session . startTestGenerationRequestId ,
255+ performance . now ( ) - session . testGenerationStartTime ,
256+ telemetryErrorMessage ,
257+ data . error . statusCode ?? '0' ,
258+ session . isCodeBlockSelected ,
259+ session . artifactsUploadDuration ,
260+ session . srcPayloadSize ,
261+ session . srcZipFileSize ,
262+ session . charsOfCodeAccepted ,
263+ session . numberOfTestsGenerated ,
264+ session . linesOfCodeAccepted ,
265+ session . charsOfCodeGenerated ,
266+ session . numberOfTestsGenerated ,
267+ session . linesOfCodeGenerated ,
268+ data . error . code
269+ )
270+
269271 if ( session . stopIteration ) {
270272 // Error from Science
271273 this . messenger . sendMessage ( data . error . uiMessage . replaceAll ( '```' , '' ) , data . tabID , 'answer' )
@@ -748,29 +750,6 @@ export class TestController {
748750 session . linesOfCodeGenerated
749751 )
750752
751- telemetry . amazonq_utgGenerateTests . emit ( {
752- generatedCount : session . numberOfTestsGenerated ,
753- acceptedCount : session . numberOfTestsGenerated ,
754- generatedCharactersCount : session . charsOfCodeGenerated ,
755- acceptedCharactersCount : session . charsOfCodeAccepted ,
756- generatedLinesCount : session . linesOfCodeGenerated ,
757- acceptedLinesCount : session . linesOfCodeAccepted ,
758- cwsprChatProgrammingLanguage : session . fileLanguage ?? 'plaintext' ,
759- jobId : session . listOfTestGenerationJobId [ 0 ] , // For RIV, UTG does only one StartTestGeneration API call so jobId = session.listOfTestGenerationJobId[0]
760- jobGroup : session . testGenerationJobGroupName ,
761- requestId : session . startTestGenerationRequestId ,
762- buildPayloadBytes : session . srcPayloadSize ,
763- buildZipFileBytes : session . srcZipFileSize ,
764- artifactsUploadDuration : session . artifactsUploadDuration ,
765- hasUserPromptSupplied : session . hasUserPromptSupplied ,
766- isCodeBlockSelected : session . isCodeBlockSelected ,
767- perfClientLatency : session . latencyOfTestGeneration ,
768- isSupportedLanguage : true ,
769- credentialStartUrl : AuthUtil . instance . startUrl ,
770- result : 'Succeeded' ,
771- httpStatusCode : '200' ,
772- } )
773-
774753 await this . endSession ( message , FollowUpTypes . SkipBuildAndFinish )
775754 return
776755
0 commit comments