forked from geomind_code/zinit_archive2
in stats bar #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
show system cpu.mem
but also sum of all processes, so we see how much we take from total
should be mbit/sec
so we know how much goes out
Implementation Spec for Issue #8 — Stats Bar Improvements
Objective
Improve the global stats sidebar to show:
Requirements
processes_stats()batch function, then sum results.system.statsJSON:managed_cpu_percent(f32) andmanaged_memory_bytes(u64).openrpc.jsonschema updated accordingly.Files to Modify/Create
crates/hero_proc_lib/src/db/jobs/model.rs— Addget_running_pids()SQL functioncrates/hero_proc_lib/src/db/factory.rs— Exposerunning_pids()onJobsApicrates/hero_proc_server/src/rpc/system.rs— Collect PIDs, sum stats, add new fields to responsecrates/hero_proc_server/openrpc.json— Addmanaged_cpu_percentandmanaged_memory_bytestoSystemStatsschemacrates/hero_proc_ui/static/js/dashboard.js— Track poll timestamp, addformatMbps(), updateupdateAdminSidebarto show managed stats and Mbit/sec networkcrates/hero_proc_ui/templates/base.html— Add secondary HTML elements for managed CPU and managed memoryImplementation Plan
Step 1 — Add
get_running_pidsto DB model layerFile:
crates/hero_proc_lib/src/db/jobs/model.rsSELECT pid FROM jobs WHERE phase IN ('running','retrying') AND pid IS NOT NULLVec<u32>Step 2 — Expose
running_pids()onJobsApiFile:
crates/hero_proc_lib/src/db/factory.rsrunning_pids()method toJobsApithat calls the model functionStep 3 — Extend
system.statsRPC handlerFile:
crates/hero_proc_server/src/rpc/system.rsdb.jobs.running_pids(), thensysmon::processes_stats(), sum cpu% and memory_bytesmanaged_cpu_percentandmanaged_memory_bytesto JSON responseStep 4 — Update OpenRPC schema
File:
crates/hero_proc_server/openrpc.jsonmanaged_cpu_percentandmanaged_memory_bytestoSystemStatsschemaStep 5 — Frontend: timestamp tracking +
formatMbpshelperFile:
crates/hero_proc_ui/static/js/dashboard.jslastStatsTimestampvariableloadSystemStats()formatMbps(byteDelta, elapsedSec)helperStep 6 — Frontend: update sidebar to show Mbit/sec and managed stats
File:
crates/hero_proc_ui/static/js/dashboard.jsupdateAdminSidebar(stats, elapsedSec)signatureformatMbpsStep 7 — HTML: add secondary elements to CPU and Memory widgets
File:
crates/hero_proc_ui/templates/base.html<div id="admin-managed-cpu">in CPU widget<div id="admin-managed-mem">in Memory widgetAcceptance Criteria
system.statsreturnsmanaged_cpu_percentandmanaged_memory_bytes0/0.0openrpc.jsonschema reflects the two new fieldsNotes
bytes * 8 / elapsed_sec / 1_000_000managed_cpu_percentis per-core summed (sysinfo semantics) — can exceed system-wide CPU%. Consider a tooltip.Test Results
Failed Tests
commands::config_ops::tests::test_config_diff_help— panicked atconfig diff help should succeed(tests/integration/tests/commands/config_ops.rs:57)commands::config_ops::tests::test_config_import_help— panicked atconfig import help should succeed(tests/integration/tests/commands/config_ops.rs:37)commands::system_commands::tests::test_reload_help— panicked atreload help should succeed(tests/integration/tests/commands/system_commands.rs:31)Test Suite Breakdown
hero_proc_integration_tests(unit fixtures + harness)bulk_operationsservice_managementcli_integrationWarnings
unused import: crate::db::actions::model::ActionSpecinhero_proc_lib/src/db/integration_tests.rs:614function shell_escape is never usedintests/integration/src/fixtures.rs:84function add_loop_service is never usedintests/integration/tests/service_management.rs:23function add_dependent_service is never usedintests/integration/tests/service_management.rs:37Notes
The 3 failing tests are all CLI help-text assertions — they check that certain subcommands (
config diff,config import,reload) exist and return a successful exit code when invoked with--help. These failures suggest those subcommands may be missing or renamed in the current build.Run: 2026-03-18 | Branch:
development_kristof_ttydImplementation committed:
8757c4cBrowse:
lhumina_code/hero_proc@8757c4c