Skip to content

[GUI] Monitor: opt-in Network in card (STRATA_MONITOR_NET=1) - #506

Open
akimovaleks wants to merge 1 commit into
simplexai-labs:mainfrom
akimovaleks:gui-monitor-network-tile
Open

akimovaleks wants to merge 1 commit into
simplexai-labs:mainfrom
akimovaleks:gui-monitor-network-tile

Conversation

@akimovaleks

Copy link
Copy Markdown

Problem and result

The Monitor shows GPU, PCIe, CPU and disk traffic, but not the network. On a box that downloads models over the internet, or that serves other machines on the LAN, there is no way to see from the page whether the link is busy.

With STRATA_MONITOR_NET=1 set where the server starts, the Monitor gets a Network in card: MB/s received, and under it the cards counted, the same rate in Mbit/s and MB/s sent, with a sparkline. Unset (the default), nothing changes: the sampler reads no network counters, /metrics has no net_* fields and the card stays hidden.

Related discussion

#447. VecSzn: "a clean opt-in or low-overhead PR adding a network throughput tile is welcome." This PR is both: opt-in by an environment variable, like STRATA_MACOS_SENSORS.

Approach

  • serve/telemetry.py: with the variable set, each 1 s sample reads psutil's net_io_counters(pernic=True) and net_if_stats() and adds net_rx_mb, net_tx_mb (MB/s) and net_nics (the cards counted). It counts cards that are up and leaves out loopback (lo, lo0, Windows' Loopback Pseudo-Interface), containers, bridges, VM adapters and VPN tunnels (docker, veth, br-, virbr, vmnet, vboxnet, tun, tap, wg, tailscale, zt), since their bytes also cross a real card. The rate is None for the first reading, a counter that went back, or a change in the set of cards (a cable plugged in would otherwise show its whole counter as one second). Only net_rx_mb / net_tx_mb go into the history, and only when on.
  • serve/web/app.js: one more entry in METRICS marked optIn, built hidden; renderMonitor shows it only when hardware has net_rx_mb. A server without the change, or with the variable unset, keeps the page as it is.
  • docs/DETAILS.md: two sentences in the Monitor paragraph.

Class-level defaults (net = False ...) keep Telemetry objects built without __init__ (as test_telemetry_adl does) sampling as before.

Validation

Passed:

  • Ubuntu 24.04, Python 3.12.3, psutil 7.2.2, commit 7cef952 + this change: python -m unittest over serve/test_web_*.py serve/test_monitor*.py serve/test_telemetry*.py serve/test_frontend.py: 156 tests OK (42 skipped, node not installed there), both with STRATA_MONITOR_NET unset and =1. The same suites on 7cef952 without the change: 147 OK (40 skipped).
  • Windows 11, Python 3.12.3, Node 24.13.1 (psutil not installed, so the sampler tests use the stand-in): python -m unittest serve.test_web_monitor_net serve.test_telemetry_adl: 28 OK, including the two node tests of netLine().
  • Live reading on the same Ubuntu box (RTX 3070 Laptop server, interfaces lo enp2s0 enp3s0 docker0 br-… veth…, enp2s0 without a cable): _net() returned ['enp3s0'] and rates in MB/s; one call took 353 µs on an i3-10100 (1000 calls), i.e. about 0.04% of one core at one sample a second.
  • Browser check of the page with terminal/tools/webtest/mock.mjs behind a small proxy that adds the net_* fields: the card shows 6,5 MB/s and enp3s0 · 55 Mbit/s · out 0,3 MB/s; against the plain mock the card is hidden and the 9 cards show as before. No console errors besides the mock's expected 404 for /api/expert-heat.
  • python tools/settings_register.py --check --no-git: no difference (the variable is read by serve/ only, as STRATA_MACOS_SENSORS is), tools/test_settings_register.py OK.
  • An earlier always-on version of the same sampler code has run on that Ubuntu box's server (v0.2.20-poly.10) since 2026-12-05 without problems.

Failed:

  • none observed

Not run:

  • terminal/tools/webtest/browser_test.mjs (puppeteer-core not installed here).
  • macOS and a live Windows reading: the lo0 and Windows interface names are covered by the unit test only.
  • CUDA / HIP / SYCL / Metal builds: no engine files are touched.

Limits

  • One card for received traffic; sent traffic is in its subtitle, not a second sparkline.
  • The card adds up all real cards that are up; it does not tell the internet link from the LAN.
  • The hover hint and labels are English, like the rest of the Monitor.

🤖 Generated with Claude Code

With STRATA_MONITOR_NET=1 the hardware sampler adds net_rx_mb, net_tx_mb
and net_nics to /metrics: MB/s received and sent over the network cards
that are up, leaving out loopback, containers, bridges and VPN tunnels.
The Monitor tab then shows a Network in card with Mbit/s and MB/s sent
under it. Unset, the sampler reads no network counters, /metrics has no
net_* fields and the card stays hidden.

Refs simplexai-labs#447

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant