Skip to content

feat(example): Improve path stat printing in transfer example#3860

Merged
matheus23 merged 5 commits intomainfrom
matheus23/ex-transfer-better-path-stats
Jan 21, 2026
Merged

feat(example): Improve path stat printing in transfer example#3860
matheus23 merged 5 commits intomainfrom
matheus23/ex-transfer-better-path-stats

Conversation

@matheus23
Copy link
Copy Markdown
Member

@matheus23 matheus23 commented Jan 15, 2026

Description

  • Improve path stat printing in the transfer example.

Before:

Path stats:
  Relay(RelayUrl("https://127.0.0.1:43765/")): RTT 73.884361ms, 11 packets sent
  Ip([3fff:172:20:20::1]:47128): RTT 1.255437ms, 1 packets sent

(also missing a bunch of stats from closed paths)

Now:

Path stats:
  Relay(RelayUrl("https://staging-euw1-1.relay.iroh.network./")): RTT 31.046345ms, tx=42738 rx=12
  Ip(176.199.209.244:26617): RTT 25.767613ms, tx=212 rx=17189
  Ip([2a02:8071:d85:19c0::232c]:52316): RTT 264.134µs, tx=13 rx=691477
  Ip(172.18.0.1:45901): RTT 280.83µs, tx=6 rx=16759
  Ip([3fff:172:20:20::1]:52316): RTT 274.261µs, tx=6 rx=7516
  Ip(192.168.0.99:45901): RTT 280.83µs, tx=6 rx=8550
  Ip(172.17.0.1:45901): RTT 2.591812ms, tx=3 rx=2
  Ip([2a02:8071:d85:19c0:c2fb:b929:b323:b940]:52316): RTT 2.607457ms, tx=3 rx=1
  Ip([2a02:8071:d85:19c0:aecd:32d7:7c59:81a2]:52316): RTT 2.607457ms, tx=3 rx=1
  Ip(172.20.20.1:45901): RTT 2.62841ms, tx=3 rx=1

Notes & open questions

There's also something else that's ... weird at least. When the connection is dropped, and we call PathInfo::stats, we get back the "fallback" value self.stats, but that's only set initially and never updated. So this will look like the stats at the end are suddenly drastically decreasing.


The transfer example now has two "side tasks": one for watching the path stats and one for watching the connection type.
I think I'd rather have them split than putting both of these tasks into one? Not sure if everyone might agree.

@matheus23 matheus23 self-assigned this Jan 15, 2026
@n0bot n0bot bot added this to iroh Jan 15, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 15, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3860/docs/iroh/

Last updated: 2026-01-21T09:50:52Z

@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Jan 15, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 15, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 3c1f029

@matheus23
Copy link
Copy Markdown
Member Author

Relevant issue: #3846

@dignifiedquire
Copy link
Copy Markdown
Contributor

ci sad

@matheus23
Copy link
Copy Markdown
Member Author

CI sad for reasons unrelated to this PR :/

  • The Wasm check fails because there's a new wasm-bindgen version
  • The cross check fails because it fails to bind IPv6 sockets

@matheus23 matheus23 requested a review from Frando January 21, 2026 09:48
@matheus23 matheus23 changed the title feat(iroh,example): Expose PathInfo::path_id and improve path stat printing in transfer example feat(iroh,example): Improve path stat printing in transfer example Jan 21, 2026
@matheus23 matheus23 changed the title feat(iroh,example): Improve path stat printing in transfer example feat(example): Improve path stat printing in transfer example Jan 21, 2026
Copy link
Copy Markdown
Member

@Frando Frando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually tested and this now indeed prints all paths finally. Makes the path stats much more useful indeed.

It is a bit of a pity that this rather convoluted task is needed, but that's how it is for now. If we find better APIs to expose path stats in iroh, we can update. But for now let's merge this to at least have something that properly shows path stats for a connection in our codebase.

@matheus23 matheus23 added this pull request to the merge queue Jan 21, 2026
Merged via the queue into main with commit c168e73 Jan 21, 2026
31 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Jan 21, 2026
@matheus23 matheus23 deleted the matheus23/ex-transfer-better-path-stats branch January 21, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants