@mrtkrcm/acp-claude-code
Version:
ACP (Agent Client Protocol) bridge for Claude Code
79 lines • 2.56 kB
TypeScript
export interface PerformanceMetrics {
operation: string;
duration: number;
timestamp: Date;
sessionId?: string;
success: boolean;
memoryUsage?: {
heapUsed: number;
heapTotal: number;
external: number;
rss: number;
};
metadata?: Record<string, unknown>;
}
export interface SystemMetrics {
uptime: number;
cpuUsage: NodeJS.CpuUsage;
memoryUsage: NodeJS.MemoryUsage;
activeOperations: number;
totalOperations: number;
averageResponseTime: number;
errorRate: number;
}
export declare class PerformanceMonitor {
private readonly logger;
private readonly metrics;
private readonly activeOperations;
private readonly MAX_METRICS_HISTORY;
private processStartTime;
private totalOperations;
private totalErrors;
constructor();
/**
* Start tracking an operation
*/
startOperation(operationId: string, operation: string, sessionId?: string): void;
/**
* End tracking an operation and record metrics
*/
endOperation(operationId: string, success?: boolean, metadata?: Record<string, unknown>): PerformanceMetrics | null;
/**
* Record a one-shot metric without active tracking
*/
recordMetric(operation: string, duration: number, success?: boolean, sessionId?: string, metadata?: Record<string, unknown>): void;
/**
* Get system-wide metrics
*/
getSystemMetrics(): SystemMetrics;
/**
* Get metrics for a specific operation type
*/
getOperationMetrics(operation: string, timeRangeMs?: number): PerformanceMetrics[];
/**
* Get metrics for a specific session
*/
getSessionMetrics(sessionId: string, timeRangeMs?: number): PerformanceMetrics[];
/**
* Get basic operation statistics
*/
getOperationStats(operation: string): {
count: number;
averageDuration: number;
successRate: number;
};
/**
* Clear metrics history (useful for testing)
*/
clearMetrics(): void;
/**
* Get basic health status
*/
getHealthStatus(): 'healthy' | 'warning' | 'critical';
private startPeriodicReporting;
private cleanupOldMetrics;
}
export declare function getGlobalPerformanceMonitor(): PerformanceMonitor;
export declare function resetGlobalPerformanceMonitor(): void;
export declare function withPerformanceTracking<T>(operation: string, fn: () => Promise<T>, sessionId?: string, metadata?: Record<string, unknown>): Promise<T>;
//# sourceMappingURL=performance-monitor.d.ts.map