rcc-pipeline
Version:
RCC Pipeline Module - Pipeline system and workflow management based on pipeline-framework
117 lines • 3.31 kB
TypeScript
/**
* Log Entries Interface
* 日志条目接口
*/
import { PipelineIOEntry } from './IRequestContext';
/**
* Pipeline Request Log Entry
* 流水线请求日志条目
*/
export interface PipelineRequestLogEntry {
requestId: string;
pipelineId: string;
timestamp: number;
provider: string;
operation: string;
request: {
headers?: Record<string, string>;
body: any;
metadata?: Record<string, any>;
};
response: {
status: number;
headers?: Record<string, string>;
body: any;
metadata?: Record<string, any>;
};
duration: number;
success: boolean;
error?: string;
stages: any[];
}
/**
* Pipeline Error Log Entry
* 流水线错误日志条目
*/
export interface PipelineErrorLogEntry {
requestId: string;
pipelineId: string;
timestamp: number;
provider: string;
operation: string;
error: {
message: string;
stack?: string;
code?: string;
type: string;
};
request: {
headers?: Record<string, string>;
body: any;
metadata?: Record<string, any>;
};
failedStage?: string;
stages: any[];
debugInfo?: Record<string, any>;
}
/**
* Pipeline System Log Entry
* 流水线系统日志条目
*/
export interface PipelineSystemLogEntry {
level: 'debug' | 'info' | 'warn' | 'error';
message: string;
timestamp: number;
requestId?: string;
provider?: string;
operation?: string;
metadata?: Record<string, any>;
}
/**
* Pipeline Performance Metrics
* 流水线性能指标
*/
export interface PipelinePerformanceMetrics {
requestId: string;
pipelineId: string;
provider: string;
operation: string;
totalDuration: number;
validationDuration?: number;
mappingDuration?: number;
executionDuration?: number;
responseDuration?: number;
success: boolean;
error?: string;
stagePerformance: {
[stage: string]: {
duration: number;
success: boolean;
error?: string;
};
};
}
/**
* Pipeline Log Entry Types Union
* 流水线日志条目类型联合
*/
export type PipelineLogEntry = PipelineRequestLogEntry | PipelineErrorLogEntry | PipelineSystemLogEntry | PipelinePerformanceMetrics;
/**
* Log Entry Manager Interface
* 日志条目管理器接口
*/
export interface ILogEntryManager {
createRequestLogEntry(entry: Omit<PipelineRequestLogEntry, 'timestamp'>): void;
createErrorLogEntry(entry: Omit<PipelineErrorLogEntry, 'timestamp'>): void;
createSystemLogEntry(entry: Omit<PipelineSystemLogEntry, 'timestamp'>): void;
createPerformanceMetricsEntry(entry: Omit<PipelinePerformanceMetrics, 'timestamp'>): void;
getRequestLogEntries(requestId?: string): PipelineRequestLogEntry[];
getErrorLogEntries(requestId?: string): PipelineErrorLogEntry[];
getSystemLogEntries(level?: string): PipelineSystemLogEntry[];
getPerformanceMetrics(requestId?: string): PipelinePerformanceMetrics[];
createPipelineIOEntry(entry: Omit<PipelineIOEntry, 'timestamp'>): void;
getPipelineIOEntries(pipelineId?: string): PipelineIOEntry[];
clearEntries(): void;
clearEntriesByRequestId(requestId: string): void;
}
//# sourceMappingURL=ILogEntries.d.ts.map