| 563 |
563 |
|
uptime_24h: data.uptime_24h.map(|v| format!("{:.1}", v)),
|
| 564 |
564 |
|
uptime_7d: data.uptime_7d.map(|v| format!("{:.1}", v)),
|
| 565 |
565 |
|
last_incident: data.last_incident,
|
| 566 |
|
- |
recent_snapshots: data.recent_snapshots.iter().map(|s| HealthSnapshotDisplay {
|
| 567 |
|
- |
checked_at: s.checked_at.format("%H:%M:%S UTC").to_string(),
|
| 568 |
|
- |
status: s.status.clone(),
|
| 569 |
|
- |
status_class: match s.status.as_str() {
|
|
566 |
+ |
recent_snapshots: data.recent_snapshots.into_iter().map(|s| {
|
|
567 |
+ |
let status_class = match s.status.as_str() {
|
| 570 |
568 |
|
"operational" => "status-ok".to_string(),
|
| 571 |
569 |
|
"degraded" => "status-warn".to_string(),
|
| 572 |
570 |
|
_ => "status-error".to_string(),
|
| 573 |
|
- |
},
|
| 574 |
|
- |
duration_ms: s.check_duration_ms,
|
|
571 |
+ |
};
|
|
572 |
+ |
HealthSnapshotDisplay {
|
|
573 |
+ |
checked_at: s.checked_at.format("%H:%M:%S UTC").to_string(),
|
|
574 |
+ |
status: s.status,
|
|
575 |
+ |
status_class,
|
|
576 |
+ |
duration_ms: s.check_duration_ms,
|
|
577 |
+ |
}
|
| 575 |
578 |
|
}).collect(),
|
| 576 |
579 |
|
environment: data.environment.to_string(),
|
| 577 |
580 |
|
host: data.host,
|
| 580 |
583 |
|
db_tests: data.db_tests,
|
| 581 |
584 |
|
generated_at: now.format("%Y-%m-%d %H:%M:%S UTC").to_string(),
|
| 582 |
585 |
|
pom_available: data.pom_available,
|
| 583 |
|
- |
pom_status: data.pom_status.clone(),
|
| 584 |
|
- |
pom_status_class: data.pom_status_class.clone(),
|
|
586 |
+ |
pom_status: data.pom_status,
|
|
587 |
+ |
pom_status_class: data.pom_status_class,
|
| 585 |
588 |
|
pom_response_time_ms: data.pom_response_time_ms,
|
| 586 |
|
- |
pom_checked_at: data.pom_checked_at.clone(),
|
|
589 |
+ |
pom_checked_at: data.pom_checked_at,
|
| 587 |
590 |
|
pom_uptime_24h: data.pom_uptime_24h.map(|v| format!("{:.1}", v)),
|
| 588 |
591 |
|
pom_uptime_7d: data.pom_uptime_7d.map(|v| format!("{:.1}", v)),
|
| 589 |
|
- |
pom_recent: data.pom_recent.iter().map(|s| PomSnapshotDisplay {
|
| 590 |
|
- |
checked_at: format_pom_timestamp(&s.checked_at),
|
| 591 |
|
- |
status: s.status.clone(),
|
| 592 |
|
- |
status_class: match s.status.as_str() {
|
|
592 |
+ |
pom_recent: data.pom_recent.into_iter().map(|s| {
|
|
593 |
+ |
let status_class = match s.status.as_str() {
|
| 593 |
594 |
|
"operational" => "status-ok".to_string(),
|
| 594 |
595 |
|
"degraded" => "status-warn".to_string(),
|
| 595 |
596 |
|
_ => "status-error".to_string(),
|
| 596 |
|
- |
},
|
| 597 |
|
- |
response_time_ms: s.response_time_ms,
|
|
597 |
+ |
};
|
|
598 |
+ |
PomSnapshotDisplay {
|
|
599 |
+ |
checked_at: format_pom_timestamp(&s.checked_at),
|
|
600 |
+ |
status: s.status,
|
|
601 |
+ |
status_class,
|
|
602 |
+ |
response_time_ms: s.response_time_ms,
|
|
603 |
+ |
}
|
| 598 |
604 |
|
}).collect(),
|
| 599 |
|
- |
pom_avg_latency: data.pom_avg_latency.clone(),
|
| 600 |
|
- |
pom_p95_latency: data.pom_p95_latency.clone(),
|
|
605 |
+ |
pom_avg_latency: data.pom_avg_latency,
|
|
606 |
+ |
pom_p95_latency: data.pom_p95_latency,
|
| 601 |
607 |
|
pom_incident_active: data.pom_incident.is_some(),
|
| 602 |
608 |
|
pom_incident_status: data.pom_incident.as_ref().map(|i| i.to_status.clone()),
|
| 603 |
609 |
|
pom_incident_since: data.pom_incident.as_ref().map(|i| format_pom_timestamp(&i.started_at)),
|
| 604 |
|
- |
pom_recent_incidents: data.pom_recent_incidents.iter().map(|i| PomIncidentDisplay {
|
| 605 |
|
- |
to_status: i.to_status.clone(),
|
|
610 |
+ |
pom_recent_incidents: data.pom_recent_incidents.into_iter().map(|i| PomIncidentDisplay {
|
| 606 |
611 |
|
started_at: format_pom_timestamp(&i.started_at),
|
| 607 |
612 |
|
duration: i.duration_secs.map(format_incident_duration).unwrap_or_else(|| "-".to_string()),
|
|
613 |
+ |
to_status: i.to_status,
|
| 608 |
614 |
|
}).collect(),
|
| 609 |
615 |
|
pom_routes_total: data.pom_routes_total,
|
| 610 |
616 |
|
pom_routes_ok: data.pom_routes_ok,
|