Skip to content

Commit

Permalink
Record telemetry for cache operation duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Dec 3, 2024
1 parent 93f3303 commit 7bcf845
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
9 changes: 7 additions & 2 deletions lib/setup-codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tools-download.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ export const downloadCodeQL = async function (
? toolcacheInfo.path
: getTempExtractionDir(tempDir);

const statusReport = await downloadAndExtract(
let statusReport = await downloadAndExtract(
codeqlURL,
extractedBundlePath,
authorization,
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/tools-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type ToolsDownloadDurations =
| StreamedToolsDownloadDurations;

export type ToolsDownloadStatusReport = {
cacheDurationMs?: number;
compressionMethod: tar.CompressionMethod;
toolsUrl: string;
zstdFailureReason?: string;
Expand Down

0 comments on commit 7bcf845

Please sign in to comment.