UNPKG

datapilot-cli

Version:

Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform

146 lines 4.01 kB
/** * Performance Monitoring and Adaptive Thresholds System * Provides real-time performance tracking and dynamic configuration adjustment */ import { type DataPilotConfig } from './config'; export interface PerformanceMetrics { timestamp: number; memoryUsageMB: number; heapUsedMB: number; heapTotalMB: number; externalMB: number; rss: number; cpuTime?: number; processingRate?: number; throughput?: number; } export interface PerformanceAlert { type: 'memory' | 'cpu' | 'throughput' | 'error_rate'; severity: 'low' | 'medium' | 'high' | 'critical'; message: string; metrics: PerformanceMetrics; recommendation: string; timestamp: number; } export interface AdaptiveThreshold { name: string; currentValue: number; defaultValue: number; adaptedValue: number; lastAdjustment: number; adjustmentReason: string; } /** * Performance Monitor with Adaptive Configuration Management */ export declare class PerformanceMonitor { private static instance; private metrics; private alerts; private adaptiveThresholds; private monitoringInterval?; private isMonitoring; private startTime; private operationCount; private rowsProcessed; private errorsEncountered; private autoAdaptEnabled; private adaptationHistory; private constructor(); static getInstance(): PerformanceMonitor; /** * Initialize adaptive thresholds with default values */ private initializeAdaptiveThresholds; /** * Start performance monitoring */ startMonitoring(intervalMs?: number): void; /** * Stop performance monitoring */ stopMonitoring(): void; /** * Collect current performance metrics */ private collectMetrics; /** * Analyze performance and generate alerts */ private analyzePerformance; /** * Adaptively adjust thresholds based on performance */ private adaptThresholds; /** * Adapt a specific threshold */ private adaptThreshold; /** * Apply adaptive configuration to the global config */ private applyAdaptiveConfiguration; /** * Create a performance alert */ private createAlert; /** * Record operation metrics */ recordOperation(type: 'row' | 'operation' | 'error', count?: number): void; /** * Get current performance summary */ getPerformanceSummary(): { currentMetrics: PerformanceMetrics | null; recentAlerts: PerformanceAlert[]; adaptiveThresholds: AdaptiveThreshold[]; adaptationHistory: typeof this.adaptationHistory; operationalMetrics: { rowsProcessed: number; operationCount: number; errorsEncountered: number; errorRate: number; elapsedTimeMs: number; }; }; /** * Reset monitoring state */ reset(): void; /** * Enable/disable auto-adaptation */ setAutoAdaptation(enabled: boolean): void; /** * Get adaptive threshold value */ getAdaptiveThreshold(name: string): number | undefined; /** * Manually adjust threshold */ setThreshold(name: string, value: number, reason?: string): void; } /** * Convenience function to get performance monitor instance */ export declare function getPerformanceMonitor(): PerformanceMonitor; /** * Performance monitoring decorator for methods */ export declare function monitorPerformance(target: unknown, propertyName: string, descriptor: PropertyDescriptor): void; /** * System resource detection for adaptive configuration */ export declare class ResourceDetector { /** * Detect available system resources */ static detectSystemResources(): { availableMemoryMB: number; totalMemoryMB: number; cpuCores: number; recommendedConfig: Partial<DataPilotConfig>; }; } //# sourceMappingURL=performance-monitor.d.ts.map