Add telemetry for time spent extracting CodeQL bundle
This commit is contained in:
parent
5c02493ebf
commit
50357f5d12
21 changed files with 190 additions and 99 deletions
28
lib/setup-codeql.js
generated
28
lib/setup-codeql.js
generated
|
|
@ -393,22 +393,25 @@ const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVe
|
|||
const finalHeaders = Object.assign({ "User-Agent": "CodeQL Action" }, headers);
|
||||
const toolsDownloadStart = perf_hooks_1.performance.now();
|
||||
const archivedBundlePath = await toolcache.downloadTool(codeqlURL, dest, authorization, finalHeaders);
|
||||
const toolsDownloadDurationMs = Math.round(perf_hooks_1.performance.now() - toolsDownloadStart);
|
||||
logger.debug(`Finished downloading CodeQL bundle to ${archivedBundlePath} (${toolsDownloadDurationMs} ms).`);
|
||||
const downloadDurationMs = Math.round(perf_hooks_1.performance.now() - toolsDownloadStart);
|
||||
logger.debug(`Finished downloading CodeQL bundle to ${archivedBundlePath} (${downloadDurationMs} ms).`);
|
||||
logger.debug("Extracting CodeQL bundle.");
|
||||
const extractionStart = perf_hooks_1.performance.now();
|
||||
const extractedBundlePath = await toolcache.extractTar(archivedBundlePath);
|
||||
const extractionMs = Math.round(perf_hooks_1.performance.now() - extractionStart);
|
||||
logger.debug(`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionMs} ms).`);
|
||||
const extractionDurationMs = Math.round(perf_hooks_1.performance.now() - extractionStart);
|
||||
logger.debug(`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionDurationMs} ms).`);
|
||||
await cleanUpGlob(archivedBundlePath, "CodeQL bundle archive", logger);
|
||||
const bundleVersion = maybeBundleVersion ?? tryGetBundleVersionFromUrl(codeqlURL, logger);
|
||||
if (bundleVersion === undefined) {
|
||||
logger.debug("Could not cache CodeQL tools because we could not determine the bundle version from the " +
|
||||
`URL ${codeqlURL}.`);
|
||||
return {
|
||||
toolsVersion: maybeCliVersion ?? "unknown",
|
||||
codeqlFolder: extractedBundlePath,
|
||||
toolsDownloadDurationMs,
|
||||
statusReport: {
|
||||
downloadDurationMs,
|
||||
extractionDurationMs,
|
||||
},
|
||||
toolsVersion: maybeCliVersion ?? "unknown",
|
||||
};
|
||||
}
|
||||
logger.debug("Caching CodeQL bundle.");
|
||||
|
|
@ -419,9 +422,12 @@ const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVe
|
|||
await cleanUpGlob(extractedBundlePath, "CodeQL bundle from temporary directory", logger);
|
||||
}
|
||||
return {
|
||||
toolsVersion: maybeCliVersion ?? toolcacheVersion,
|
||||
codeqlFolder: toolcachedBundlePath,
|
||||
toolsDownloadDurationMs,
|
||||
statusReport: {
|
||||
downloadDurationMs,
|
||||
extractionDurationMs,
|
||||
},
|
||||
toolsVersion: maybeCliVersion ?? toolcacheVersion,
|
||||
};
|
||||
};
|
||||
exports.downloadCodeQL = downloadCodeQL;
|
||||
|
|
@ -471,7 +477,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, logger);
|
||||
let codeqlFolder;
|
||||
let toolsVersion = source.toolsVersion;
|
||||
let toolsDownloadDurationMs;
|
||||
let toolsDownloadStatusReport;
|
||||
let toolsSource;
|
||||
switch (source.sourceType) {
|
||||
case "local":
|
||||
|
|
@ -487,14 +493,14 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.bundleVersion, source.cliVersion, apiDetails, tempDir, logger);
|
||||
toolsVersion = result.toolsVersion;
|
||||
codeqlFolder = result.codeqlFolder;
|
||||
toolsDownloadDurationMs = result.toolsDownloadDurationMs;
|
||||
toolsDownloadStatusReport = result.statusReport;
|
||||
toolsSource = ToolsSource.Download;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
util.assertNever(source);
|
||||
}
|
||||
return { codeqlFolder, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
||||
return { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion };
|
||||
}
|
||||
async function cleanUpGlob(glob, name, logger) {
|
||||
logger.debug(`Cleaning up ${name}.`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue