mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Move download telemetry into the status-report directory
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
46
lib/entry-points.js
generated
46
lib/entry-points.js
generated
@@ -147625,28 +147625,6 @@ async function sendStatusReport(statusReport) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function createInitToolsDownloadFields(report, toolsFeatureFlagsValid) {
|
|
||||||
const fields = {};
|
|
||||||
if (report?.downloadDurationMs !== void 0) {
|
|
||||||
fields.tools_download_duration_ms = report.downloadDurationMs;
|
|
||||||
}
|
|
||||||
if (report?.extractionDurationMs !== void 0) {
|
|
||||||
fields.tools_extraction_duration_ms = report.extractionDurationMs;
|
|
||||||
}
|
|
||||||
if (report?.totalDurationMs !== void 0) {
|
|
||||||
fields.tools_total_duration_ms = report.totalDurationMs;
|
|
||||||
}
|
|
||||||
if (report?.bundleLanguage !== void 0) {
|
|
||||||
fields.tools_bundle_language = report.bundleLanguage;
|
|
||||||
}
|
|
||||||
if (report?.perLanguageBundleFallback !== void 0) {
|
|
||||||
fields.tools_per_language_bundle_fallback = report.perLanguageBundleFallback;
|
|
||||||
}
|
|
||||||
if (toolsFeatureFlagsValid !== void 0) {
|
|
||||||
fields.tools_feature_flags_valid = toolsFeatureFlagsValid;
|
|
||||||
}
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
async function createInitWithConfigStatusReport(config, initStatusReport, configFile, totalCacheSize, overlayBaseDatabaseStats, dependencyCachingResults) {
|
async function createInitWithConfigStatusReport(config, initStatusReport, configFile, totalCacheSize, overlayBaseDatabaseStats, dependencyCachingResults) {
|
||||||
const languages = config.languages.join(",");
|
const languages = config.languages.join(",");
|
||||||
const paths = (config.originalUserInput.paths || []).join(",");
|
const paths = (config.originalUserInput.paths || []).join(",");
|
||||||
@@ -161882,6 +161860,30 @@ async function getToolsInput(action, repositoryProperties) {
|
|||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// src/status-report/tools-download.ts
|
||||||
|
function createInitToolsDownloadFields(report, toolsFeatureFlagsValid) {
|
||||||
|
const fields = {};
|
||||||
|
if (report?.downloadDurationMs !== void 0) {
|
||||||
|
fields.tools_download_duration_ms = report.downloadDurationMs;
|
||||||
|
}
|
||||||
|
if (report?.extractionDurationMs !== void 0) {
|
||||||
|
fields.tools_extraction_duration_ms = report.extractionDurationMs;
|
||||||
|
}
|
||||||
|
if (report?.totalDurationMs !== void 0) {
|
||||||
|
fields.tools_total_duration_ms = report.totalDurationMs;
|
||||||
|
}
|
||||||
|
if (report?.bundleLanguage !== void 0) {
|
||||||
|
fields.tools_bundle_language = report.bundleLanguage;
|
||||||
|
}
|
||||||
|
if (report?.perLanguageBundleFallback !== void 0) {
|
||||||
|
fields.tools_per_language_bundle_fallback = report.perLanguageBundleFallback;
|
||||||
|
}
|
||||||
|
if (toolsFeatureFlagsValid !== void 0) {
|
||||||
|
fields.tools_feature_flags_valid = toolsFeatureFlagsValid;
|
||||||
|
}
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
// src/workflow.ts
|
// src/workflow.ts
|
||||||
var fs28 = __toESM(require("fs"));
|
var fs28 = __toESM(require("fs"));
|
||||||
var path24 = __toESM(require("path"));
|
var path24 = __toESM(require("path"));
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ import {
|
|||||||
InitStatusReport,
|
InitStatusReport,
|
||||||
InitWithConfigStatusReport,
|
InitWithConfigStatusReport,
|
||||||
createInitWithConfigStatusReport,
|
createInitWithConfigStatusReport,
|
||||||
createInitToolsDownloadFields,
|
|
||||||
createStatusReportBase,
|
createStatusReportBase,
|
||||||
getActionsStatus,
|
getActionsStatus,
|
||||||
sendStatusReport,
|
sendStatusReport,
|
||||||
} from "./status-report";
|
} from "./status-report";
|
||||||
|
import { createInitToolsDownloadFields } from "./status-report/tools-download";
|
||||||
import { ToolsDownloadStatusReport } from "./tools-download";
|
import { ToolsDownloadStatusReport } from "./tools-download";
|
||||||
import { ToolsFeature } from "./tools-features";
|
import { ToolsFeature } from "./tools-features";
|
||||||
import { getCombinedTracerConfig } from "./tracer-config";
|
import { getCombinedTracerConfig } from "./tracer-config";
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ import { ToolsSource } from "./setup-codeql";
|
|||||||
import {
|
import {
|
||||||
ActionName,
|
ActionName,
|
||||||
InitStatusReport,
|
InitStatusReport,
|
||||||
createInitToolsDownloadFields,
|
|
||||||
createStatusReportBase,
|
createStatusReportBase,
|
||||||
getActionsStatus,
|
getActionsStatus,
|
||||||
sendStatusReport,
|
sendStatusReport,
|
||||||
} from "./status-report";
|
} from "./status-report";
|
||||||
|
import { createInitToolsDownloadFields } from "./status-report/tools-download";
|
||||||
import { ToolsDownloadStatusReport } from "./tools-download";
|
import { ToolsDownloadStatusReport } from "./tools-download";
|
||||||
import {
|
import {
|
||||||
checkDiskUsage,
|
checkDiskUsage,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import type { OverlayBaseDatabaseDownloadStats } from "./overlay/caching";
|
|||||||
import { getRepositoryNwo } from "./repository";
|
import { getRepositoryNwo } from "./repository";
|
||||||
import type { ToolsSource } from "./setup-codeql";
|
import type { ToolsSource } from "./setup-codeql";
|
||||||
import { registryBaseSchema } from "./start-proxy/types";
|
import { registryBaseSchema } from "./start-proxy/types";
|
||||||
import type { ToolsDownloadStatusReport } from "./tools-download";
|
|
||||||
import {
|
import {
|
||||||
ConfigurationError,
|
ConfigurationError,
|
||||||
getRequiredEnvParam,
|
getRequiredEnvParam,
|
||||||
@@ -625,64 +624,6 @@ export interface InitWithConfigStatusReport extends InitStatusReport {
|
|||||||
config_file: string;
|
config_file: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Fields of the init status report populated when the tools source is `download`. */
|
|
||||||
export interface InitToolsDownloadFields {
|
|
||||||
/**
|
|
||||||
* Time taken to download the bundle, in milliseconds. Not populated when the bundle is downloaded
|
|
||||||
* and extracted concurrently.
|
|
||||||
*/
|
|
||||||
tools_download_duration_ms?: ToolsDownloadStatusReport["downloadDurationMs"];
|
|
||||||
/**
|
|
||||||
* Time taken to extract the bundle, in milliseconds. Not populated when the bundle is downloaded
|
|
||||||
* and extracted concurrently.
|
|
||||||
*/
|
|
||||||
tools_extraction_duration_ms?: ToolsDownloadStatusReport["extractionDurationMs"];
|
|
||||||
/**
|
|
||||||
* Total time taken to make the bundle available on disk, including failed download attempts
|
|
||||||
* before a fallback, in milliseconds.
|
|
||||||
*/
|
|
||||||
tools_total_duration_ms?: ToolsDownloadStatusReport["totalDurationMs"];
|
|
||||||
/**
|
|
||||||
* Whether the relevant tools dotcom feature flags have been misconfigured.
|
|
||||||
* Only populated if we attempt to determine the default version based on the dotcom feature flags. */
|
|
||||||
tools_feature_flags_valid?: boolean;
|
|
||||||
/** The language of the single-language bundle that was downloaded, if any. */
|
|
||||||
tools_bundle_language?: ToolsDownloadStatusReport["bundleLanguage"];
|
|
||||||
/**
|
|
||||||
* Whether we tried to download a single-language bundle, but it did not exist and we fell back to
|
|
||||||
* the combined bundle.
|
|
||||||
*/
|
|
||||||
tools_per_language_bundle_fallback?: ToolsDownloadStatusReport["perLanguageBundleFallback"];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Converts download results to telemetry fields shared by the init and setup-codeql Actions. */
|
|
||||||
export function createInitToolsDownloadFields(
|
|
||||||
report: ToolsDownloadStatusReport | undefined,
|
|
||||||
toolsFeatureFlagsValid: boolean | undefined,
|
|
||||||
): InitToolsDownloadFields {
|
|
||||||
const fields: InitToolsDownloadFields = {};
|
|
||||||
if (report?.downloadDurationMs !== undefined) {
|
|
||||||
fields.tools_download_duration_ms = report.downloadDurationMs;
|
|
||||||
}
|
|
||||||
if (report?.extractionDurationMs !== undefined) {
|
|
||||||
fields.tools_extraction_duration_ms = report.extractionDurationMs;
|
|
||||||
}
|
|
||||||
if (report?.totalDurationMs !== undefined) {
|
|
||||||
fields.tools_total_duration_ms = report.totalDurationMs;
|
|
||||||
}
|
|
||||||
if (report?.bundleLanguage !== undefined) {
|
|
||||||
fields.tools_bundle_language = report.bundleLanguage;
|
|
||||||
}
|
|
||||||
if (report?.perLanguageBundleFallback !== undefined) {
|
|
||||||
fields.tools_per_language_bundle_fallback =
|
|
||||||
report.perLanguageBundleFallback;
|
|
||||||
}
|
|
||||||
if (toolsFeatureFlagsValid !== undefined) {
|
|
||||||
fields.tools_feature_flags_valid = toolsFeatureFlagsValid;
|
|
||||||
}
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composes a `InitWithConfigStatusReport` from the given values.
|
* Composes a `InitWithConfigStatusReport` from the given values.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import test from "ava";
|
import test from "ava";
|
||||||
|
|
||||||
import { BuiltInLanguage } from "./languages";
|
import { BuiltInLanguage } from "../languages";
|
||||||
import { createInitToolsDownloadFields } from "./status-report";
|
|
||||||
|
import { createInitToolsDownloadFields } from "./tools-download";
|
||||||
|
|
||||||
test("createInitToolsDownloadFields omits absent download data", (t) => {
|
test("createInitToolsDownloadFields omits absent download data", (t) => {
|
||||||
t.deepEqual(createInitToolsDownloadFields(undefined, undefined), {});
|
t.deepEqual(createInitToolsDownloadFields(undefined, undefined), {});
|
||||||
59
src/status-report/tools-download.ts
Normal file
59
src/status-report/tools-download.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import type { ToolsDownloadStatusReport } from "../tools-download";
|
||||||
|
|
||||||
|
/** Fields of the init status report populated when the tools source is `download`. */
|
||||||
|
export interface InitToolsDownloadFields {
|
||||||
|
/**
|
||||||
|
* Time taken to download the bundle, in milliseconds. Not populated when the bundle is downloaded
|
||||||
|
* and extracted concurrently.
|
||||||
|
*/
|
||||||
|
tools_download_duration_ms?: ToolsDownloadStatusReport["downloadDurationMs"];
|
||||||
|
/**
|
||||||
|
* Time taken to extract the bundle, in milliseconds. Not populated when the bundle is downloaded
|
||||||
|
* and extracted concurrently.
|
||||||
|
*/
|
||||||
|
tools_extraction_duration_ms?: ToolsDownloadStatusReport["extractionDurationMs"];
|
||||||
|
/**
|
||||||
|
* Total time taken to make the bundle available on disk, including failed download attempts
|
||||||
|
* before a fallback, in milliseconds.
|
||||||
|
*/
|
||||||
|
tools_total_duration_ms?: ToolsDownloadStatusReport["totalDurationMs"];
|
||||||
|
/**
|
||||||
|
* Whether the relevant tools dotcom feature flags have been misconfigured.
|
||||||
|
* Only populated if we attempt to determine the default version based on the dotcom feature flags. */
|
||||||
|
tools_feature_flags_valid?: boolean;
|
||||||
|
/** The language of the single-language bundle that was downloaded, if any. */
|
||||||
|
tools_bundle_language?: ToolsDownloadStatusReport["bundleLanguage"];
|
||||||
|
/**
|
||||||
|
* Whether we tried to download a single-language bundle, but it did not exist and we fell back to
|
||||||
|
* the combined bundle.
|
||||||
|
*/
|
||||||
|
tools_per_language_bundle_fallback?: ToolsDownloadStatusReport["perLanguageBundleFallback"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Converts download results to telemetry fields shared by the init and setup-codeql Actions. */
|
||||||
|
export function createInitToolsDownloadFields(
|
||||||
|
report: ToolsDownloadStatusReport | undefined,
|
||||||
|
toolsFeatureFlagsValid: boolean | undefined,
|
||||||
|
): InitToolsDownloadFields {
|
||||||
|
const fields: InitToolsDownloadFields = {};
|
||||||
|
if (report?.downloadDurationMs !== undefined) {
|
||||||
|
fields.tools_download_duration_ms = report.downloadDurationMs;
|
||||||
|
}
|
||||||
|
if (report?.extractionDurationMs !== undefined) {
|
||||||
|
fields.tools_extraction_duration_ms = report.extractionDurationMs;
|
||||||
|
}
|
||||||
|
if (report?.totalDurationMs !== undefined) {
|
||||||
|
fields.tools_total_duration_ms = report.totalDurationMs;
|
||||||
|
}
|
||||||
|
if (report?.bundleLanguage !== undefined) {
|
||||||
|
fields.tools_bundle_language = report.bundleLanguage;
|
||||||
|
}
|
||||||
|
if (report?.perLanguageBundleFallback !== undefined) {
|
||||||
|
fields.tools_per_language_bundle_fallback =
|
||||||
|
report.perLanguageBundleFallback;
|
||||||
|
}
|
||||||
|
if (toolsFeatureFlagsValid !== undefined) {
|
||||||
|
fields.tools_feature_flags_valid = toolsFeatureFlagsValid;
|
||||||
|
}
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user