Skip to content
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

Merged
merged 2 commits into from Sep 25, 2020

Conversation

xstephen95x
Copy link
Contributor

@xstephen95x xstephen95x commented Sep 18, 2020

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 in WireLength.

This leads to the InPayload.WireLength not being equal to the OutPayload.WireLength for the same underlying payload, which further leads to many weird accounting errors.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 18, 2020

CLA Check
The committers are authorized under a signed CLA.

@xstephen95x
Copy link
Contributor Author

This aims to fix: #1647

@menghanl menghanl self-requested a review September 24, 2020 20:11
@menghanl menghanl self-assigned this Sep 24, 2020
Copy link
Contributor

@menghanl menghanl left a 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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do!

@menghanl menghanl added this to the 1.33 Release milestone Sep 24, 2020
Copy link
Contributor

@menghanl menghanl left a 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.

@menghanl menghanl changed the title Properly report stats.InPayload.WireLength stats: include message header in stats.InPayload.WireLength Sep 25, 2020
@menghanl menghanl merged commit e6c98a4 into grpc:master Sep 25, 2020
vadimi added a commit to vadimi/grpc-client-cli that referenced this pull request Oct 9, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants