Repository navigation
[GUI] Monitor: opt-in Network in card (STRATA_MONITOR_NET=1) - #506
Open
akimovaleks wants to merge 1 commit into
Open
akimovaleks wants to merge 1 commit into
akimovaleks wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=1set 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,/metricshas nonet_*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'snet_io_counters(pernic=True)andnet_if_stats()and addsnet_rx_mb,net_tx_mb(MB/s) andnet_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 isNonefor 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). Onlynet_rx_mb/net_tx_mbgo into the history, and only when on.serve/web/app.js: one more entry inMETRICSmarkedoptIn, built hidden;renderMonitorshows it only whenhardwarehasnet_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...) keepTelemetryobjects built without__init__(astest_telemetry_adldoes) sampling as before.Validation
Passed:
python -m unittestoverserve/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 withSTRATA_MONITOR_NETunset and=1. The same suites on 7cef952 without the change: 147 OK (40 skipped).python -m unittest serve.test_web_monitor_net serve.test_telemetry_adl: 28 OK, including the two node tests ofnetLine().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.terminal/tools/webtest/mock.mjsbehind a small proxy that adds thenet_*fields: the card shows6,5 MB/sandenp3s0 · 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 byserve/only, asSTRATA_MACOS_SENSORSis),tools/test_settings_register.pyOK.Failed:
Not run:
terminal/tools/webtest/browser_test.mjs(puppeteer-core not installed here).lo0and Windows interface names are covered by the unit test only.Limits
🤖 Generated with Claude Code