hive-c0re: the container stats comments and docs name the OTEL exporter as the consumer, not the removed tab
This commit is contained in:
parent
23cedf3fa8
commit
c875223db7
5 changed files with 16 additions and 15 deletions
|
|
@ -19,7 +19,7 @@
|
|||
//! absent field all fall back to the hive-wide
|
||||
//! `services.hyperhive.agentCpuQuota` / `agentMemoryMax`. So a swarm cap on
|
||||
//! memory alone leaves CPU on the hive default — see
|
||||
//! [`effective_from_with_swarm`].
|
||||
//! [`effective_from`].
|
||||
//!
|
||||
//! Read path: `lifecycle::host_config::write_dropins`, on every spawn
|
||||
//! and every rebuild.
|
||||
|
|
|
|||
|
|
@ -404,9 +404,9 @@ async fn cmd_serve(
|
|||
// ~hundreds of KB, and the /stats + hive-stats views read it
|
||||
// directly; pruning it would just lose trend history for no gain.)
|
||||
// Slow per-container disk sampler: hive-priv measures each agent's state/
|
||||
// + work/ + writable rootfs every 30 min, cached so the 5s container-load
|
||||
// poll stays cheap cgroup-only reads. Feeds `disk_bytes` on the LOAD
|
||||
// tab. See container_stats::disk_sampler_loop.
|
||||
// + work/ + writable rootfs every 30 min, cached so a sample only reads
|
||||
// cgroup files. Feeds `disk_bytes` to the OTEL exporter. See
|
||||
// container_stats::disk_sampler_loop.
|
||||
crate::container_stats::spawn_disk_sampler();
|
||||
// Per-agent container-resource OTEL export: rides the same
|
||||
// cgroup gauges out to the configured OTLP endpoint, reusing the hive
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Live per-agent-container resource load (CPU + memory, plus the slow
|
||||
//! disk sample from hive-priv in [`disk_sampler_loop`]) for the
|
||||
//! dashboard. Reads cgroup v2 stat files for each running agent
|
||||
//! disk sample from hive-priv in [`disk_sampler_loop`]) for the OTEL
|
||||
//! exporter. Reads cgroup v2 stat files for each running agent
|
||||
//! machine directly — same privsep-clean posture as the turn-stats
|
||||
//! sqlite reads (`cpu.stat` / `memory.*` are world-readable; no
|
||||
//! `hive-priv` needed). Runs host-side in hive-c0re, where
|
||||
|
|
@ -31,8 +31,8 @@ use utoipa::ToSchema;
|
|||
|
||||
use crate::coordinator::Coordinator;
|
||||
|
||||
/// Sampling interval for the two CPU reads. Short enough to keep the
|
||||
/// endpoint snappy, long enough that the delta isn't dominated by read
|
||||
/// Sampling interval for the two CPU reads. Short enough to keep a sample
|
||||
/// quick, long enough that the delta isn't dominated by read
|
||||
/// jitter.
|
||||
const CPU_SAMPLE: Duration = Duration::from_millis(200);
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ pub struct ContainerResource {
|
|||
const DISK_SAMPLE_INTERVAL: Duration = Duration::from_mins(30);
|
||||
|
||||
/// Last per-agent disk measurement, keyed by agent name; `None` is a failed
|
||||
/// one. Written by [`disk_sampler_loop`], read by [`gather`] so the hot
|
||||
/// poll never measures.
|
||||
/// one. Written by [`disk_sampler_loop`], read by [`gather`], so a sample
|
||||
/// never measures.
|
||||
fn disk_cache() -> &'static RwLock<HashMap<String, Option<u64>>> {
|
||||
static CACHE: OnceLock<RwLock<HashMap<String, Option<u64>>>> = OnceLock::new();
|
||||
CACHE.get_or_init(|| RwLock::new(HashMap::new()))
|
||||
|
|
@ -100,7 +100,7 @@ fn disk_reading(name: &hive_types::Ident, measured: anyhow::Result<u64>) -> Opti
|
|||
|
||||
/// Background loop: every [`DISK_SAMPLE_INTERVAL`], remeasure disk usage
|
||||
/// for every kept-state agent and refresh [`disk_cache`]. The first pass
|
||||
/// runs immediately so the dashboard shows disk shortly after boot.
|
||||
/// runs immediately so the exporter has disk shortly after boot.
|
||||
/// Runs forever; spawn once at hive-c0re startup via [`spawn_disk_sampler`].
|
||||
pub async fn disk_sampler_loop() {
|
||||
loop {
|
||||
|
|
|
|||
Loading…
Reference in a new issue