Record telemetry for cache operation duration

This commit is contained in:
Henry Mercer 2024-12-03 18:05:27 +00:00
parent 93f3303766
commit 7bcf845de9
5 changed files with 17 additions and 6 deletions

View file

@ -550,7 +550,7 @@ export const downloadCodeQL = async function (
? toolcacheInfo.path
: getTempExtractionDir(tempDir);
const statusReport = await downloadAndExtract(
let statusReport = await downloadAndExtract(
codeqlURL,
extractedBundlePath,
authorization,
@ -585,11 +585,16 @@ export const downloadCodeQL = async function (
toolcacheInfo.version,
);
const cacheDurationMs = performance.now() - toolcacheStart;
logger.info(
`Added CodeQL bundle to the tool cache (${formatDuration(
performance.now() - toolcacheStart,
cacheDurationMs,
)}).`,
);
statusReport = {
...statusReport,
cacheDurationMs,
};
// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
if (codeqlFolder !== extractedBundlePath) {