fix(proto): ensure stats reported in Discarded events are updated#728
Merged
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/noq/pr/728/docs/noq/ Last updated: 2026-06-28T13:30:30Z |
Performance Comparison Report
|
| Scenario | noq | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5455.9 Mbps | 7962.7 Mbps | -31.5% | 95.1% / 100.0% |
| medium-concurrent | 5434.4 Mbps | 7877.6 Mbps | -31.0% | 94.6% / 100.0% |
| medium-single | 3813.4 Mbps | 4550.6 Mbps | -16.2% | 97.1% / 153.0% |
| small-concurrent | 3867.9 Mbps | 5322.5 Mbps | -27.3% | 90.4% / 98.9% |
| small-single | 3500.7 Mbps | 4653.7 Mbps | -24.8% | 89.8% / 97.7% |
Netsim Benchmarks (network simulation)
| Condition | noq | upstream | Delta |
|---|---|---|---|
| ideal | 3067.7 Mbps | 4028.6 Mbps | -23.9% |
| lan | 796.3 Mbps | 805.2 Mbps | -1.1% |
| lossy | 69.9 Mbps | 69.8 Mbps | ~0% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
noq is 26.2% slower on average
matheus23
approved these changes
Jun 29, 2026
Comment on lines
+3391
to
+3393
| // This ensures snapshot values (like rtt) are properly updated. | ||
| let path_stats = self.path_stats(path_id).unwrap_or_default(); | ||
| self.path_stats.discard(&path_id); |
Member
There was a problem hiding this comment.
Oof this took me a while to realize that self.path_stats is doing a lot more than just return path stats, and self.path_stats.discard can't just do this work for me.
Thanks, nice catch!
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.
Description
PathStatshas a lot of values that are cumulative counters and so, those areupdated as their respective actions are performed. Some other values, like rtt,
are snapshots: views of the current state, and so, are only updated on demand.
When a path is discarded, it used to call
Connection::path_statswhichperforms the update, but it was lost in a refactor. As a consequence, those
values were no longer being updated before the final stats were returned in the
Discardedevent, despite the comment explaining the need to do so remainingin the code.
This fixes the issue by updating the stats and adds a test. Yes, it's a stats
only test, but the fact this was properly done at some point and regressed
later is evidence this is needed.
Small consequence is that the return type of
PathStatsMap::discardis nolonger needed/useful.
Breaking Changes
n/a
Notes & open questions
n/a
Change checklist