1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Models for the Daemons API.
//!
//! This exposes daemon status information for monitoring.
use serde::{Deserialize, Serialize};
/// Status of a daemon.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum DaemonStatus {
Initializing,
Running,
Dead,
}
/// Statistics tracked for a daemon.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DaemonStats {
/// Total number of requests processed
pub requests_processed: u64,
/// Total number of requests that failed
pub requests_failed: u64,
/// Current number of requests being processed
pub requests_in_flight: usize,
}
/// Response model for a daemon.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DaemonResponse {
/// Unique ID of the daemon
pub id: String,
/// Current status
pub status: DaemonStatus,
/// Hostname where daemon is running
pub hostname: String,
/// Process ID
pub pid: i32,
/// Version string
pub version: String,
/// When the daemon started
pub started_at: i64,
/// Last heartbeat timestamp (for running daemons)
#[serde(skip_serializing_if = "Option::is_none")]
pub last_heartbeat: Option<i64>,
/// When the daemon stopped (for dead daemons)
#[serde(skip_serializing_if = "Option::is_none")]
pub stopped_at: Option<i64>,
/// Statistics
pub stats: DaemonStats,
/// Configuration snapshot (includes heartbeat_interval_ms and other config)
pub config: serde_json::Value,
}
/// Query parameters for listing daemons.
#[derive(Debug, Deserialize)]
pub struct ListDaemonsQuery {
/// Filter by status
#[serde(default)]
pub status: Option<DaemonStatus>,
}
/// Response for listing daemons.
#[derive(Debug, Serialize, Deserialize)]
pub struct ListDaemonsResponse {
pub daemons: Vec<DaemonResponse>,
}