feat(telemetry): include error details for failures (#254)

This commit is contained in:
Andrey Avtomonov 2026-06-02 17:23:51 +02:00 committed by GitHub
parent 494618ab14
commit 6da8c3452a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 1259 additions and 999 deletions

View file

@ -22,6 +22,7 @@ import type { KtxScanArgs, KtxScanDeps } from './scan.js';
import { profileMark } from './startup-profile.js';
import { isDemoConnection } from './telemetry/demo-detect.js';
import { emitProjectStackSnapshot, emitTelemetryEvent } from './telemetry/index.js';
import { formatErrorDetail } from './telemetry/scrubber.js';
profileMark('module:public-ingest');
@ -635,6 +636,9 @@ async function emitIngestCompleted(input: {
io: KtxCliIo;
}): Promise<void> {
const failed = resultFailed(input.result);
const failureDetail = failed
? formatErrorDetail(input.result.steps.find((step) => step.status === 'failed')?.detail)
: undefined;
await emitTelemetryEvent({
name: 'ingest_completed',
projectDir: input.args.projectDir,
@ -651,6 +655,7 @@ async function emitIngestCompleted(input: {
rowsBucket: rowsBucket(),
durationMs: Math.max(0, performance.now() - input.startedAt),
outcome: failed ? 'error' : 'ok',
...(failureDetail ? { errorDetail: failureDetail } : {}),
},
});
}