Tidy up telemetry call

This commit is contained in:
Henry Mercer 2024-07-02 14:59:50 +02:00
parent 7e6aa4d65a
commit 8dba596f10
3 changed files with 17 additions and 36 deletions

11
lib/analyze-action.js generated
View file

@ -220,14 +220,9 @@ async function run() {
hasBadExpectErrorInput()) { hasBadExpectErrorInput()) {
core.setFailed(error.message); core.setFailed(error.message);
} }
if (error instanceof analyze_1.CodeQLAnalysisError) { await sendStatusReport(startedAt, config, error instanceof analyze_1.CodeQLAnalysisError
const stats = { ...error.queriesStatusReport }; ? error.queriesStatusReport
await sendStatusReport(startedAt, config, stats, error.error, // use the underlying error in case it is a configuration error : undefined, error instanceof analyze_1.CodeQLAnalysisError ? error.error : error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, logger);
trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, logger);
}
else {
await sendStatusReport(startedAt, config, undefined, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, logger);
}
return; return;
} }
if (runStats && uploadResult) { if (runStats && uploadResult) {

File diff suppressed because one or more lines are too long

View file

@ -356,33 +356,19 @@ async function run() {
core.setFailed(error.message); core.setFailed(error.message);
} }
if (error instanceof CodeQLAnalysisError) {
const stats = { ...error.queriesStatusReport };
await sendStatusReport( await sendStatusReport(
startedAt, startedAt,
config, config,
stats, error instanceof CodeQLAnalysisError
error.error, // use the underlying error in case it is a configuration error ? error.queriesStatusReport
: undefined,
error instanceof CodeQLAnalysisError ? error.error : error,
trapCacheUploadTime, trapCacheUploadTime,
dbCreationTimings, dbCreationTimings,
didUploadTrapCaches, didUploadTrapCaches,
trapCacheCleanupTelemetry, trapCacheCleanupTelemetry,
logger, logger,
); );
} else {
await sendStatusReport(
startedAt,
config,
undefined,
error,
trapCacheUploadTime,
dbCreationTimings,
didUploadTrapCaches,
trapCacheCleanupTelemetry,
logger,
);
}
return; return;
} }