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
stats: include message header in stats.InPayload.WireLength #3886
Conversation
|
This aims to fix: #1647 |
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.
Thanks for catching this. Suggested a fix in another place.
rpc_util.go
Outdated
@@ -636,7 +636,7 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei | |||
return nil, err | |||
} | |||
if payInfo != nil { | |||
payInfo.wireLength = len(d) | |||
payInfo.wireLength = len(d) + headerLen |
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.
This field is in sync with payInfo.uncompressedBytes
(they both don't include the message header).
Add headerLen
when HandleRPC
is called?
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.
Can do!
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.
Thanks for the fix. LGTM.
grpc fixes it in grpc/grpc-go#3886
Summary
Currently, the
stats.InPayload.WireLength
actually under-reports the true WireSize of each received message by 5 bytes (headerLen
), as it does not include the size of the header going over the wire.However,
stats.OutPayload.WireLength
does include the size of the 5 byte header inWireLength
.This leads to the
InPayload.WireLength
not being equal to theOutPayload.WireLength
for the same underlying payload, which further leads to many weird accounting errors.