quantrs2_tytan/realtime_quantum_integration/
config.rs1use serde::{Deserialize, Serialize};
6use std::time::Duration;
7
8use super::types::{AlertChannel, AllocationStrategy, MetricType};
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct RealtimeConfig {
13 pub monitoring_interval: Duration,
15 pub max_queue_size: usize,
17 pub allocation_strategy: AllocationStrategy,
19 pub fault_detection_sensitivity: f64,
21 pub analytics_config: AnalyticsConfig,
23 pub auto_recovery_enabled: bool,
25 pub alert_thresholds: AlertThresholds,
27 pub data_retention_period: Duration,
29}
30
31impl Default for RealtimeConfig {
32 fn default() -> Self {
33 Self {
34 monitoring_interval: Duration::from_millis(100),
35 max_queue_size: 1000,
36 allocation_strategy: AllocationStrategy::LoadBalanced,
37 fault_detection_sensitivity: 0.95,
38 analytics_config: AnalyticsConfig::default(),
39 auto_recovery_enabled: true,
40 alert_thresholds: AlertThresholds::default(),
41 data_retention_period: Duration::from_secs(24 * 3600), }
43 }
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct AnalyticsConfig {
49 pub real_time_metrics: bool,
51 pub predictive_analytics: bool,
53 pub aggregation_interval: Duration,
55 pub analysis_depth: Duration,
57 pub prediction_horizon: Duration,
59}
60
61impl Default for AnalyticsConfig {
62 fn default() -> Self {
63 Self {
64 real_time_metrics: true,
65 predictive_analytics: true,
66 aggregation_interval: Duration::from_secs(60),
67 analysis_depth: Duration::from_secs(3600), prediction_horizon: Duration::from_secs(1800), }
70 }
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct AlertThresholds {
76 pub cpu_threshold: f64,
78 pub memory_threshold: f64,
80 pub queue_threshold: usize,
82 pub error_rate_threshold: f64,
84 pub response_time_threshold: Duration,
86 pub hardware_failure_threshold: f64,
88}
89
90impl Default for AlertThresholds {
91 fn default() -> Self {
92 Self {
93 cpu_threshold: 0.85,
94 memory_threshold: 0.90,
95 queue_threshold: 100,
96 error_rate_threshold: 0.05,
97 response_time_threshold: Duration::from_secs(300),
98 hardware_failure_threshold: 0.01,
99 }
100 }
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105pub struct MonitorConfig {
106 pub monitoring_frequency: Duration,
108 pub metrics_to_collect: Vec<MetricType>,
110 pub alert_config: AlertConfig,
112 pub data_retention: Duration,
114}
115
116impl Default for MonitorConfig {
117 fn default() -> Self {
118 Self {
119 monitoring_frequency: Duration::from_secs(60),
120 metrics_to_collect: vec![MetricType::All],
121 alert_config: AlertConfig {
122 alerts_enabled: true,
123 alert_channels: vec![AlertChannel::Dashboard],
124 alert_rules: vec![],
125 escalation_policy: EscalationPolicy {
126 levels: vec![],
127 auto_acknowledge_timeout: Duration::from_secs(300),
128 max_level: 3,
129 },
130 },
131 data_retention: Duration::from_secs(7 * 24 * 3600), }
133 }
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138pub struct AlertConfig {
139 pub alerts_enabled: bool,
141 pub alert_channels: Vec<AlertChannel>,
143 pub alert_rules: Vec<AlertRule>,
145 pub escalation_policy: EscalationPolicy,
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151pub struct AlertRule {
152 pub name: String,
154 pub condition: String,
156 pub threshold: f64,
158 pub severity: super::types::AlertSeverity,
160 pub cooldown: Duration,
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize)]
166pub struct EscalationPolicy {
167 pub levels: Vec<EscalationLevel>,
169 pub auto_acknowledge_timeout: Duration,
171 pub max_level: usize,
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
177pub struct EscalationLevel {
178 pub level: usize,
180 pub delay: Duration,
182 pub targets: Vec<String>,
184 pub channels: Vec<AlertChannel>,
186}