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

How to monitor the number of bytes transmitted, such as the total number of bytes received and sent #11127

Closed
jaceding opened this issue Apr 24, 2024 · 2 comments
Labels

Comments

@jaceding
Copy link

I use the GRPC library as the RPC implementation of the system. After optimizing the core algorithm of the system, the number of RPCs in the system will be reduced. However, I am also very concerned about whether the data transmission size has been reduced, but I do not know how to record the data transmission size, such as the total number of bytes sent and received.

Looking forward to your answer very much !!!

@larry-safran
Copy link
Contributor

There are several ways of handling this.

The simplest might be to use call tracing.

Another approach is to override the marshaller on the MethodDescriptor to do the counting and then delegate to the regular marshaller. We have a preserialized example that could be useful to you for this approach. You could do it either on the client or the server.

Another approach would be to use either ClientInterceptor or ServerInterceptor.
For ClientInterceptor you would implement interceptCall which will give you direct access to the outgoing request and in that method wrap the listener so that you could track the response.

@larry-safran
Copy link
Contributor

Hopefully my answer provided you a path forward. If you need further clarification we can reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants