grpc-go
grpc-go copied to clipboard
examples: add an example to illustrate the usage of stats handler
RELEASE NOTES:
- In accordance with issue #5454, I have added an example illustrating the use of
stats.Handlerin theexamples/features/stats_monitoring/directory.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: Yash-Handa / name: Yash Handa (1aa49947beb76ca766b608beb93b5e333f8ff85f)
Hi @easwars,
Thanks for the review. I made some trivial changes and added usage of ctx from the TagRPC and TagConn methods (client side, for now).
I require some suggestions though,
Please print the complete
Beginstruct, and the same comment applies for other cases as well. Thanks.
The example prints custom messages for different stats.ConnStats so that a switch block can be used (It clarifies different types of stats.ConnStats). But if a general message is printed for all the types like: log.Printf("[HandleRPC] [%T]: %+[1]v", stat), then the switch cases will become redundant.
A plus point is: a single package (implementation) of statsHandler could be easily shared between the server and the client as requested.
Let me know if a general print statement would be enough (instead of the switch case block) so that I can implement the same changes on the server code and extract the statsHandler in another package.
This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.
Let me know if a general print statement would be enough (instead of the switch case block) so that I can implement the same changes on the server code and extract the statsHandler in another package.
@Yash-Handa : Yes, a general print statement should be good enough. Thank you for doing this.
I saw a commit recently on this PR. Please let me know when this is ready to looked at again. Thanks for doing this.
Hi @easwars, apologies for the delay.
Updated the example with the following:
- Abstract the
stats.Handlerinterface into thestatshandlerpackage. - Generalized log statements for
HandleRPCandHandleConn. - Other minor fixes.
Let me know if further changes are required : )
This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.
Hi @easwars, made the requested changes.
Side Note:
If you suggest, once this pull request is merged, I can create a new pull request breaking pb import into echogrpc and echopb in other examples as well. Let me know about it.
Hi @easwars,
Made all required changes to pass the vet check.
Let me know if further changes are required : )
@dfawley : For second set of eyes. Thank you.
Hi @dfawley and @easwars,
Added TagRPC(context.Context, *RPCTagInfo) context.Context and TagConn(context.Context, *ConnTagInfo) context.Context methods to README plus did other minor edits.
Let me know if any other changes are required : )
cc @temawi as FYI.
Hi @dfawley and @easwars,
Wrapped the README.md file to 80 columns manually (using editor column count and entering carriage returns where required).
Let me know if it works or if something else is required : )
Thanks for the contribution!