go-zero链路追踪案例

Golang
430
0
0
2022-09-15
标签   go-zero

在yaml文件中设置配置

#链路追踪
Telemetry: 
  Name: travel-rpc 
  Endpoint: http://127.0.0.1:14268//api/traces   #因为本地调试所以是采用的这个
#  Endpoint: http://jaeger:14268/api/traces 
  Sampler: 1.0 
  Batcher: jaeger
请求案例
curl --location --request POST 'http://127.0.0.1:8004/order/v1/homestayOrder/createHomestayOrder' \
--header 'X-PlatformId: 9' \
--header 'Content-Type: application/json' \
--data-raw '{
    "homestayId": 20,
    "isFood": true,
    "liveStartTime": 1646703241,
    "liveEndTime": 1648703241,
    "livePeopleNum": 3,
    "remark": "6901334402666"
}'
查看链路追踪的数据
http://127.0.0.1:16686/search

go-zero链路追踪案例

最重要的安装东西