cloudwego / hertz

Go HTTP framework with high-performance and strong-extensibility for building micro-services.
https://www.cloudwego.io
Apache License 2.0
5.28k stars 515 forks source link

为什么链路追踪总是并且关系没有层次 #1078

Closed flairamos closed 7 months ago

flairamos commented 7 months ago

是使用hertz和kitex做链路追踪时,span总是并列关系,在官方示例下没人回复,转向框架仓库希望有人能答疑解惑:

https://github.com/cloudwego/hertz-examples/issues/136#issue-2199773563

首先,我使用cwgo工具生成了api server服务与rpc server和rpc client服务,然后docker 运行了jaeger-all-in-one环境。 其次,参考本仓库的openTelemetry扩展配置链路追踪。

具体配置如下:

api server : image

rpc server: image

rpc client: image

完成上述配置后向接口发送一次请求,jaeger UI的query如下:

image

我是在http的service层调用的rpc client获取数据,按照这个逻辑,应该是分层次的,类似于这样:

user-http-server
|——user-rpc-server

请问是那个地方配置错了,还是我理解错了,需要怎样配置或者使用才能达到此仓库的图片显示的那样有参差的记录。希望能得到解答,谢谢!

li-jin-gou commented 7 months ago

cc @rogerogers

li-jin-gou commented 7 months ago

辛苦帮看下 @rogerogers @CoderPoet

github-actions[bot] commented 7 months ago

This issue has been marked as invalid question, please give more information by following the issue template. The issue will be closed in 1 days if no further activity occurs.

rogerogers commented 7 months ago

user-http-client 的写法有问题,导致 user-rpc-server 找不到 parent span image 这个 shutdown 直接关闭了上报,shutdown 一般应该放在 hook 里

rogerogers commented 7 months ago

另外,一个服务初始化一个 provider 就可以, client 这里不用再初始化一次

flairamos commented 7 months ago

另外,一个服务初始化一个 provider 就可以, client 这里不用再初始化一次

谢谢,已解决 image

github-actions[bot] commented 7 months ago

This issue has been marked as invalid question, please give more information by following the issue template. The issue will be closed in 1 days if no further activity occurs.