Skip to content

Compute network byte deltas in ProcessGroupStatsMonitor - #1383

Merged
meta-codesync[bot] merged 1 commit into
mainfrom
fix-network
Apr 27, 2026
Merged

Compute network byte deltas in ProcessGroupStatsMonitor#1383
meta-codesync[bot] merged 1 commit into
mainfrom
fix-network

Conversation

@mthrok

@mthrok mthrok commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

_read_network_bytes() reads cumulative counters from /proc/net/dev which include all traffic since the interface was brought up. The net_rx_bytes and net_tx_bytes fields in ProcessGroupResourceUsage were previously set to these raw cumulative values, making it difficult to interpret how much network I/O occurred during each monitoring interval.

This change computes deltas between consecutive snapshots, matching the pattern already used for cpu_percent. On the first snapshot, net_rx_bytes and net_tx_bytes are None (no previous value to diff against). The raw cumulative values are threaded through _collect_pgrp_stats as internal state so subsequent calls can compute the difference.

`_read_network_bytes()` reads cumulative counters from `/proc/net/dev` which include all traffic since the interface was brought up. The `net_rx_bytes` and `net_tx_bytes` fields in `ProcessGroupResourceUsage` were previously set to these raw cumulative values, making it difficult to interpret how much network I/O occurred during each monitoring interval.

This change computes deltas between consecutive snapshots, matching the pattern already used for `cpu_percent`. On the first snapshot, `net_rx_bytes` and `net_tx_bytes` are `None` (no previous value to diff against). The raw cumulative values are threaded through `_collect_pgrp_stats` as internal state so subsequent calls can compute the difference.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 27, 2026
@meta-codesync

meta-codesync Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D102658083. (Because this pull request was imported automatically, there will not be any future comments.)

@mthrok
mthrok marked this pull request as ready for review April 27, 2026 20:34
@meta-codesync
meta-codesync Bot merged commit a909cbf into main Apr 27, 2026
206 of 210 checks passed
@mthrok
mthrok deleted the fix-network branch April 27, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant