Add agent hash display to system panel

Implement agent version tracking to diagnose deployment issues:
- Add get_agent_hash() method to extract Nix store hash from executable path
- Collect system_agent_hash metric in NixOS collector
- Display "Agent Hash" in system panel under NixOS section
- Update metric filtering to include agent hash

This helps identify which version of the agent is actually running
when troubleshooting deployment or metric collection issues.
This commit is contained in:
2025-10-23 17:33:45 +02:00
parent 4193a97737
commit c5ec529210
3 changed files with 55 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ pub struct SystemWidget {
// NixOS information
nixos_build: Option<String>,
active_users: Option<String>,
agent_hash: Option<String>,
// CPU metrics
cpu_load_1min: Option<f32>,
@@ -64,6 +65,7 @@ impl SystemWidget {
Self {
nixos_build: None,
active_users: None,
agent_hash: None,
cpu_load_1min: None,
cpu_load_5min: None,
cpu_load_15min: None,
@@ -313,6 +315,11 @@ impl Widget for SystemWidget {
self.active_users = Some(users.clone());
}
}
"system_agent_hash" => {
if let MetricValue::String(hash) = &metric.value {
self.agent_hash = Some(hash.clone());
}
}
// CPU metrics
"cpu_load_1min" => {
@@ -397,6 +404,11 @@ impl Widget for SystemWidget {
Span::styled(format!("Active users: {}", users_text), Typography::secondary())
]));
let agent_hash_text = self.agent_hash.as_deref().unwrap_or("unknown");
lines.push(Line::from(vec![
Span::styled(format!("Agent Hash: {}", agent_hash_text), Typography::secondary())
]));
// CPU section
lines.push(Line::from(vec![
Span::styled("CPU:", Typography::widget_title())