core.performance_monitor
Performance Monitoring System
Comprehensive performance monitoring and metrics collection system for the MCP Academic RAG Server. Provides real-time performance tracking, metrics aggregation, and alerting capabilities.
Functions
|
Count invocations with atomic cumulative values and independent default names. |
|
Get global performance monitor instance |
|
Initialize and start performance monitoring |
|
Track each decorated function independently while retaining its signature. |
Classes
|
Performance alert instance |
|
Alert severity levels |
Alert management and notification system |
|
|
Performance alert rule configuration |
|
Types of metrics that can be collected |
|
Thread-safe metrics collection and aggregation |
|
Individual performance metric data point |
|
Main performance monitoring system |
|
System-level performance metrics |
|
System resource monitoring |
- class core.performance_monitor.MetricType(value)[source]
Bases:
EnumTypes of metrics that can be collected
- COUNTER = 'counter'
- GAUGE = 'gauge'
- HISTOGRAM = 'histogram'
- TIMER = 'timer'
- RATE = 'rate'
- class core.performance_monitor.AlertLevel(value)[source]
Bases:
EnumAlert severity levels
- INFO = 'info'
- WARNING = 'warning'
- ERROR = 'error'
- CRITICAL = 'critical'
- class core.performance_monitor.PerformanceMetric(name, value, metric_type, timestamp, tags=None, unit='count')[source]
Bases:
objectIndividual performance metric data point
- metric_type: MetricType
- __init__(name, value, metric_type, timestamp, tags=None, unit='count')
- class core.performance_monitor.SystemMetrics(cpu_percent, memory_percent, memory_used_mb, memory_available_mb, disk_usage_percent, disk_free_gb, network_bytes_sent, network_bytes_received, open_files, active_threads, timestamp)[source]
Bases:
objectSystem-level performance metrics
- __init__(cpu_percent, memory_percent, memory_used_mb, memory_available_mb, disk_usage_percent, disk_free_gb, network_bytes_sent, network_bytes_received, open_files, active_threads, timestamp)
- class core.performance_monitor.AlertRule(metric_name, condition, threshold, level, duration_seconds=60, enabled=True, description='')[source]
Bases:
objectPerformance alert rule configuration
- level: AlertLevel
- __init__(metric_name, condition, threshold, level, duration_seconds=60, enabled=True, description='')
- class core.performance_monitor.Alert(rule, triggered_at, current_value, message, resolved_at=None)[source]
Bases:
objectPerformance alert instance
- __init__(rule, triggered_at, current_value, message, resolved_at=None)
- class core.performance_monitor.MetricsCollector(max_history=10000)[source]
Bases:
objectThread-safe metrics collection and aggregation
- metrics_history: deque[PerformanceMetric]
- class core.performance_monitor.SystemMonitor(collection_interval=1.0)[source]
Bases:
objectSystem resource monitoring
- metrics_collector: MetricsCollector | None
- class core.performance_monitor.AlertManager[source]
Bases:
objectAlert management and notification system
- class core.performance_monitor.PerformanceMonitor(config=None)[source]
Bases:
objectMain performance monitoring system
- core.performance_monitor.get_performance_monitor(config=None)[source]
Get global performance monitor instance
- core.performance_monitor.initialize_monitoring(config=None)[source]
Initialize and start performance monitoring