Looking for good GUI clients for debugging GRPC endpoints turned out to be surprisingly hard. It took several attempts and many apps checked. But I found some.
Use case
First, I need to explain, what I mean by “good”. We have some internal services running in Kubernetes and we want to expose some debugging endpoints for occasional manual requests. So by “good“ I mean a replacement for Swagger Web UI we used for this before. This means:
- It can read
.proto
file with service definitions. Supporting server reflection is also great but we don’t want to require our service to provide it. - Requests can be composed by filling out the form generated from the proto definition.
- Requests can be sent to the service via Kubernetes port forwarding.
- Open source. The repository is not abandoned.
Most gRPC clients expect you to write requests as JSON and then convert them to protobuf messages. This is not good enough
Good clients I found so far
grpcui
grpcui feels similar to Swagger Web UI. When you run it, it starts a web server with a form to make requests.
Pros:
- Supports both server reflection and
.proto
files. - You can switch between “generated form” and JSON input modes.
Cons:
- Looks like it hangs when the response is an infinite stream.
- Design gets broken when you have type names with long namespaces.
How to use it with Kubernetes
First, run the Kubernetes port forwarding:
kubectl port-forward service/my-service-name 9031:9000
Port 9031
here is an arbitrary number. I try to have a separate port number per each “service+environment” combination so it’s harder to mess it up.
Then run grpcui:
grpcui -plaintext -proto ./myservice.proto 127.0.0.1:9031
Parameters:
-plaintext
disables transport encryption. After port-forwarding this is kinda request within the walls of Kubernetes. No need to encrypt it.-proto ./myservice.proto
points to a proto file with service definition. Omit this if you want to use server reflection instead.9031
is the same arbitrary port number used in the port forwarding.
Warthog
Warthog is good.
Pros:
- Supports both server reflection and
.proto
files. - It can do Kubernetes port forwarding for you.
- You can save requests for future use.
- Supports infinite stream responses.
Cons:
- No JSON input mode.