-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Collect metrics for direct connections & add opt-in push metrics #2805
Open
matheus23
wants to merge
10
commits into
main
Choose a base branch
from
direct-connection-metrics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
## Description <!-- A summary of what this pull request achieves and a rough list of changes. --> ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented. --------- Co-authored-by: Ruediger Klaehn <[email protected]>
## Description <!-- A summary of what this pull request achieves and a rough list of changes. --> New metrics: - `nodes_contacted` - `nodes_contacted_directly` ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - ~~[ ] Tests if relevant.~~ - ~~[ ] All breaking changes documented.~~ --------- Co-authored-by: Diva M <[email protected]> Co-authored-by: Divma <[email protected]> Co-authored-by: Floris Bruynooghe <[email protected]>
## Description Adds four new magic socket metrics: 1. `nodes_contacted`: Number of nodes we have attempted to contact. 2. `nodes_contacted_directly`: Number of nodes we have managed to contact directly. 3. `connection_handshake_success`: Number of connections with a successful handshake. 4. `connection_became_direct`: Number of connections that became direct. This sets up to compute some core metrics regarding direct connections: 1. `nodes_contacted_directly` / `nodes_contacted`: Ratio of node pairs that manage to connect directly. 2. `connection_became_direct` / `connection_handshake_success`: Ratio of connections that can communicate directly Both of these metrics give us an idea on the number of network conditions that allow us to avoid relay traffic. Our hypothesis is that this number is around 90% & that it's similar between these two metrics, but it's worth capturing both to see if we're right. We also already capture enough information to get numbers on direct vs. relayed traffic volume: `recv_data_relay` / (`recv_data_ipv4` + `recv_data_ipv6`): Ratio of relay data vs. direct data. This metric will help us explain how much bandwidth you can save by using iroh-net. ## Breaking Changes - `MagicsockMetrics` is now `#[non_exhaustive]`. This allows us to add more metrics without breaking backwards compatibility in the future. The struct is not meant to be constructed outside of `iroh-net` anyways. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. No tests, but we verified this works manually at the retreat. - [x] All breaking changes documented.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2805/docs/iroh/ Last updated: 2024-10-18T07:47:31Z |
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.
New metrics
nodes_contacted
: Number of nodes we have attempted to contact.nodes_contacted_directly
: Number of nodes we have managed to contact directly.connection_handshake_success
: Number of connections with a successful handshake.connection_became_direct
: Number of connections that became direct.This sets up to compute some core metrics regarding direct connections:
nodes_contacted_directly
/nodes_contacted
: Ratio of node pairs that manage to connect directly.connection_became_direct
/connection_handshake_success
: Ratio of connections that can communicate directlyBoth of these metrics give us an idea on the number of network conditions that allow us to avoid relay traffic.
Our hypothesis is that this number is around 90% & that it's similar between these two metrics, but it's worth capturing both to see if we're right.
We also already capture enough information to get numbers on direct vs. relayed traffic volume:
recv_data_relay
/ (recv_data_ipv4
+recv_data_ipv6
): Ratio of relay data vs. direct data.This metric will help us explain how much bandwidth you can save by using iroh-net.
Opt-in Push Metrics Exporter
The
iroh::NodeConfig
now has a sectionmetrics_exporter_config
. This section looks like this:Breaking Changes
MagicsockMetrics
is now#[non_exhaustive]
. This allows us to addmore metrics without breaking backwards compatibility in the future. The
struct is not meant to be constructed outside of
iroh-net
anyways.Notes & open questions
Change checklist
(We tested this manually at the retreat at least. We don't have metrics tests at the moment.)