rantav / go-grpc-channelz

A ChannelZ UI for gRPC in Golang
MIT License
41 stars 3 forks source link

Add: support custom grpc.DialOption through CreateHandlerWithDialOpts #14

Closed choopm closed 9 months ago

choopm commented 9 months ago

This adds support for using custom []grpc.DialOption in the call to grpc.Dial() through the use of CreateHandlerWithDialOpts.

Behaviour of CreateHandler() is unchanged.

By doing so, one can implement TLS as requested in #9 or as in my case use in memory listeners instead of binding to TCP addresses.

All tests and builds are running fine. Please review and merge if possible.

rantav commented 9 months ago

This looks good, thank you @choopm ! Although shamefully I did not write a test for the client itself, would you mind adding a test for it that would also cover this new scenario? 🙏

choopm commented 9 months ago

This looks good, thank you @choopm ! Although shamefully I did not write a test for the client itself, would you mind adding a test for it that would also cover this new scenario? 🙏

@rantav Done. Mind reviewing again?

I added a fullstack test which starts the demo server, registers channelz against it and performs a demo client calls. The test suite then fires up a httptest server which uses CreateHandlerWithDialOpts to later ensure everything is working fine.

This covers client.go funcs aswell.

Coverage: ok github.com/rantav/go-grpc-channelz 2.123s coverage: 76.4% of statements

choopm commented 9 months ago

That's it, thanks for merging :rocket: