a3s_box_runtime/scale/
mod.rs1use a3s_box_core::scale::{InstanceHealth, InstanceState};
7use chrono::{DateTime, Utc};
8use serde::{Deserialize, Serialize};
9
10mod manager;
11mod registry;
12
13#[cfg(test)]
14mod tests;
15
16pub use manager::ScaleManager;
18pub use registry::InstanceRegistry;
19
20#[derive(Debug, Clone)]
22pub(super) struct ServiceInstances {
23 pub(super) target_replicas: u32,
25 pub(super) instances: Vec<TrackedInstance>,
27}
28
29#[derive(Debug, Clone)]
31pub(super) struct TrackedInstance {
32 pub(super) id: String,
33 pub(super) state: InstanceState,
34 pub(super) created_at: DateTime<Utc>,
35 pub(super) ready_at: Option<DateTime<Utc>>,
36 pub(super) endpoint: Option<String>,
37 pub(super) health: InstanceHealth,
38}
39
40#[derive(Debug, Clone, Default, Serialize, Deserialize)]
42pub struct ServiceHealth {
43 pub active_instances: u32,
45 pub ready_instances: u32,
47 pub busy_instances: u32,
49 pub avg_cpu_percent: Option<f32>,
51 pub total_memory_bytes: u64,
53 pub total_inflight_requests: u32,
55 pub unhealthy_instances: u32,
57}