Resource consumption history

Dashboard → Resources (d while the Dashboard has focus) shows recorded CPU time, disk reads/writes and sampled RAM peaks. Choose a workspace or host to inspect its CPU, RAM and I/O graphs over 1 hour, 24 hours, 7 days or 30 days. The terminal, browser and desktop application use the same components and controller API.

Host collection runs in the existing execution-host heartbeat. Workspace counters use a separate minute sampler, independent of slow full inventory/reconciliation, even when every UI is closed. It reads only managed container identities and fresh Docker/cgroup counters, without storage scans, process trees, nested Docker discovery or conversations. It does not start an agent or require a daemon in each workspace. Container I/O history starts after the observer/controller update; old I/O cannot be reconstructed retrospectively.

Measurements

Metric Workspace container Execution host
CPU utilization Docker/cgroup utilization; 100% means one CPU core, so values above 100% are valid Sampled utilization of total host capacity, from 0% to 100%
CPU time Difference between cumulative container CPU-hour counters Integral of sampled host utilization × CPU count; available only with a trustworthy boot identity
RAM Existing runtime memoryCurrentBytes measurement Existing host used-memory measurement (total − free), which can include cache
Disk read/write Differences between cumulative container block-I/O byte counters Physical Linux whole-device diskstats sectors × 512 bytes; partitions and virtual stacking layers are excluded
Disk space Not scanned by the lightweight sampler; use the separate Storage inventory Latest used bytes on the configured devctrl data filesystem

Disk space and disk I/O are different. I/O rates divide interval byte deltas by observed interval duration; network traffic is separate. Network filesystems and cached reads may not appear as local physical block I/O. Host I/O needs the existing read-only host procfs mount and compatible sysfs topology. Unsupported platforms, unavailable counters and ambiguous topology produce unknown, not zero.

The first sample establishes a baseline and has no CPU-time/I/O delta. A genuine measured zero stays zero. Counter decreases, changed container ID/start time and host reboot start new baselines. Missing intervals longer than three minutes are gaps; no usage is extrapolated across them. Unknown host boot identity also prevents estimating host CPU time across samples. One missing/reset counter makes the overall summary partial even when other metrics continue arriving.

Containers can contain several sessions or repositories. Their measurements belong to the workspace container and are not divided among sessions. Dedicated Docker-in-Docker sidecar usage contributes to host-wide measurements; this history does not attribute that sidecar to individual sessions. Current runtime inventory still exposes engine/workload measurements separately.

Graphs and totals

CPU and RAM values are sampled means, weighted by sample count when buckets combine. Each RAM bucket also retains its sampled maximum. Downsampling sums CPU-time and I/O deltas. Graph gaps are unknown, not claimed idle time.

The overall summary covers all authorized resources matching the scope, including resources on other pages. CPU time and I/O add across those resources. “Largest measured RAM peak” is the largest individual resource peak, not peaks summed across unrelated times or simultaneous fleet RAM usage. Observed seconds add across resources and can exceed the selected wall-clock period.

Host and workspace totals are separate scopes; adding both would double-count container usage included in the host. Changing scope or period loads a separate bounded page and graph.

Persistence and migration

SQLite stores at most one fresh observation per resource per minute. Counter baselines survive controller restarts. Stale, repeated and future-dated observations are ignored.

resource_history_sources stores the latest baseline and collection-time ownership; resource_history_samples stores the minute/hourly series. The previous host CPU/RAM metric_samples table and operator /v1/metrics/:hostId endpoint remain compatible.

Existing host CPU/RAM history is imported as hourly means and sampled RAM peaks, without inventing old CPU-hours or I/O. Each accepted host minute observation imports up to 24 preceding hours using indexed, hour-sized queries, newest first. A durable per-host cursor resumes after restart. The first pass provides the previous 24 hours; up to 30 days backfill over subsequent heartbeats. Import never overlaps the first live observation's hour or rewrites conversation history.

API and access

GET /v1/resource-history?scope=workspace&period=24h&limit=12
GET /v1/resource-history?scope=workspace&period=7d&resourceId=WORKSPACE_ID
GET /v1/resource-history?scope=host&period=1h

Use nextCursor for the next resource page. Responses include summary, resources[].points, resources[].totals, resources[].latest, coverage and retention. History is absent from /v1/state and its regular UI snapshots.

Execution hosts publish bounded reports to POST /v1/agents/:id/resource-history using their own agent credential. The controller derives ownership and verifies the existing workspace, host, container identity/start time and sample freshness; reports cannot select an owner. New observers advertise workspace-resource-history-v1, so late full inventories cannot overwrite their fresh counter baselines. Older observers retain the full-inventory fallback.

Authenticated server users see only history recorded for their workspace containers. Whole-host history is infrastructure-administrator-only because it includes other users and infrastructure. Ownership cannot be selected in query arguments. Public session links do not expose this API.

The read-only session MCP tool get_resource_history accepts only period (1h, 24h, 7d, 30d) and reads the authenticated current workspace. It cannot select another workspace, user or host. The Control Room can use its existing operator API discovery/request tools for broader diagnostics within its authority.

Validation

Tests cover persisted baselines, zero versus unknown, independent counter resets, container recreation, host reboot, offline gaps, repeated inventory, all-page summaries, tenant filtering, API validation, MCP scope, minute/hour rollups, legacy backfill and bounded graph resolution. Runtime fixtures cover physical devices, partitions, virtual layers, malformed counters and unsupported platforms. UI tests exercise period/scope changes, loading, failed requests, pagination and focus behavior.