Runners report the used and total space of their work dir filesystem, and the runner page draws it as a Storage graph beside CPU, memory and network, with a Storage column in its table
Browse files at this commit2ba0d23a44d200240745df30d319e9b26007f0a8Parent: 79e878f- feat
- runners report the used and total space of their work dir filesystem, and the runner page draws it as a Storage graph beside CPU, memory and network, with a Storage column in its table
- the Limits tab can set host headroom and the share of swap in the memory budget, the last two runner.toml fields the UI did not have
- a runner's Jobs tab links each job to its page and its repo to the repo
9 changed files +131 -12
- crates/forge-ci/src/proto.rs +5 -0
- crates/forge-core/src/ci.rs +16 -0
- crates/forge-runner/src/config.rs +19 -0
- crates/forge-runner/src/metrics.rs +20 -2
- crates/forge-runner/src/runner.rs +1 -0
- crates/forge-web/src/ci/metrics_chart.rs +9 -0
- crates/forge-web/src/pages/admin_runners.rs +58 -8
- docs/ci.md +2 -1
- style/_admin_rows.scss +1 -1
crates/forge-ci/src/proto.rsmodified+5 -0
| @@ -153,6 +153,11 @@ pub struct RunnerSample { | |||
| 153 | /// Received and sent bytes per second over every interface but loopback. | 153 | /// Received and sent bytes per second over every interface but loopback. |
| 154 | pub net_rx_bytes_per_s: u64, | 154 | pub net_rx_bytes_per_s: u64, |
| 155 | pub net_tx_bytes_per_s: u64, | 155 | pub net_tx_bytes_per_s: u64, |
| 156 | + /// Used and total bytes of the filesystem holding the runner's work dir. Zero from older runners. | ||
| 157 | + #[serde(default)] | ||
| 158 | + pub disk_used_bytes: u64, | ||
| 159 | + #[serde(default)] | ||
| 160 | + pub disk_total_bytes: u64, | ||
| 156 | /// Jobs running on the runner. | 161 | /// Jobs running on the runner. |
| 157 | pub running_jobs: u32, | 162 | pub running_jobs: u32, |
| 158 | } | 163 | } |
crates/forge-core/src/ci.rsmodified+16 -0
| @@ -233,6 +233,14 @@ pub const RUNNER_FIELDS: &[RunnerField] = &[ | |||
| 233 | key: "limits.memory_budget", | 233 | key: "limits.memory_budget", |
| 234 | kind: FieldKind::Live, | 234 | kind: FieldKind::Live, |
| 235 | }, | 235 | }, |
| 236 | + RunnerField { | ||
| 237 | + key: "limits.memory_headroom", | ||
| 238 | + kind: FieldKind::Restart, | ||
| 239 | + }, | ||
| 240 | + RunnerField { | ||
| 241 | + key: "limits.budget_swap_percent", | ||
| 242 | + kind: FieldKind::Restart, | ||
| 243 | + }, | ||
| 236 | RunnerField { | 244 | RunnerField { |
| 237 | key: "limits.cpus", | 245 | key: "limits.cpus", |
| 238 | kind: FieldKind::Restart, | 246 | kind: FieldKind::Restart, |
| @@ -378,6 +386,14 @@ pub fn validate_runner_field( | |||
| 378 | Err("memory_budget is auto, or looks like 6g or 6144m".into()) | 386 | Err("memory_budget is auto, or looks like 6g or 6144m".into()) |
| 379 | } | 387 | } |
| 380 | } | 388 | } |
| 389 | + "limits.memory_headroom" => { | ||
| 390 | + if size_in_range(raw, 0, 1 << 50) { | ||
| 391 | + Ok(Value::from(raw)) | ||
| 392 | + } else { | ||
| 393 | + Err("memory_headroom looks like 1g or 512m".into()) | ||
| 394 | + } | ||
| 395 | + } | ||
| 396 | + "limits.budget_swap_percent" => int_in(raw, 0, 100, "budget_swap_percent"), | ||
| 381 | "limits.cpus" => { | 397 | "limits.cpus" => { |
| 382 | let ok = raw.parse::<f64>().is_ok_and(|n| n > 0.0 && n <= 1024.0) | 398 | let ok = raw.parse::<f64>().is_ok_and(|n| n > 0.0 && n <= 1024.0) |
| 383 | && raw.chars().all(|c| c.is_ascii_digit() || c == '.'); | 399 | && raw.chars().all(|c| c.is_ascii_digit() || c == '.'); |
crates/forge-runner/src/config.rsmodified+19 -0
| @@ -333,6 +333,14 @@ impl RunnerConfig { | |||
| 333 | "limits.memory_budget".into(), | 333 | "limits.memory_budget".into(), |
| 334 | json!(self.limits.memory_budget.as_deref().unwrap_or("auto")), | 334 | json!(self.limits.memory_budget.as_deref().unwrap_or("auto")), |
| 335 | ); | 335 | ); |
| 336 | + m.insert( | ||
| 337 | + "limits.memory_headroom".into(), | ||
| 338 | + json!(self.limits.memory_headroom), | ||
| 339 | + ); | ||
| 340 | + m.insert( | ||
| 341 | + "limits.budget_swap_percent".into(), | ||
| 342 | + json!(self.limits.budget_swap_percent), | ||
| 343 | + ); | ||
| 336 | m.insert("limits.cpus".into(), json!(self.limits.cpus)); | 344 | m.insert("limits.cpus".into(), json!(self.limits.cpus)); |
| 337 | m.insert("limits.pids".into(), json!(self.limits.pids)); | 345 | m.insert("limits.pids".into(), json!(self.limits.pids)); |
| 338 | m.insert( | 346 | m.insert( |
| @@ -396,6 +404,17 @@ impl RunnerConfig { | |||
| 396 | self.limits.memory_budget = (v != "auto").then(|| v.to_owned()); | 404 | self.limits.memory_budget = (v != "auto").then(|| v.to_owned()); |
| 397 | }) | 405 | }) |
| 398 | .is_some(), | 406 | .is_some(), |
| 407 | + "limits.memory_headroom" => value | ||
| 408 | + .as_str() | ||
| 409 | + .filter(|v| forge_ci::size::parse_size(v).is_some()) | ||
| 410 | + .map(|v| self.limits.memory_headroom = v.to_owned()) | ||
| 411 | + .is_some(), | ||
| 412 | + "limits.budget_swap_percent" => value | ||
| 413 | + .as_u64() | ||
| 414 | + .and_then(|v| u32::try_from(v).ok()) | ||
| 415 | + .filter(|v| *v <= 100) | ||
| 416 | + .map(|v| self.limits.budget_swap_percent = v) | ||
| 417 | + .is_some(), | ||
| 399 | "limits.cpus" => value | 418 | "limits.cpus" => value |
| 400 | .as_str() | 419 | .as_str() |
| 401 | .map(|v| self.limits.cpus = v.to_owned()) | 420 | .map(|v| self.limits.cpus = v.to_owned()) |
crates/forge-runner/src/metrics.rsmodified+20 -2
| @@ -4,6 +4,7 @@ | |||
| 4 | //! host without a readable `/proc` nothing is sampled and nothing is sent. | 4 | //! host without a readable `/proc` nothing is sampled and nothing is sent. |
| 5 | 5 | ||
| 6 | use std::collections::VecDeque; | 6 | use std::collections::VecDeque; |
| 7 | +use std::path::Path; | ||
| 7 | use std::time::{Duration, Instant}; | 8 | use std::time::{Duration, Instant}; |
| 8 | 9 | ||
| 9 | use forge_ci::proto::{RunnerMetricsBatch, RunnerSample}; | 10 | use forge_ci::proto::{RunnerMetricsBatch, RunnerSample}; |
| @@ -30,6 +31,8 @@ pub struct Snapshot { | |||
| 30 | pub mem_available: u64, | 31 | pub mem_available: u64, |
| 31 | pub rx: u64, | 32 | pub rx: u64, |
| 32 | pub tx: u64, | 33 | pub tx: u64, |
| 34 | + pub disk_used: u64, | ||
| 35 | + pub disk_total: u64, | ||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | /// `(busy, total)` jiffies of the first `cpu ` line of `/proc/stat`. Idle includes iowait. | 38 | /// `(busy, total)` jiffies of the first `cpu ` line of `/proc/stat`. Idle includes iowait. |
| @@ -91,13 +94,14 @@ pub fn parse_net_dev(text: &str) -> Option<(u64, u64)> { | |||
| 91 | } | 94 | } |
| 92 | 95 | ||
| 93 | /// Reads the three `/proc` files. `None` when any of them is missing or unreadable. | 96 | /// Reads the three `/proc` files. `None` when any of them is missing or unreadable. |
| 94 | -pub fn read_snapshot() -> Option<Snapshot> { | 97 | +pub fn read_snapshot(work_dir: &Path) -> Option<Snapshot> { |
| 95 | let stat = std::fs::read_to_string("/proc/stat").ok()?; | 98 | let stat = std::fs::read_to_string("/proc/stat").ok()?; |
| 96 | let mem = std::fs::read_to_string("/proc/meminfo").ok()?; | 99 | let mem = std::fs::read_to_string("/proc/meminfo").ok()?; |
| 97 | let net = std::fs::read_to_string("/proc/net/dev").ok()?; | 100 | let net = std::fs::read_to_string("/proc/net/dev").ok()?; |
| 98 | let (busy, total) = parse_cpu(&stat)?; | 101 | let (busy, total) = parse_cpu(&stat)?; |
| 99 | let (mem_total, mem_available) = parse_mem(&mem)?; | 102 | let (mem_total, mem_available) = parse_mem(&mem)?; |
| 100 | let (rx, tx) = parse_net_dev(&net)?; | 103 | let (rx, tx) = parse_net_dev(&net)?; |
| 104 | + let (disk_used, disk_total) = disk_usage(work_dir).unwrap_or((0, 0)); | ||
| 101 | Some(Snapshot { | 105 | Some(Snapshot { |
| 102 | busy, | 106 | busy, |
| 103 | total, | 107 | total, |
| @@ -105,9 +109,20 @@ pub fn read_snapshot() -> Option<Snapshot> { | |||
| 105 | mem_available, | 109 | mem_available, |
| 106 | rx, | 110 | rx, |
| 107 | tx, | 111 | tx, |
| 112 | + disk_used, | ||
| 113 | + disk_total, | ||
| 108 | }) | 114 | }) |
| 109 | } | 115 | } |
| 110 | 116 | ||
| 117 | +/// Used and total bytes of the filesystem holding `path`. | ||
| 118 | +pub fn disk_usage(path: &Path) -> Option<(u64, u64)> { | ||
| 119 | + let stat = nix::sys::statvfs::statvfs(path).ok()?; | ||
| 120 | + let unit = stat.fragment_size(); | ||
| 121 | + let total = stat.blocks().checked_mul(unit)?; | ||
| 122 | + let free = stat.blocks_free().checked_mul(unit)?; | ||
| 123 | + Some((total.saturating_sub(free), total)) | ||
| 124 | +} | ||
| 125 | + | ||
| 111 | /// Turns successive snapshots into samples. The first snapshot only sets the baseline. | 126 | /// Turns successive snapshots into samples. The first snapshot only sets the baseline. |
| 112 | #[derive(Default)] | 127 | #[derive(Default)] |
| 113 | pub struct Sampler { | 128 | pub struct Sampler { |
| @@ -145,6 +160,8 @@ impl Sampler { | |||
| 145 | mem_total_bytes: snap.mem_total, | 160 | mem_total_bytes: snap.mem_total, |
| 146 | net_rx_bytes_per_s: rate(snap.rx, before.rx), | 161 | net_rx_bytes_per_s: rate(snap.rx, before.rx), |
| 147 | net_tx_bytes_per_s: rate(snap.tx, before.tx), | 162 | net_tx_bytes_per_s: rate(snap.tx, before.tx), |
| 163 | + disk_used_bytes: snap.disk_used, | ||
| 164 | + disk_total_bytes: snap.disk_total, | ||
| 148 | running_jobs, | 165 | running_jobs, |
| 149 | }) | 166 | }) |
| 150 | } | 167 | } |
| @@ -157,6 +174,7 @@ impl Sampler { | |||
| 157 | pub async fn ship( | 174 | pub async fn ship( |
| 158 | client: ForgeClient, | 175 | client: ForgeClient, |
| 159 | runner_secret: String, | 176 | runner_secret: String, |
| 177 | + work_dir: std::path::PathBuf, | ||
| 160 | running: impl Fn() -> u32 + Send + 'static, | 178 | running: impl Fn() -> u32 + Send + 'static, |
| 161 | stop: CancellationToken, | 179 | stop: CancellationToken, |
| 162 | ) { | 180 | ) { |
| @@ -172,7 +190,7 @@ pub async fn ship( | |||
| 172 | }; | 190 | }; |
| 173 | if !stopping { | 191 | if !stopping { |
| 174 | ticks += 1; | 192 | ticks += 1; |
| 175 | - if let Some(snap) = read_snapshot() { | 193 | + if let Some(snap) = read_snapshot(&work_dir) { |
| 176 | let now = Instant::now(); | 194 | let now = Instant::now(); |
| 177 | if let Some(sample) = sampler.feed(now, snap, running(), now_ms()) { | 195 | if let Some(sample) = sampler.feed(now, snap, running(), now_ms()) { |
| 178 | if buffer.len() >= CAPACITY { | 196 | if buffer.len() >= CAPACITY { |
crates/forge-runner/src/runner.rsmodified+1 -0
| @@ -175,6 +175,7 @@ impl Runner { | |||
| 175 | let metrics_shipper = tokio::spawn(metrics::ship( | 175 | let metrics_shipper = tokio::spawn(metrics::ship( |
| 176 | self.client.clone(), | 176 | self.client.clone(), |
| 177 | self.config.runner_secret.clone(), | 177 | self.config.runner_secret.clone(), |
| 178 | + self.config.work_dir.clone(), | ||
| 178 | move || { | 179 | move || { |
| 179 | let busy = limiter.current().saturating_sub(limiter.free_slots()); | 180 | let busy = limiter.current().saturating_sub(limiter.free_slots()); |
| 180 | u32::try_from(busy).unwrap_or(u32::MAX) | 181 | u32::try_from(busy).unwrap_or(u32::MAX) |
crates/forge-web/src/ci/metrics_chart.rsmodified+9 -0
| @@ -38,6 +38,8 @@ pub struct Bucket { | |||
| 38 | pub mem_total: f64, | 38 | pub mem_total: f64, |
| 39 | pub rx: f64, | 39 | pub rx: f64, |
| 40 | pub tx: f64, | 40 | pub tx: f64, |
| 41 | + pub disk_used: f64, | ||
| 42 | + pub disk_total: f64, | ||
| 41 | /// The most jobs running in any sample of the bucket. | 43 | /// The most jobs running in any sample of the bucket. |
| 42 | pub running: u32, | 44 | pub running: u32, |
| 43 | } | 45 | } |
| @@ -100,6 +102,8 @@ pub fn chart_points(samples: &[RunnerSample], now_ms: i64) -> Vec<Option<Bucket> | |||
| 100 | mem_total: 0.0, | 102 | mem_total: 0.0, |
| 101 | rx: 0.0, | 103 | rx: 0.0, |
| 102 | tx: 0.0, | 104 | tx: 0.0, |
| 105 | + disk_used: 0.0, | ||
| 106 | + disk_total: 0.0, | ||
| 103 | running: 0, | 107 | running: 0, |
| 104 | }, | 108 | }, |
| 105 | 0.0, | 109 | 0.0, |
| @@ -111,6 +115,8 @@ pub fn chart_points(samples: &[RunnerSample], now_ms: i64) -> Vec<Option<Bucket> | |||
| 111 | bucket.mem_total = bucket.mem_total.max(s.mem_total_bytes as f64); | 115 | bucket.mem_total = bucket.mem_total.max(s.mem_total_bytes as f64); |
| 112 | bucket.rx += s.net_rx_bytes_per_s as f64; | 116 | bucket.rx += s.net_rx_bytes_per_s as f64; |
| 113 | bucket.tx += s.net_tx_bytes_per_s as f64; | 117 | bucket.tx += s.net_tx_bytes_per_s as f64; |
| 118 | + bucket.disk_used += s.disk_used_bytes as f64; | ||
| 119 | + bucket.disk_total = bucket.disk_total.max(s.disk_total_bytes as f64); | ||
| 114 | bucket.running = bucket.running.max(s.running_jobs); | 120 | bucket.running = bucket.running.max(s.running_jobs); |
| 115 | *count += 1.0; | 121 | *count += 1.0; |
| 116 | } | 122 | } |
| @@ -121,6 +127,7 @@ pub fn chart_points(samples: &[RunnerSample], now_ms: i64) -> Vec<Option<Bucket> | |||
| 121 | bucket.mem_used /= count; | 127 | bucket.mem_used /= count; |
| 122 | bucket.rx /= count; | 128 | bucket.rx /= count; |
| 123 | bucket.tx /= count; | 129 | bucket.tx /= count; |
| 130 | + bucket.disk_used /= count; | ||
| 124 | bucket | 131 | bucket |
| 125 | }) | 132 | }) |
| 126 | }) | 133 | }) |
| @@ -253,6 +260,8 @@ mod tests { | |||
| 253 | mem_total_bytes: 0, | 260 | mem_total_bytes: 0, |
| 254 | net_rx_bytes_per_s: 0, | 261 | net_rx_bytes_per_s: 0, |
| 255 | net_tx_bytes_per_s: 0, | 262 | net_tx_bytes_per_s: 0, |
| 263 | + disk_used_bytes: 0, | ||
| 264 | + disk_total_bytes: 0, | ||
| 256 | running_jobs: 0, | 265 | running_jobs: 0, |
| 257 | } | 266 | } |
| 258 | } | 267 | } |
crates/forge-web/src/pages/admin_runners.rsmodified+58 -8
| @@ -33,7 +33,9 @@ use crate::i18n::admin::{self as g, K}; | |||
| 33 | use crate::i18n::releases_ci as rc; | 33 | use crate::i18n::releases_ci as rc; |
| 34 | use crate::i18n::{self, Key, Lang}; | 34 | use crate::i18n::{self, Key, Lang}; |
| 35 | use crate::pages::admin_users::admin_only; | 35 | use crate::pages::admin_users::admin_only; |
| 36 | -use crate::pages::ci_runs::{age_text, duration_text, events_response, run_href, state_text}; | 36 | +use crate::pages::ci_runs::{ |
| 37 | + age_text, duration_text, events_response, job_href, run_href, state_text, | ||
| 38 | +}; | ||
| 37 | use crate::pages::repo_mirrors::stamp_in_tz; | 39 | use crate::pages::repo_mirrors::stamp_in_tz; |
| 38 | use crate::state::AppState; | 40 | use crate::state::AppState; |
| 39 | use crate::views::parts::{SubPart, confirm_act, head, post_act, reveal}; | 41 | use crate::views::parts::{SubPart, confirm_act, head, post_act, reveal}; |
| @@ -740,6 +742,8 @@ const TABS: [(&str, &[&str]); 8] = [ | |||
| 740 | "limits.memory", | 742 | "limits.memory", |
| 741 | "limits.reserve_memory", | 743 | "limits.reserve_memory", |
| 742 | "limits.memory_budget", | 744 | "limits.memory_budget", |
| 745 | + "limits.memory_headroom", | ||
| 746 | + "limits.budget_swap_percent", | ||
| 743 | "limits.cpus", | 747 | "limits.cpus", |
| 744 | "limits.pids", | 748 | "limits.pids", |
| 745 | ], | 749 | ], |
| @@ -808,6 +812,8 @@ fn field_text(lang: Lang, key: &str) -> &'static str { | |||
| 808 | "limits.memory" => s(lang, "Memory limit", "Bellek sınırı"), | 812 | "limits.memory" => s(lang, "Memory limit", "Bellek sınırı"), |
| 809 | "limits.reserve_memory" => s(lang, "Default reservation", "Varsayılan ayırma"), | 813 | "limits.reserve_memory" => s(lang, "Default reservation", "Varsayılan ayırma"), |
| 810 | "limits.memory_budget" => s(lang, "Memory budget", "Bellek bütçesi"), | 814 | "limits.memory_budget" => s(lang, "Memory budget", "Bellek bütçesi"), |
| 815 | + "limits.memory_headroom" => s(lang, "Host headroom", "Sunucu payı"), | ||
| 816 | + "limits.budget_swap_percent" => s(lang, "Swap in budget (%)", "Bütçedeki takas (%)"), | ||
| 811 | "limits.cpus" => s(lang, "CPU limit", "CPU sınırı"), | 817 | "limits.cpus" => s(lang, "CPU limit", "CPU sınırı"), |
| 812 | "limits.pids" => s(lang, "Process limit", "İşlem sınırı"), | 818 | "limits.pids" => s(lang, "Process limit", "İşlem sınırı"), |
| 813 | "work_dir" => s(lang, "Work directory", "Çalışma dizini"), | 819 | "work_dir" => s(lang, "Work directory", "Çalışma dizini"), |
| @@ -886,6 +892,7 @@ fn detail_fields(lang: Lang, tab: &str, fields: &[FieldRow]) -> Vec<DetailField> | |||
| 886 | let is_number = matches!( | 892 | let is_number = matches!( |
| 887 | f.key, | 893 | f.key, |
| 888 | "limits.pids" | 894 | "limits.pids" |
| 895 | + | "limits.budget_swap_percent" | ||
| 889 | | "limits.image_max_gb" | 896 | | "limits.image_max_gb" |
| 890 | | "limits.job_disk_gb" | 897 | | "limits.job_disk_gb" |
| 891 | | "images.keep_days" | 898 | | "images.keep_days" |
| @@ -914,7 +921,11 @@ fn detail_fields(lang: Lang, tab: &str, fields: &[FieldRow]) -> Vec<DetailField> | |||
| 914 | "text" | 921 | "text" |
| 915 | }, | 922 | }, |
| 916 | min: if f.key == "concurrency" { "1" } else { "0" }, | 923 | min: if f.key == "concurrency" { "1" } else { "0" }, |
| 917 | - max: (f.key == "concurrency").then_some("64"), | 924 | + max: match f.key { |
| 925 | + "concurrency" => Some("64"), | ||
| 926 | + "limits.budget_swap_percent" => Some("100"), | ||
| 927 | + _ => None, | ||
| 928 | + }, | ||
| 918 | options: if choices.is_empty() { | 929 | options: if choices.is_empty() { |
| 919 | Vec::new() | 930 | Vec::new() |
| 920 | } else { | 931 | } else { |
| @@ -1011,6 +1022,8 @@ struct RunnerJobRow { | |||
| 1011 | name: String, | 1022 | name: String, |
| 1012 | /// `owner/name` of the job's repo. | 1023 | /// `owner/name` of the job's repo. |
| 1013 | repo: String, | 1024 | repo: String, |
| 1025 | + repo_href: String, | ||
| 1026 | + job_href: String, | ||
| 1014 | run_href: String, | 1027 | run_href: String, |
| 1015 | /// `#` and the run's number. | 1028 | /// `#` and the run's number. |
| 1016 | run_text: String, | 1029 | run_text: String, |
| @@ -1035,6 +1048,8 @@ fn runner_job_row(lang: Lang, job: &RunnerJob) -> RunnerJobRow { | |||
| 1035 | RunnerJobRow { | 1048 | RunnerJobRow { |
| 1036 | name: j.name.clone(), | 1049 | name: j.name.clone(), |
| 1037 | run_href: run_href(&repo, job.run_number), | 1050 | run_href: run_href(&repo, job.run_number), |
| 1051 | + job_href: job_href(&repo, &j.id), | ||
| 1052 | + repo_href: format!("/{repo}"), | ||
| 1038 | repo, | 1053 | repo, |
| 1039 | run_text: format!("#{}", job.run_number), | 1054 | run_text: format!("#{}", job.run_number), |
| 1040 | state_text: state_text(lang, j.state.as_str()), | 1055 | state_text: state_text(lang, j.state.as_str()), |
| @@ -1143,6 +1158,7 @@ struct MxRow { | |||
| 1143 | time: String, | 1158 | time: String, |
| 1144 | cpu: String, | 1159 | cpu: String, |
| 1145 | mem: String, | 1160 | mem: String, |
| 1161 | + disk: String, | ||
| 1146 | rx: String, | 1162 | rx: String, |
| 1147 | tx: String, | 1163 | tx: String, |
| 1148 | } | 1164 | } |
| @@ -1160,6 +1176,10 @@ fn mem_of(b: &Bucket) -> f64 { | |||
| 1160 | b.mem_used | 1176 | b.mem_used |
| 1161 | } | 1177 | } |
| 1162 | 1178 | ||
| 1179 | +fn disk_of(b: &Bucket) -> f64 { | ||
| 1180 | + b.disk_used | ||
| 1181 | +} | ||
| 1182 | + | ||
| 1163 | fn rx_of(b: &Bucket) -> f64 { | 1183 | fn rx_of(b: &Bucket) -> f64 { |
| 1164 | b.rx | 1184 | b.rx |
| 1165 | } | 1185 | } |
| @@ -1197,7 +1217,15 @@ fn clock_hm(at_ms: i64) -> String { | |||
| 1197 | 1217 | ||
| 1198 | /// The memory caption: `Memory 5.1 GiB of 7.6 GiB`. | 1218 | /// The memory caption: `Memory 5.1 GiB of 7.6 GiB`. |
| 1199 | fn memory_text(lang: Lang, used: f64, total: f64) -> String { | 1219 | fn memory_text(lang: Lang, used: f64, total: f64) -> String { |
| 1200 | - let label = s(lang, "Memory", "Bellek"); | 1220 | + used_text(s(lang, "Memory", "Bellek"), lang, used, total) |
| 1221 | +} | ||
| 1222 | + | ||
| 1223 | +/// The storage caption: `Storage 41 GiB of 75 GiB`. | ||
| 1224 | +fn storage_text(lang: Lang, used: f64, total: f64) -> String { | ||
| 1225 | + used_text(s(lang, "Storage", "Depolama"), lang, used, total) | ||
| 1226 | +} | ||
| 1227 | + | ||
| 1228 | +fn used_text(label: &str, lang: Lang, used: f64, total: f64) -> String { | ||
| 1201 | let sep = s(lang, "of", "/"); | 1229 | let sep = s(lang, "of", "/"); |
| 1202 | format!( | 1230 | format!( |
| 1203 | "{label} {} {sep} {}", | 1231 | "{label} {} {sep} {}", |
| @@ -1289,6 +1317,11 @@ fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsVie | |||
| 1289 | .flatten() | 1317 | .flatten() |
| 1290 | .map(|b| b.mem_total) | 1318 | .map(|b| b.mem_total) |
| 1291 | .fold(0.0_f64, f64::max); | 1319 | .fold(0.0_f64, f64::max); |
| 1320 | + let disk_total = points | ||
| 1321 | + .iter() | ||
| 1322 | + .flatten() | ||
| 1323 | + .map(|b| b.disk_total) | ||
| 1324 | + .fold(0.0_f64, f64::max); | ||
| 1292 | let net_top = metrics_chart::net_max(&points); | 1325 | let net_top = metrics_chart::net_max(&points); |
| 1293 | let cpu_caption = match latest { | 1326 | let cpu_caption = match latest { |
| 1294 | Some(b) => format!("CPU {:.0}%", b.cpu), | 1327 | Some(b) => format!("CPU {:.0}%", b.cpu), |
| @@ -1298,6 +1331,10 @@ fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsVie | |||
| 1298 | Some(b) => memory_text(lang, b.mem_used, b.mem_total), | 1331 | Some(b) => memory_text(lang, b.mem_used, b.mem_total), |
| 1299 | None => format!("{} -", s(lang, "Memory", "Bellek")), | 1332 | None => format!("{} -", s(lang, "Memory", "Bellek")), |
| 1300 | }; | 1333 | }; |
| 1334 | + let disk_caption = match latest { | ||
| 1335 | + Some(b) => storage_text(lang, b.disk_used, b.disk_total), | ||
| 1336 | + None => format!("{} -", s(lang, "Storage", "Depolama")), | ||
| 1337 | + }; | ||
| 1301 | let net_caption = match latest { | 1338 | let net_caption = match latest { |
| 1302 | Some(b) => format!("↓ {} ↑ {}", rate_text(b.rx), rate_text(b.tx)), | 1339 | Some(b) => format!("↓ {} ↑ {}", rate_text(b.rx), rate_text(b.tx)), |
| 1303 | None => "↓ - ↑ -".to_owned(), | 1340 | None => "↓ - ↑ -".to_owned(), |
| @@ -1330,6 +1367,17 @@ fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsVie | |||
| 1330 | Vec::new(), | 1367 | Vec::new(), |
| 1331 | s(lang, "Memory over the last hour", "Bellek, son bir saat"), | 1368 | s(lang, "Memory over the last hour", "Bellek, son bir saat"), |
| 1332 | ); | 1369 | ); |
| 1370 | + let disk = mx_chart( | ||
| 1371 | + &points, | ||
| 1372 | + disk_total, | ||
| 1373 | + &[(disk_of, "mx-line")], | ||
| 1374 | + false, | ||
| 1375 | + &|v| bytes_text(v as u64), | ||
| 1376 | + &|b| vec![storage_text(lang, b.disk_used, b.disk_total)], | ||
| 1377 | + disk_caption, | ||
| 1378 | + Vec::new(), | ||
| 1379 | + s(lang, "Storage over the last hour", "Depolama, son bir saat"), | ||
| 1380 | + ); | ||
| 1333 | let net = mx_chart( | 1381 | let net = mx_chart( |
| 1334 | &points, | 1382 | &points, |
| 1335 | net_top, | 1383 | net_top, |
| @@ -1356,13 +1404,14 @@ fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsVie | |||
| 1356 | time: clock_hm(b.at_ms), | 1404 | time: clock_hm(b.at_ms), |
| 1357 | cpu: format!("{:.0}%", b.cpu), | 1405 | cpu: format!("{:.0}%", b.cpu), |
| 1358 | mem: bytes_text(b.mem_used as u64), | 1406 | mem: bytes_text(b.mem_used as u64), |
| 1407 | + disk: bytes_text(b.disk_used as u64), | ||
| 1359 | rx: rate_text(b.rx), | 1408 | rx: rate_text(b.rx), |
| 1360 | tx: rate_text(b.tx), | 1409 | tx: rate_text(b.tx), |
| 1361 | }) | 1410 | }) |
| 1362 | .collect(); | 1411 | .collect(); |
| 1363 | MetricsView { | 1412 | MetricsView { |
| 1364 | empty, | 1413 | empty, |
| 1365 | - charts: vec![cpu, mem, net], | 1414 | + charts: vec![cpu, mem, disk, net], |
| 1366 | rows, | 1415 | rows, |
| 1367 | } | 1416 | } |
| 1368 | } | 1417 | } |
| @@ -1445,7 +1494,7 @@ async fn runner_detail_view( | |||
| 1445 | } else { | 1494 | } else { |
| 1446 | budget_facts | 1495 | budget_facts |
| 1447 | }; | 1496 | }; |
| 1448 | - let facts = [cpu_facts, mem_facts, String::new()]; | 1497 | + let facts = [cpu_facts, mem_facts, String::new(), String::new()]; |
| 1449 | // A runner that has reported nothing has no figures to show, only the note below. | 1498 | // A runner that has reported nothing has no figures to show, only the note below. |
| 1450 | let has_host = !metrics.empty || runner.reported.cpus.is_some(); | 1499 | let has_host = !metrics.empty || runner.reported.cpus.is_some(); |
| 1451 | Ok(view! { | 1500 | Ok(view! { |
| @@ -1542,13 +1591,14 @@ async fn runner_detail_view( | |||
| 1542 | <summary class="act">(s(lang, "Show as table", "Tablo olarak göster"))</summary> | 1591 | <summary class="act">(s(lang, "Show as table", "Tablo olarak göster"))</summary> |
| 1543 | <div class="table-wrap mx-table-scroll"> | 1592 | <div class="table-wrap mx-table-scroll"> |
| 1544 | <table class="table"> | 1593 | <table class="table"> |
| 1545 | - <thead><tr><th>(s(lang, "Time (UTC)", "Saat (UTC)"))</th><th>(s(lang, "CPU", "CPU"))</th><th>(s(lang, "Memory", "Bellek"))</th><th>(s(lang, "Received", "Alınan"))</th><th>(s(lang, "Sent", "Gönderilen"))</th></tr></thead> | 1594 | + <thead><tr><th>(s(lang, "Time (UTC)", "Saat (UTC)"))</th><th>(s(lang, "CPU", "CPU"))</th><th>(s(lang, "Memory", "Bellek"))</th><th>(s(lang, "Storage", "Depolama"))</th><th>(s(lang, "Received", "Alınan"))</th><th>(s(lang, "Sent", "Gönderilen"))</th></tr></thead> |
| 1546 | <tbody> | 1595 | <tbody> |
| 1547 | for row in metrics.rows.iter() { | 1596 | for row in metrics.rows.iter() { |
| 1548 | <tr> | 1597 | <tr> |
| 1549 | <td class="nowrap">(row.time.as_str())</td> | 1598 | <td class="nowrap">(row.time.as_str())</td> |
| 1550 | <td class="nowrap">(row.cpu.as_str())</td> | 1599 | <td class="nowrap">(row.cpu.as_str())</td> |
| 1551 | <td class="nowrap">(row.mem.as_str())</td> | 1600 | <td class="nowrap">(row.mem.as_str())</td> |
| 1601 | + <td class="nowrap">(row.disk.as_str())</td> | ||
| 1552 | <td class="nowrap">(row.rx.as_str())</td> | 1602 | <td class="nowrap">(row.rx.as_str())</td> |
| 1553 | <td class="nowrap">(row.tx.as_str())</td> | 1603 | <td class="nowrap">(row.tx.as_str())</td> |
| 1554 | </tr> | 1604 | </tr> |
| @@ -1628,7 +1678,7 @@ async fn runner_detail_view( | |||
| 1628 | <p class="state">(s(lang, "Not running any job.", "Hiçbir iş çalıştırmıyor."))</p> | 1678 | <p class="state">(s(lang, "Not running any job.", "Hiçbir iş çalıştırmıyor."))</p> |
| 1629 | } | 1679 | } |
| 1630 | for job in running_jobs.iter() { | 1680 | for job in running_jobs.iter() { |
| 1631 | - <div class="line"><span class=(job.state_class) title=(job.state_text.as_str()) aria-label=(job.state_text.as_str())></span><span class="name">(job.name.as_str())</span><span class="val">(job.repo.as_str())</span><span class="val"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></span><span class="val">(job.duration.as_str()) " · " (s(lang, "waited", "bekleme")) " " (job.waited.as_str())</span></div> | 1681 | + <div class="line"><span class=(job.state_class) title=(job.state_text.as_str()) aria-label=(job.state_text.as_str())></span><a class="name" href=(job.job_href.as_str())>(job.name.as_str())</a><span class="val"><a href=(job.repo_href.as_str())>(job.repo.as_str())</a></span><span class="val"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></span><span class="val">(job.duration.as_str()) " · " (s(lang, "waited", "bekleme")) " " (job.waited.as_str())</span></div> |
| 1632 | } | 1682 | } |
| 1633 | </section> | 1683 | </section> |
| 1634 | <section class="sec"> | 1684 | <section class="sec"> |
| @@ -1638,7 +1688,7 @@ async fn runner_detail_view( | |||
| 1638 | } | 1688 | } |
| 1639 | <div class="runner-recent"> | 1689 | <div class="runner-recent"> |
| 1640 | for job in recent_jobs.iter() { | 1690 | for job in recent_jobs.iter() { |
| 1641 | - <div class="line"><span class=(job.state_class) title=(job.state_text.as_str()) aria-label=(job.state_text.as_str())></span><span class="name">(job.name.as_str())</span><span class="val">(job.repo.as_str())</span><span class="val"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></span><span class="val">(job.duration.as_str()) " · " (s(lang, "waited", "bekleme")) " " (job.waited.as_str())</span><span class="val"><time data-rel="true" datetime=(job.finished_at.as_str())>(job.finished_ago.as_str())</time></span></div> | 1691 | + <div class="line"><span class=(job.state_class) title=(job.state_text.as_str()) aria-label=(job.state_text.as_str())></span><a class="name" href=(job.job_href.as_str())>(job.name.as_str())</a><span class="val"><a href=(job.repo_href.as_str())>(job.repo.as_str())</a></span><span class="val"><a href=(job.run_href.as_str())>(job.run_text.as_str())</a></span><span class="val">(job.duration.as_str()) " · " (s(lang, "waited", "bekleme")) " " (job.waited.as_str())</span><span class="val"><time data-rel="true" datetime=(job.finished_at.as_str())>(job.finished_ago.as_str())</time></span></div> |
| 1642 | } | 1692 | } |
| 1643 | </div> | 1693 | </div> |
| 1644 | </section> | 1694 | </section> |
docs/ci.mdmodified+2 -1
| @@ -662,7 +662,8 @@ starts, with the secret and registry passwords left out. Fields come in three ki | |||
| 662 | 662 | ||
| 663 | - Live: `concurrency`, `labels`, `limits.reserve_memory` and `limits.memory_budget`, applied on the | 663 | - Live: `concurrency`, `labels`, `limits.reserve_memory` and `limits.memory_budget`, applied on the |
| 664 | runner's next check-in. | 664 | runner's next check-in. |
| 665 | -- Restart needed: `auto_update`, `executor`, `work_dir`, `sandbox.userns`, the `limits.*` values, | 665 | +- Restart needed: `auto_update`, `executor`, `work_dir`, `sandbox.userns`, the other `limits.*` values |
| 666 | + (`memory_headroom` and `budget_swap_percent` included), | ||
| 666 | `images.keep_days` and `cache_max_gib`. The forge stores the value now and the runner applies it to | 667 | `images.keep_days` and `cache_max_gib`. The forge stores the value now and the runner applies it to |
| 667 | its in-memory config when it next starts, so `runner.toml` on disk is never rewritten. The row says | 668 | its in-memory config when it next starts, so `runner.toml` on disk is never rewritten. The row says |
| 668 | "restart needed" until the runner has started with it. | 669 | "restart needed" until the runner has started with it. |
style/_admin_rows.scssmodified+1 -1
| @@ -85,7 +85,7 @@ | |||
| 85 | 85 | ||
| 86 | @media (min-width: 900px) { | 86 | @media (min-width: 900px) { |
| 87 | .mx-panels { | 87 | .mx-panels { |
| 88 | - grid-template-columns: repeat(3, minmax(0, 1fr)); | 88 | + grid-template-columns: repeat(4, minmax(0, 1fr)); |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||