GopherCon 2018: Joshua Humphries - gRPC reflection and grpcurl
HTML-код
- Опубликовано: 13 сен 2024
- gRPC and Protocol Buffers are becoming industry standards for exchanging data across systems and stitching together micro-services to build scalable applications. Most devs' experience with gRPC and protobuf tooling is a program called `protoc`, which generates code to make RPC dead simple.
But for some classes of tools, code generation is a poor fit. One such example is a general purpose command-line client. It should not be required to generate code and recompile this client every time there is a new service with which it wants to interact.
Enter gRPC and protocol buffer reflection. Descriptors are the unit protobuf reflection. And gRPC includes a mechanism for gRPC clients to introspect on exposed services and access their descriptors. These are the building blocks of a completely dynamic gRPC client, no code generation necessary.
`grpcurl` is a command-line program that uses these building blocks to do just that: dynamically invoke gRPC methods, enabling one to test any gRPC endpoint via a single command-line tool. It is basically cURL for gRPC (hence its name).
Joshua’s tutorial session will touch on the Go libraries for gRPC, protocol buffers, and protobuf reflection. And it will show how these libraries are pulled together to build `grpcurl` itself.
Good share.thank you a lot
Are there any performance or security impacts with enabling server reflection?
Is it possible to invoke services without enabling server reflection, if so how to do it?
Yes, you just have to provide the .proto files to the CLI
repository github.com/fullstorydev/grpcurl