tower-rs / tower-grpc

A gRPC client & server implementation.
MIT License
562 stars 73 forks source link

Support reflection #51

Open autodidaddict opened 6 years ago

autodidaddict commented 6 years ago

At the moment, none of the 3 available gRPC libraries for Rust support reflection. This means that no gRPC services written in Rust can be queried or interrogated with tools like grpcurl. Easily the biggest complaint from people moving from REST to gRPC is the lack of tooling and inability to use curl or Postman to poke and prod their services. Supporting Reflection would go a long way toward increasing adoption of this library, and further the use of gRPC within the larger Rust community.

The work involved in implementing Reflection in Rust is to provide a default implementation of the v1alpha reflection gRPC service, the protobuf IDL for which can be found here

Under the hood, you need to be able to find the raw ASCII bytes that belonged to the proto file that generated the code (descriptors) in order to supply an implementation for that. If prost is being used as the generator for the messages and the tokio services, then prost would need to be updated to provide access to message descriptors as well as the protobuf IDL for the complete service. Other implementations typically maintain a hash of fully-qualified symbol names and the protobuf IDL.

Examples in other SDKs:

seanmonstar commented 6 years ago

Cool, sounds useful!

autodidaddict commented 6 years ago

Being able to do something like this:

$ echo '{"SKU": "ABC123"}' | grpcurl -k call localhost:8080 PartialFoods.Services.InventoryManagement.GetActivity

is life changing (this is a working example from one of my .NET Core gRPC services), grpcurl is written in Go.