UNPKG

@codai/memorai-core

Version:

Simplified advanced memory engine - no tiers, just powerful semantic search with persistence

111 lines 3.02 kB
/** * Advanced Performance Monitoring and Alerting System * Enterprise-grade monitoring with predictive analytics */ export interface AlertConfig { enabled: boolean; thresholds: { memoryUsage: number; queryLatency: number; cacheHitRate: number; errorRate: number; concurrentUsers: number; }; notifications: { email?: string[]; slack?: string; webhook?: string; }; } export interface PerformanceMetric { timestamp: number; memoryUsage: number; queryLatency: number; cacheHitRate: number; errorRate: number; concurrentUsers: number; systemHealth: 'excellent' | 'good' | 'warning' | 'critical'; } export interface PredictiveAnalysis { memoryGrowthTrend: 'stable' | 'growing' | 'declining'; estimatedOptimizationNeeded: number; recommendedActions: string[]; confidence: number; } export declare class AdvancedPerformanceMonitor { private metricsHistory; private alertConfig; private isMonitoring; private monitoringInterval?; private memoryEngine?; private activeConnections; private errorCount; private totalRequests; constructor(alertConfig?: AlertConfig, memoryEngine?: any); /** * Start continuous performance monitoring */ startMonitoring(intervalMs?: number): void; /** * Stop performance monitoring */ stopMonitoring(): void; /** * Collect current performance metrics */ private collectMetrics; /** * Calculate system health based on key metrics */ private calculateSystemHealth; /** * Check if metrics exceed alert thresholds */ private checkAlerts; /** * Send alert notifications */ private sendAlert; /** * Generate predictive analysis based on historical data */ generatePredictiveAnalysis(): PredictiveAnalysis; /** * Get comprehensive system report */ getSystemReport(): { currentMetrics: PerformanceMetric | null; trends: PredictiveAnalysis; healthSummary: { overallHealth: string; uptime: number; totalAlerts: number; recommendations: string[]; }; }; /** * Perform a latency test by executing actual memory operation */ private performLatencyTest; /** * Export metrics for analysis */ exportMetrics(): PerformanceMetric[]; /** * Track connection activity for concurrent user metrics */ incrementConnections(): void; decrementConnections(): void; /** * Track errors for error rate calculation */ recordError(): void; recordSuccess(): void; /** * Reset error tracking (useful for periodic resets) */ resetErrorTracking(): void; } export declare const defaultAlertConfig: AlertConfig; export declare const globalPerformanceMonitor: AdvancedPerformanceMonitor; //# sourceMappingURL=AdvancedPerformanceMonitor.d.ts.map