Skip to content

Commit 06b3725

Browse files
authored
telemetry(amazonq): Adding requestId for uploadArtifactToS3 in amazonq_utgGenerateTests event (aws#6598)
## Problem - IDE does not emit requestId if it fails at `uploadArtifactToS3` in `/test` ## Solution - Added requestId for Test Generation without impacting the `/review` - `requestId` is stored in /test session and emits if something fails in the test generation workflow. - Helps in debugging the root cause for the `UploadTestArtifactToS3Error: "PUT" request failed with code "403"` error in RTS logs. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d9b9861 commit 06b3725

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/core/src/codewhisperer/service/securityScanHandler.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ import {
3939
SecurityScanTimedOutError,
4040
UploadArtifactToS3Error,
4141
} from '../models/errors'
42-
import { getTelemetryReasonDesc } from '../../shared/errors'
42+
import { getTelemetryReasonDesc, isAwsError } from '../../shared/errors'
4343
import { CodeWhispererSettings } from '../util/codewhispererSettings'
4444
import { detectCommentAboveLine } from '../../shared/utilities/commentUtils'
4545
import { runtimeLanguageContext } from '../util/runtimeLanguageContext'
4646
import { FeatureUseCase } from '../models/constants'
4747
import { UploadTestArtifactToS3Error } from '../../amazonqTest/error'
48+
import { ChatSessionManager } from '../../amazonqTest/chat/storages/chatSession'
4849

4950
export async function listScanResults(
5051
client: DefaultCodeWhispererClient,
@@ -386,6 +387,9 @@ export async function uploadArtifactToS3(
386387
} else {
387388
errorMessage = errorDesc ?? defaultMessage
388389
}
390+
if (isAwsError(error) && featureUseCase === FeatureUseCase.TEST_GENERATION) {
391+
ChatSessionManager.Instance.getSession().startTestGenerationRequestId = error.requestId
392+
}
389393
throw isCodeScan ? new UploadArtifactToS3Error(errorMessage) : new UploadTestArtifactToS3Error(errorMessage)
390394
}
391395
}

0 commit comments

Comments
 (0)