class DiagnosticsCollector
implements IDiagnosticsCollector
Default implementation of IDiagnosticsCollector that stores events in memory and can optionally emit them to console for debugging.
private
readonly
correlationId: string
private
readonly
emitToConsole: boolean
private
events: AnyDiagnosticEvent[]
private
operationNames: Map<string, string>
private
operationStartTimes: Map<string, number>
clear(): void
Clears all collected events
emit(event: DiagnosticEvent): void
Emits a custom diagnostic event
getCorrelationId(): string
Gets the correlation ID for this collector
Gets all collected events
operationComplete(eventId: string,output?: Record<string, unknown>,): void
Records successful completion of an operation
operationError(eventId: string,error: Error,): void
Records an error during an operation. Extracts additional metadata from BaseError subclasses.
operationStart(operation: string,input?: Record<string, unknown>,): string
Records the start of an operation
recordCacheEvent(operation: "hit"
| "miss"
| "write"
| "evict",key: string,size?: number,): void
Records a cache event
recordMetric(metric: string,value: number,unit: string,dimensions?: Record<string, string>,): void
Records a performance metric
recordNetworkEvent(method: string,url: string,statusCode?: number,durationMs?: number,responseSize?: number,): void
Records a network event