Skip to content

Commit 97ddf57

Browse files
authored
fix(amazonq security scan): avoid project scan timeouts #5183
Problem: - VSC triggers `getDirSize()` function to calculate `codeScanProjectBytes` for telemetry for `Project scans`. Solution: - Removing the `codeScanProjectBytes` calculation for `Project-scans`: Since the `codeScanProjectBytes` parameter is optional and is affecting the performance of CreatePayload. This will help improve the overall performance of the Auto-scans.
1 parent cb603ed commit 97ddf57

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Security Scan: Fixes an issue where project-scans time out for larger projects."
4+
}

packages/core/src/codewhisperer/commands/startSecurityScan.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
CodeScanTelemetryEntry,
3030
} from '../models/model'
3131
import { cancel, ok } from '../../shared/localizedText'
32-
import { getDirSize } from '../../shared/filesystemUtilities'
3332
import { telemetry } from '../../shared/telemetry/telemetry'
3433
import { isAwsError } from '../../shared/errors'
3534
import { openUrl } from '../../shared/utilities/vsCodeUtils'
@@ -288,16 +287,6 @@ export async function emitCodeScanTelemetry(
288287
scope: CodeWhispererConstants.CodeAnalysisScope
289288
) {
290289
codeScanTelemetryEntry.codewhispererCodeScanProjectBytes = 0
291-
const now = performance.now()
292-
if (scope === CodeWhispererConstants.CodeAnalysisScope.PROJECT) {
293-
for (const folder of vscode.workspace.workspaceFolders ?? []) {
294-
codeScanTelemetryEntry.codewhispererCodeScanProjectBytes += await getDirSize(
295-
folder.uri.fsPath,
296-
now,
297-
CodeWhispererConstants.projectSizeCalculateTimeoutSeconds * 1000
298-
)
299-
}
300-
}
301290
telemetry.codewhisperer_securityScan.emit({
302291
...codeScanTelemetryEntry,
303292
passive: codeScanTelemetryEntry.codewhispererCodeScanScope === CodeAnalysisScope.FILE,

0 commit comments

Comments
 (0)