Skip to content

Commit 7bcf845

Browse files
committed
Record telemetry for cache operation duration
1 parent 93f3303 commit 7bcf845

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

lib/setup-codeql.js

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-download.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/setup-codeql.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ export const downloadCodeQL = async function (
550550
? toolcacheInfo.path
551551
: getTempExtractionDir(tempDir);
552552

553-
const statusReport = await downloadAndExtract(
553+
let statusReport = await downloadAndExtract(
554554
codeqlURL,
555555
extractedBundlePath,
556556
authorization,
@@ -585,11 +585,16 @@ export const downloadCodeQL = async function (
585585
toolcacheInfo.version,
586586
);
587587

588+
const cacheDurationMs = performance.now() - toolcacheStart;
588589
logger.info(
589590
`Added CodeQL bundle to the tool cache (${formatDuration(
590-
performance.now() - toolcacheStart,
591+
cacheDurationMs,
591592
)}).`,
592593
);
594+
statusReport = {
595+
...statusReport,
596+
cacheDurationMs,
597+
};
593598

594599
// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
595600
if (codeqlFolder !== extractedBundlePath) {

src/tools-download.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ type ToolsDownloadDurations =
7373
| StreamedToolsDownloadDurations;
7474

7575
export type ToolsDownloadStatusReport = {
76+
cacheDurationMs?: number;
7677
compressionMethod: tar.CompressionMethod;
7778
toolsUrl: string;
7879
zstdFailureReason?: string;

0 commit comments

Comments
 (0)