如何调试Pod之间的gRPC调用?

huangapple go评论74阅读模式
英文:

How to debug grpc calls between pods_

问题

我有两个使用gRPC相互交互的Pod,如何调试这两个Pod之间的gRPC调用?

我已经尝试设置以下环境变量:

export GRPC_TRACE=all
export GRPC_VERBOSITY=DEBUG

然后使用kubectl logs <pod> -n <namespace>命令,但没有显示任何gRPC日志。如何调试Pod之间的gRPC通信?

英文:

I have two pods interact with each other using grpc, how to debug grpc calls between those two pods?

I already try to set:

export GRPC_TRACE=all
export GRPC_VERBOSITY=DEBUG

then using kubectl logs &lt;pod&gt; -n namespces does not show up any grpc logs, how to debug grpc between pods?

答案1

得分: 2

这取决于你想要调试什么:如果你只想知道网络上是否有通信,那么你需要在你的两个程序之外添加一些内容。

如果你是这些程序的开发者,你可以在 gRPC 客户端/服务器中添加中间件来添加跟踪功能(例如,使用 OpenTelemetry 追踪和 Jaeger),以获取跨服务的追踪信息(你可以在网络上传播追踪 ID)。

否则,如果不知道你的程序是什么,我们无法仅通过环境变量来帮助你。

英文:

It depends on what you want to debug: If you just want to know if there are communications on the Network, then you will have to add something outside of your 2 programs.

If you are the developer of these programs, you can add middlewares to the gRPC clients/servers to add trace (e.g, using OpenTelemetry tracing and Jaeger) to get cross-services traces (you can propagate traces IDs on the network).

Otherwise, without knowing what your programs are we can't help you only with environment variables.

huangapple
  • 本文由 发表于 2022年6月22日 00:57:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/72704541.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定