Refactor existing telemetry diagnostics to use makeTelemetryDiagnostic

Refactored bundle-download-telemetry and zstd-availability diagnostics
in init-action.ts to use the new makeTelemetryDiagnostic helper function.
Also added guard for empty languages array in logGitVersionTelemetry.

Co-authored-by: henrymercer <14129055+henrymercer@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-16 17:24:57 +00:00
parent c3dc529aef
commit 393c074965
3 changed files with 15 additions and 38 deletions
+7 -19
View File
@@ -85790,9 +85790,11 @@ async function getGitVersion(logger) {
}
async function logGitVersionTelemetry(config, logger) {
const version = await getGitVersion(logger);
if (version !== void 0) {
if (version !== void 0 && config.languages.length > 0) {
addDiagnostic(
config,
// Arbitrarily choose the first language. We could also choose all languages, but that
// increases the risk of misinterpreting the data.
config.languages[0],
makeTelemetryDiagnostic(
"codeql-action/git-version-telemetry",
@@ -90192,17 +90194,10 @@ async function run() {
// Arbitrarily choose the first language. We could also choose all languages, but that
// increases the risk of misinterpreting the data.
config.languages[0],
makeDiagnostic(
makeTelemetryDiagnostic(
"codeql-action/bundle-download-telemetry",
"CodeQL bundle download telemetry",
{
attributes: toolsDownloadStatusReport,
visibility: {
cliSummaryTable: false,
statusPage: false,
telemetry: true
}
}
toolsDownloadStatusReport
)
);
}
@@ -90449,17 +90444,10 @@ async function recordZstdAvailability(config, zstdAvailability) {
// Arbitrarily choose the first language. We could also choose all languages, but that
// increases the risk of misinterpreting the data.
config.languages[0],
makeDiagnostic(
makeTelemetryDiagnostic(
"codeql-action/zstd-availability",
"Zstandard availability",
{
attributes: zstdAvailability,
visibility: {
cliSummaryTable: false,
statusPage: false,
telemetry: true
}
}
zstdAvailability
)
);
}