Address review comments from @henrymercer

This commit is contained in:
Edoardo Pirovano 2022-08-16 13:30:49 +01:00
parent 4139682b64
commit b29194f0ac
No known key found for this signature in database
GPG key ID: 047556B5D93FFE28
12 changed files with 95 additions and 58 deletions

View file

@ -24,7 +24,7 @@ import {
runInit,
} from "./init";
import { Language } from "./languages";
import { getActionsLogger } from "./logging";
import { getActionsLogger, Logger } from "./logging";
import { parseRepositoryNwo } from "./repository";
import { getTotalCacheSize } from "./trap-caching";
import {
@ -68,7 +68,7 @@ interface InitSuccessStatusReport extends StatusReportBase {
workflow_languages: string;
/** Comma-separated list of languages for which we are using TRAP caching. */
trap_cache_languages: string;
/** Size of TRAP caches that we downloaded, in megabytes. */
/** Size of TRAP caches that we downloaded, in bytes. */
trap_cache_download_size_bytes: number;
/** Time taken to download TRAP caches, in milliseconds. */
trap_cache_download_duration_ms: number;
@ -77,7 +77,8 @@ interface InitSuccessStatusReport extends StatusReportBase {
async function sendSuccessStatusReport(
startedAt: Date,
config: configUtils.Config,
toolsVersion: string
toolsVersion: string,
logger: Logger
) {
const statusReportBase = await createStatusReportBase(
"init",
@ -123,7 +124,10 @@ async function sendSuccessStatusReport(
tools_resolved_version: toolsVersion,
workflow_languages: workflowLanguages || "",
trap_cache_languages: Object.keys(config.trapCaches).join(","),
trap_cache_download_size_bytes: await getTotalCacheSize(config.trapCaches),
trap_cache_download_size_bytes: await getTotalCacheSize(
config.trapCaches,
logger
),
trap_cache_download_duration_ms: config.trapCacheDownloadTime,
};
@ -308,7 +312,7 @@ async function run() {
);
return;
}
await sendSuccessStatusReport(startedAt, config, toolsVersion);
await sendSuccessStatusReport(startedAt, config, toolsVersion, logger);
}
async function getTrapCachingEnabled(