Log DA balancer stats on readiness timeout

This commit is contained in:
andrussal 2025-12-05 18:48:06 +01:00
parent ba0f87124d
commit 77026378e1

View File

@ -1216,7 +1216,8 @@ impl<'a> ReadinessCheck<'a> for DaBalancerReadiness<'a> {
.into_iter()
.map(|(label, threshold, stats)| {
let connected = connected_subnetworks(&stats);
format!("{label}: connected={connected}, required={threshold}")
let details = format_balancer_stats(&stats);
format!("{label}: connected={connected}, required={threshold}, stats={details}")
})
.collect::<Vec<_>>()
.join(", ");
@ -1235,6 +1236,17 @@ fn connected_subnetworks(stats: &BalancerStats) -> usize {
.count()
}
fn format_balancer_stats(stats: &BalancerStats) -> String {
if stats.is_empty() {
return "empty".into();
}
stats
.iter()
.map(|(subnet, stat)| format!("{}:in={},out={}", subnet, stat.inbound, stat.outbound))
.collect::<Vec<_>>()
.join(";")
}
fn build_timeout_summary(
labels: &[String],
infos: Vec<Libp2pInfo>,