-
Notifications
You must be signed in to change notification settings - Fork 975
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: log bandwidth on substream instead of socket level #3180
feat: log bandwidth on substream instead of socket level #3180
Conversation
An alternative approach to libp2p#3161 suggested in libp2p#3157 (comment) Closes libp2p#3157
only within this crate
StreamMuxer
levelThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direction looks good to me. A couple of comments.
Co-authored-by: Max Inden <[email protected]>
also rename BandwidthLogging `new_with_sinks` to `new` rename BandwidthConnecLogging to InstrumentedStream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thank you!
One suggestion, otherwise happy with this modulo @mxinden's comments!
I've updated the PR description to prepare this for merging so we have a decent commit message. |
This pull request has merge conflicts. Could you please resolve them @melekes? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@@ -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"] } | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why split these with a newline?
Approvals have been dismissed because the PR was updated after the send-it
label was applied.
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"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a deliberate choice to link these with a version
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be fixed with #3261.
Description
Previously, the
with_bandwidth_logging
extension toTransport
would track the bytes sent and received on a socket level. This however only works in conjunction withTransport
upgrades where a separate multiplexer is negotiated on top of a regular stream.With QUIC and WebRTC landing, this no longer works as those
Transport
s bring their own multiplexing stack. To still allow for tracking of bandwidth, we refactor thewith_bandwidth_logging
extension 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