Skip to content

frontend: Use linux2rest network probe deltas for tray rates - #4048

Open
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:pr/network-txrx-sampler-rates
Open

frontend: Use linux2rest network probe deltas for tray rates#4048
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:pr/network-txrx-sampler-rates

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Derive tray upload/download speeds from linux2rest received_B / transmitted_B (sysinfo per-sample deltas) divided by the Sampler interval (5s), instead of re-differencing total_* across frontend polls.
  • That removes negative Mbps when totals reset and avoids flicker/spikes against the ≥0.9 sample cache.
  • NetworkCard now shows probe deltas alongside totals (same shape as linux2rest's own UI).
  • Also fixes the transmitted_B type docstring (was copy-pasted as "bytes received"), swaps the swapped mdi-cloud-upload/mdi-cloud-download icons on the byte rows, and rewords labels to Packets received/transmitted.

Closes #3587

Note: The target is BlueOS 1.5 only.

Test plan

  • Against BlueOS with linux2rest 0.9.x: enable eth0 Networking widget under steady traffic
  • Rate stays stable across 2s polls within a 5s sample window (no flicker to 0)
  • Rate updates when the Sampler advances; never goes negative
  • System Information → Network cards show delta / total for packets and bytes
  • Byte-row icons match direction (download on received, upload on transmitted)

Supersedes #4028 (recreated from fork joaoantoniocardoso/BlueOS-docker instead of same-repo head).

@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Switches the network tray rate calculation to consume received_B / transmitted_B (linux2rest's per-sample deltas) divided by a hardcoded 5 s Sampler interval, rather than re-diffing total_* across 2 s frontend polls. Also un-swaps the mdi-cloud-{upload,download} icons on NetworkCard.vue, adds delta / total on each row, drops the now-unused last_update? field on Network, and fixes the copy-pasted transmitted_B docstring.

1. Correctness & Implementation Bugs

  • 1.1 [minor] core/frontend/src/utils/networking.ts:3LINUX2REST_SYSTEM_SAMPLE_INTERVAL_S = 5 hardcodes a constant that lives inside the linux2rest binary. If the Sampler cadence upstream is ever bumped, formatBandwidth() in the tray silently reports wrong Mbps with no runtime signal. The TODO acknowledges this, but ideally either (a) linux2rest exposes the interval somewhere under /system-information/system and the frontend probes it once at boot, or (b) the store measures the wall-clock gap between the sampler transitions it actually observes (i.e. between polls where received_B changed). Not a merge blocker for 1.5; worth a follow-up ticket.
  • 1.2 [nit] core/frontend/src/store/system-information.ts:81fetchSystemNetworkTask still polls every 2000 ms, but with this change the same received_B value is returned on ~2 of 3 polls and produces the identical download_speed. That's the intended flicker-free behaviour, but it also means the tray's effective bandwidth-update cadence is now 5 s regardless. Consider raising the poll delay to match the Sampler (or keep the 2 s poll only if other fields on the network payload really need it).

5. UI / UX

  • 5.1 [nit] core/frontend/src/components/system-information/NetworkCard.vue:66,78,90,102{{ network.packets_received }} / {{ network.total_packets_received }} total reads visually as "12 out of 4 500 000", i.e. a fraction. Since the left value is a per-sample delta (~5 s window) and the right is a lifetime counter, wording like 12 last sample · 4 500 000 total — or splitting into two subtitle rows — would be less ambiguous. Same comment applies to the bytes rows.

8. Documentation

  • 8.1 [nit] core/frontend/src/types/system-information/system.ts:84-85 — while you're correcting the byte docstrings, packets_received / packets_transmitted still say "Number of packages ... since last probe". Since the UI labels in NetworkCard.vue were updated to Packets received/transmitted, flip "packages" → "packets" in the docstring for consistency.
  • 8.2 [nit] core/frontend/src/utils/networking.ts:1-2 — the TODO would be more actionable if it linked a follow-up issue (TODO(#4XXX): probe the interval from linux2rest) so the coupling flagged in 1.1 doesn't get forgotten.

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

Map tray upload/download speeds from received_B/transmitted_B divided by
the linux2rest Sampler interval instead of re-differencing total_* across
frontend polls. Show the same probe deltas on NetworkCard.
@joaoantoniocardoso
joaoantoniocardoso force-pushed the pr/network-txrx-sampler-rates branch from ee4d6a5 to 4f6856e Compare July 28, 2026 01:34
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.

Negative bandwidth (?)

1 participant