几种gRPC调试工具

参照 golang开发一个简单的grpc

完整代码:github.com/cuishuang/grpcdemo, 此处仅需要使用gRPC Server,不需要Client部分


切到 helloservice目录执行 go run main/main.go

几种gRPC调试工具_第1张图片




grpcui


fullstorydev/grpcui

go install github.com/fullstorydev/grpcui/cmd/grpcui@latest


grpcui -plaintext 127.0.0.1:1234

参考调试工具_微服务实战之 Go gRPC 调试工具,在源码中加一行reflection.Register(s)

几种gRPC调试工具_第2张图片

重新启动Server

几种gRPC调试工具_第3张图片


几种gRPC调试工具_第4张图片

几种gRPC调试工具_第5张图片




grpcurl


grpcui底层其实就是grpcurl

go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
brew install grpcurl 或使用Docker

# Download image

docker pull fullstorydev/grpcurl:latest

# Run the tool

docker run fullstorydev/grpcurl api.grpc.me:443 list


grpcurl -plaintext localhost:端口号 list

几种gRPC调试工具_第6张图片

不如grpcui直观




Postman


几种gRPC调试工具_第7张图片

几种gRPC调试工具_第8张图片


三種好用的 gRPC 測試工具


另外类似的工具还有 Evans,BloomRPC (超实用的 gRPC 客户端调试工具)

本文由mdnice多平台发布

你可能感兴趣的:(后端)