mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
feat(telemetry): include error details for failures (#254)
This commit is contained in:
parent
494618ab14
commit
6da8c3452a
18 changed files with 1259 additions and 999 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { scrubErrorClass } from './scrubber.js';
|
||||
import { formatErrorDetail, scrubErrorClass } from './scrubber.js';
|
||||
|
||||
export type CommandOutcome = 'ok' | 'error' | 'aborted';
|
||||
|
||||
|
|
@ -16,6 +16,7 @@ export interface CompletedCommandSpan {
|
|||
durationMs: number;
|
||||
outcome: CommandOutcome;
|
||||
errorClass?: string;
|
||||
errorDetail?: string;
|
||||
flagsPresent: Record<string, boolean>;
|
||||
hasProject: boolean;
|
||||
projectDir?: string;
|
||||
|
|
@ -40,12 +41,14 @@ export function completeCommandSpan(input: {
|
|||
}
|
||||
|
||||
const errorClass = input.error ? scrubErrorClass(input.error) : undefined;
|
||||
const errorDetail = input.error ? formatErrorDetail(input.error) : undefined;
|
||||
|
||||
return {
|
||||
commandPath: span.commandPath,
|
||||
durationMs: Math.max(0, input.completedAt - span.startedAt),
|
||||
outcome: input.outcome,
|
||||
...(errorClass ? { errorClass } : {}),
|
||||
...(errorDetail ? { errorDetail } : {}),
|
||||
flagsPresent: span.flagsPresent,
|
||||
hasProject: span.hasProject,
|
||||
projectDir: span.projectDir,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue