feat(transport): Metrics oriented connection upgrade
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
I am looking for a way to collect aggregate metrics for each stream/substream at the transport level. I think the best way to do this is to create a connection upgrade that just passes buffers through while also sending tuples of timestamp, direction (e.g. in or out), and buffer size over a user-provided bounded channel. I think this would allow upgrading of arbitrary/all streams/sub-streams with each upgraded connection sending their measurements over a bounded mpsc channel to logic that then calculates the aggregate metrics over time.
Motivation
Currently it is not simple/possible to collect metrics for all/some of the network activity at the transport level--below any protocols. These metrics are useful for analytics and debugging as well as nifty "stats for geeks" displays in rust-libp2p applications.
Requirements
- Upgrade a connection to add measuring the in/out bytes passing through it.
- Report the timestamped and annotated measurements over an mpsc channel if one has been supplied.
- Examples for upgrading single connections and all connections along with an example behavior that consumes the metrics and emits behavior events with aggregate metrics based on the config.
- Maybe the example network behavior speaks a protocol that allows for the aggregate metrics to be sent over the network to another peer.
Open questions
- Is a connection upgrade the correct/best way to do this?
- Is the consumption of the measurements and the generation of aggregate metrics best done in a network behavior?
Are you planning to do it yourself in a pull request?
Maybe
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the transport-level connection upgrade, stream/substream handling, and the proposed bounded mpsc channel. Compare the two open questions about upgrade placement and network-behavior aggregation before deciding on an approach. Done would include connection and all-connection examples plus a behavior example that consumes timestamped, directional byte measurements and emits aggregate metrics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100