I came across grpcdebug tool which is in go language. I'm running a Insecure grpc java server and client(server is serving on localhost:50051). I followed "compile from source" step for installation and ran health command grpcdebug localhost:50051 health
, got this error message <Overall>: SERVICE_UNKNOWN
and for grpcdebug localhost:50051 channelz channels
command, got 2024/04/19 17:07:22 failed to fetch top channels: rpc error: code = Unimplemented desc = Method not found: grpc.channelz.v1.Channelz/GetTopChannels
error message.
Questions:
code = Unimplemented desc = Method not found: grpc.channelz.v1.Channelz/GetTopChannels
This error says you don't have the Channelz service available on your server (or the service is too old and doesn't support GetTopChannels; but that isn't likely the case here).
The grpc-java debugging example adds it using the AdminInterface
API, which adds Channelz but also CSDS if you are using xDS:
import io.grpc.services.AdminInterface;
final Server server = Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create())
.addService(new HostnameGreeter(hostname))
.addServices(AdminInterface.getStandardServices()) // the key add for enabling grpcdebug
You can also add channelz directly instead:
import io.grpc.protobuf.services.ChannelzService;
final Server server = Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create())
.addService(new HostnameGreeter(hostname))
.addServices(ChannelzService.newInstance(100)) // the key add for enabling grpcdebug