industry40_metrics/
industry40_metrics.rs1use avx_async::{Runtime, RuntimeConfig};
2use std::time::Duration;
3
4fn main() {
5 let config = RuntimeConfig {
7 num_threads: Some(4),
8 enable_autoscaling: false,
9 ..Default::default()
10 };
11
12 let rt = Runtime::with_config(config);
13
14 println!("🏭 Industry 4.0 Metrics Dashboard");
15 println!("================================\n");
16
17 rt.block_on(async move {
18 for i in 0..20 {
20 rt.spawn(async move {
21 avx_async::sleep(Duration::from_millis(50 * (i % 5) as u64)).await;
22 });
24 }
25
26 for iteration in 0..5 {
28 avx_async::sleep(Duration::from_millis(200)).await;
29
30 let snapshot = rt.metrics().snapshot();
31 let health = rt.health().get_report();
32
33 println!("📊 Iteration {}", iteration + 1);
34 println!(" {}", snapshot);
35 println!(" Health: {} | Ready: {} | Alive: {}",
36 health.status, health.ready, health.alive);
37 println!();
38 }
39
40 while rt.task_count() > 0 {
42 avx_async::sleep(Duration::from_millis(50)).await;
43 }
44
45 println!("📈 Final Metrics Report");
46 println!("=====================");
47 let final_snapshot = rt.metrics().snapshot();
48 println!("{}", final_snapshot);
49 println!();
50
51 println!("🏥 Health Check Report");
52 println!("====================");
53 let health_report = rt.health().get_report();
54 println!("{}", health_report);
55 println!();
56
57 println!("📤 Prometheus Export");
58 println!("===================");
59 println!("{}", rt.metrics().to_prometheus());
60 });
61}
62
63
64
65
66