fix: Rename throughput fields from mbps to mb_s for correctness#113
Conversation
The throughput fields were named average_throughput_mbps and peak_throughput_mbps, which conventionally means "megabits per second." However, the calculation divides bytes_per_second by 1,000,000, producing megabytes per second (MB/s). This rename corrects the field names to match the actual unit. Changes: - Rename average_throughput_mbps → average_throughput_mb_s - Rename peak_throughput_mbps → peak_throughput_mb_s - Update doc comments from "megabits" to "megabytes per second (MB/s)" - Remove workaround comments that acknowledged the mismatch - Update JSON example in README.md - All tests passing, clippy clean Fixes: #112 BREAKING CHANGE: Serialized JSON field names changed from *_mbps to *_mb_s. Downstream consumers must update accordingly. AI-assisted-by: Claude Opus 4 (Cursor agent) Made-with: Cursor
📈 Changed lines coverage: 70.00% (7/10)🚨 Uncovered lines in this PR
📊 Code Coverage Summary
|
dustinblack
left a comment
There was a problem hiding this comment.
The problem is clear — the fields say "mbps" but the calculation produces megabytes, not megabits. The workaround comments in the code confirm this has been a known issue.
However, I'm not sure mb_s obviously solves the ambiguity. In a snake_case field name, the mb vs MB distinction (lowercase = megabits, uppercase = megabytes per SI) is lost, so average_throughput_mb_s could still be read either way.
Can we consider alternatives?
average_throughput_megabytes_per_sec— verbose but unambiguousaverage_throughput_bytes_per_sec— report raw bytes, let consumers convert (most precise, no unit confusion possible)- Keep the current field names but fix the doc comments and document the unit as MB/s in the JSON schema
Any of these would more clearly resolve the ambiguity. What do you think?
Rename average_throughput_mb_s → average_throughput_megabytes_per_sec and peak_throughput_mb_s → peak_throughput_megabytes_per_sec for unambiguous field naming in serialized output. AI-assisted-by: Claude Opus 4 (Cursor agent) Made-with: Cursor
📈 Changed lines coverage: 64.29% (9/14)🚨 Uncovered lines in this PR
📊 Code Coverage Summary
|
|
I agree. It's changed to: |
dustinblack
left a comment
There was a problem hiding this comment.
Verbose field names are unambiguous. Clean rename, CI green. Approved.
sberg-rh
left a comment
There was a problem hiding this comment.
Looks good, no issues here.
Summary
average_throughput_mbps→average_throughput_mb_sandpeak_throughput_mbps→peak_throughput_mb_sacross structs,serialization, and display logic
"megabytes per second (MB/s)" to match the actual calculation
BREAKING CHANGE: Serialized JSON field names changed from
*_mbpsto*_mb_s. Downstream consumers must update accordingly.Fixes #112
Test plan
cargo checkcompiles cleanlycargo test— all 290 tests passcargo clippy --all-targets -- -D warnings— no warningscargo fmt— no formatting issuesmbpsormegabitreferences inchanged files
Made with Cursor