Repository navigation
fix(telemetry): measure software throughput over the seconds bytes arrived in (#306 follow-up) - #328
Merged
Conversation
…rived in (#306 follow-up) networkThroughputMbps was a wall-clock mean over the 10 s byte window. The playback reader fetches a large range and then parks on backpressure until low water, so on a fast link most ticks of that window carry nothing: over a local origin a healthy 2.8 Mbps VP9 session pulled 16.4 MB in one tick and then exactly zero for the next 23, while its runway drained 16.0 -> 8.3 MB. The field published a confident 0.00 Mbps through all of it, which is the same false-with-confidence zero the issue was filed about, one field over. It now divides by the seconds that carried bytes, which is the quantity the native path already reports through observedBitrate, and it is nil rather than zero when nothing arrived in the window at all. Publishing the gap keeps the choice on the host side: a host that wants a held reading keeps the last non-nil value, while a host handed a zero cannot tell a parked reader from a dead link. The struggling arm is unchanged, which is the arm the section was already legible on: with a 2 Mbps paced origin every tick carries bytes, so both formulas agree and the session reads a steady 2.10 Mbps with ahead=0. Also corrects the readerWindowAheadBytes doc, which told hosts to divide the runway by the throughput. That yields how long the runway took to fetch, not how long it lasts at playback rate; the divisor is averageBitrateMbps, which is what the reporter had already worked out for themselves. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
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.
Refs #306. Found while verifying the retest on that issue, not reported.
What the retest surfaced
The reporter's Network section only read sensibly on a struggling session, and their healthy run showed blanks they attributed to "nothing to measure". Reproducing that here says the healthy case was worse than a blank.
networkThroughputMbpson the software path wasinstantBitrateMbps: demuxer bytes over a 10 s wall-clock window. The reader fetches a large range and then parks on backpressure until low water, so on a fast link most ticks of that window carry no bytes at all.Measured with
aetherctl playagainst a 42 MB / 2.8 Mbps VP9 source over a local range-serving origin, before the change:23 consecutive ticks of a confident
0.00 Mbpson a session playing perfectly, while the runway drained from 16.0 to 8.3 MB. That is the same false-with-confidence zero #306 was filed about, one field over. The reporter had already been bitten by it: they now guard on> 0rather than on non-nil, because their overlay renders any non-nil number it is handed.The change
Divide by the seconds that carried bytes, not by every second of the window, and publish nil rather than zero when nothing arrived in the window at all.
That is the quantity the native path already reports:
observedBitratein the access log is the rate observed during a download event, and the sampler already drops it when it is not positive. So the field means the same thing on both backends again, which was the point of having it.Publishing the gap rather than a zero keeps the choice on the host side, the same reasoning as shipping the runway in bytes: a host that wants a held reading keeps the last non-nil value, while a host handed a zero cannot tell a parked reader from a dead link.
After, same source and origin:
The arm that must not move
The throttled run is the one the section was already legible on. With a 2 Mbps paced origin (30 ms latency) every tick carries bytes, so
activeCount == countand both formulas agree:A 2.8 Mbps stream over a 2 Mbps link: steady link rate,
ahead=0,cushion=0. Unchanged, and the starvation signature stays readable.instantBitrateMbpsis deliberately left alone. It is bytes per wall second on both paths, which is what makes it the stream rate rather than the link rate, and hosts calibrate against it today.Also corrects the
readerWindowAheadBytesdoc comment, which told hosts to divide the runway by the throughput. That answers how long the runway took to fetch, not how long it will last at playback rate; the divisor isaverageBitrateMbps. The reporter had already worked that out and quietly done it the right way.Tests
Four in
Issue306SoftwareTelemetryTests, over the measured shape: the burst-then-park window reports its delivered rate rather than a wall-clock mean; a steadily paced link reads identically either way; an idle window and a single sample both publish nil; andRollingWindow.activeCountseparates the slots that carried bytes from the slots that exist.🤖 Generated with Claude Code
https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE