Backport: Add new protocol for ChannelHandler to get buffered bytes in the channel handler (#2918) #2982
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.
This is a backport of #2918.
Add new protocol to get buffered bytes from
ChannelHandler
s andChannelPipeline
API to query the buffered bytes fromChannelHandler
sMotivation:
In #2849, a new
ChannelOption
is introduced to retrieve the number of buffered outbound bytes in aChannel
. However, this solution does not account for bytes that may be buffered within individualChannelHandler
s. This PR builds on #2849 by adding functionality to audit buffered bytes residing inChannelHandler
s and exposing this information through newChannelPipeline
APIs.Modifications:
ChannelHandler
to audit buffered bytes for inbound and outbound.NIOOutboundByteBufferingChannelHandler
NIOInboundByteBufferingChannelHandler
ChannelPipeline
APIssyncOperations
)syncOperations
)Result:
Users can now easily query the amount of bytes buffered in
ChannelHandler
s using the newChannelPipeline
APIs, enhancing the visibility ofChannelHandler
performance.Co-authored-by: Cory Benfield [email protected]
(cherry picked from commit 9356598)