Presenter: Joshua Humphries
Liveblogger: Alan Shreve
grpcurl: Dynamic CLI interface for grpc services via protobuf descriptors and grpc reflection.
grpcurl is a CLI tool that can provide a human-friendly CLI experience to dynamically invoke grpc services. Built on top of protobuf descriptors and grpc reflection, we created a set of packages to provide Go APIs to get access to rich protobuf descriptors and grpc reflection as well as packages to allow us to dynamically construct protobuf messages and dynamically invoke grpc services.
grpc and protobuf are becoming industry standard technologies for building services,
but interacting with them ad-hoc for human consumption like you do with
http services is not as easy.
grpcurl is a tool and associated libraries opensourced by FullStory to solve this problem. And we’ll talk about the pieces and mechanisms in protobuf and grpc that make it possible to create these libraries and the tool.
protoc-> the compiler that ingests protobuf definitions and generates code for the message structures in different languages
urlfetchservice, basically an http/1.1 proxy
commander. It’s a grpc service and there was a CLI tool that would just parse command line flags and then make grpc calls to the server.
reflectpackage, but with a remote service, it would seem like we don’t have anything to reflect, but there are mechanisms in protobuf/grpc to reflect out their values
proto.Messageso it can be used in place of the structures generated by typical protoc go
created a gRPC reflection package
grpcurl list: show all services
grpcurl list <Service>: show all methods on the service
grpcurl <Service>.<Method>: invoke a method
-Hto supply header metadata (like curl)
grpcurl describe <fully qualified service method>: describes input/output types and rpc mode (unary vs streaming) of the method
grpcurl describe <fully qualified Protobuf Message>: prints out protobuf descriptor in JSON format
describecauses the command to dump an example payload we can modify
-dto send input arguments OR
-d @to provide via stdin
-d @so that you can write via stdin; example with streaming chat