feat: log bandwidth on substream instead of socket level#3180
Merged
mergify[bot] merged 19 commits intoDec 19, 2022
Merged
Conversation
An alternative approach to libp2p#3161 suggested in libp2p#3157 (comment) Closes libp2p#3157
only within this crate
StreamMuxer level
mxinden
reviewed
Dec 2, 2022
Member
mxinden
left a comment
There was a problem hiding this comment.
Direction looks good to me. A couple of comments.
Co-authored-by: Max Inden <mail@max-inden.de>
also rename BandwidthLogging `new_with_sinks` to `new` rename BandwidthConnecLogging to InstrumentedStream
mxinden
reviewed
Dec 6, 2022
thomaseizinger
approved these changes
Dec 7, 2022
Contributor
thomaseizinger
left a comment
There was a problem hiding this comment.
Nice work, thank you!
One suggestion, otherwise happy with this modulo @mxinden's comments!
Contributor
|
I've updated the PR description to prepare this for merging so we have a decent commit message. |
Contributor
|
This pull request has merge conflicts. Could you please resolve them @melekes? 🙏 |
thomaseizinger
previously approved these changes
Dec 19, 2022
| @@ -136,6 +136,10 @@ env_logger = "0.10.0" | |||
| clap = { version = "4.0.13", features = ["derive"] } | |||
| tokio = { version = "1.15", features = ["io-util", "io-std", "macros", "rt", "rt-multi-thread"] } | |||
|
|
|||
Contributor
There was a problem hiding this comment.
Why split these with a newline?
Approvals have been dismissed because the PR was updated after the send-it label was applied.
thomaseizinger
approved these changes
Dec 19, 2022
mxinden
reviewed
Dec 19, 2022
Comment on lines
+139
to
+141
| libp2p-mplex = { version = "0.38.0", path = "muxers/mplex" } | ||
| libp2p-noise = { version = "0.41.0", path = "transports/noise" } | ||
| libp2p-tcp = { version = "0.38.0", path = "transports/tcp", features = ["tokio"] } |
Member
There was a problem hiding this comment.
Is it a deliberate choice to link these with a version?
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
Previously, the
with_bandwidth_loggingextension toTransportwould track the bytes sent and received on a socket level. This however only works in conjunction withTransportupgrades where a separate multiplexer is negotiated on top of a regular stream.With QUIC and WebRTC landing, this no longer works as those
Transports bring their own multiplexing stack. To still allow for tracking of bandwidth, we refactor thewith_bandwidth_loggingextension to count the bytes send on all substreams opened through aStreamMuxer. This works, regardless of the underlying transport technology. It does omit certain layers. However, there isn't necessarily a "correct" layer to count bandwidth on because you can always go down another layer (IP, Ethernet, etc).Closes #3157.
Change checklist