grpc-go icon indicating copy to clipboard operation
grpc-go copied to clipboard

examples: add an example to illustrate the usage of stats handler

Open Yash-Handa opened this issue 2 years ago • 1 comments

RELEASE NOTES:

  • In accordance with issue #5454, I have added an example illustrating the use of stats.Handler in the examples/features/stats_monitoring/ directory.

Yash-Handa avatar Sep 15 '22 15:09 Yash-Handa

CLA Signed

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 Begin struct, 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.

Yash-Handa avatar Sep 26 '22 07:09 Yash-Handa

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.

github-actions[bot] avatar Oct 03 '22 18:10 github-actions[bot]

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.

easwars avatar Oct 03 '22 19:10 easwars

I saw a commit recently on this PR. Please let me know when this is ready to looked at again. Thanks for doing this.

easwars avatar Oct 10 '22 16:10 easwars

Hi @easwars, apologies for the delay.

Updated the example with the following:

  • Abstract the stats.Handler interface into the statshandler package.
  • Generalized log statements for HandleRPC and HandleConn.
  • Other minor fixes.

Let me know if further changes are required : )

Yash-Handa avatar Oct 12 '22 00:10 Yash-Handa

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.

github-actions[bot] avatar Oct 18 '22 01:10 github-actions[bot]

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.

Yash-Handa avatar Oct 23 '22 01:10 Yash-Handa

Hi @easwars,

Made all required changes to pass the vet check.

Let me know if further changes are required : )

Yash-Handa avatar Oct 30 '22 09:10 Yash-Handa

@dfawley : For second set of eyes. Thank you.

easwars avatar Oct 31 '22 17:10 easwars

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 : )

Yash-Handa avatar Nov 13 '22 04:11 Yash-Handa

cc @temawi as FYI.

dfawley avatar Nov 23 '22 18:11 dfawley

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 : )

Yash-Handa avatar Nov 27 '22 14:11 Yash-Handa

Thanks for the contribution!

dfawley avatar Nov 29 '22 18:11 dfawley