sofa-tracer icon indicating copy to clipboard operation
sofa-tracer copied to clipboard

支持上报数据到Jaeger

Open chenzhao11 opened this issue 4 years ago • 3 comments

Motivation:

支持上报span数据到Jaeger中进行展示

Modification:

1. 使用http方式发送zipkinV2 JSON格式的数据到Jaeger Collector中 Jaeger本身支持zipkinV2 JSON格式,所以新增配置类JaegerSofaTracerAutoConfiguration解析配置文件属性 com.alipay.sofa.tracer.jaeger.baseUrl, com.alipay.sofa.tracer.jaeger.enabled, com.alipay.sofa.tracer.jaeger.gzipped替换sofatrace的对应配置项,其余实现不变即可。 2. 支持使用UDP发送Jaeger.thrift格式的数据到Jaeger Agent中,相关数据由Agent发送至Jaeger Collector Agent是Jaeger中的重要模块,可以实现流量控制等功能,但是Agent只支持通过UDP发送的Thrift格式的数据,所以实现这个功能很有必要。 使用了jaeger-client:1.6.0中的相关方法实现,使用其中的UdpSender发送span数据,工作主要是将SOFATracerSpan转换为JaegerSpan。新增配置类JaegerAgentSofaTracerAutoConfiguration。 主要配置项:

  • Agent IP地址 : com.alipay.sofa.tracer.jaeger.agent.host
  • Agent 接受Jaeger.thrift的端口:com.alipay.sofa.tracer.jaeger.agent.port
  • 是否发送到Agent:com.alipay.sofa.tracer.jaeger.agent.enable
  • UDP数据包的最大字节数:com.alipay.sofa.tracer.jaeger.agent.maxPacketSize
  • 向Command Queue中添加FlushCommand的时间间隔:com.alipay.sofa.tracer.jaeger.agent.flushInterval
  • Command Queue队列的最大容量:com.alipay.sofa.tracer.jaeger.agent.maxQueueSize
  • 将CloseCommand发送到Command Queue的最长等待时间:com.alipay.sofa.tracer.jaeger.agent.closeEnqueueTimeout

Result:

Fixes #372 .

chenzhao11 avatar Jul 19 '21 00:07 chenzhao11

Hi @chenzhao11, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

sofastack-bot[bot] avatar Jul 19 '21 00:07 sofastack-bot[bot]

Hi @chenzhao11, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

sofastack-bot[bot] avatar Jul 19 '21 00:07 sofastack-bot[bot]

修改之前使用Http上传Zipkin JSONV2格式的数据部分,改为使用Jaeger中的HttpSender上报Jaeger.thrift格式的数据到Jaeger Collector中

修改后的配置项如下:

字段 备注
com.alipay.sofa.tracer.jaeger.enabled 是否启用Jaeger上报
com.alipay.sofa.tracer.jaeger.collector.baseUrl collector的地址
com.alipay.sofa.tracer.jaeger.collector.maxPacketSizeBytes 使用Http上传的数据包大小,默认2MB
com.alipay.sofa.tracer.jaeger.receiver 接受端是collector还是agent默认是collector
com.alipay.sofa.tracer.jaeger.agent.host agent的ip/hostname
com.alipay.sofa.tracer.jaeger.agent.port agent的port
com.alipay.sofa.tracer.jaeger.agent.maxPacketSizeBytes UDP数据包大小的最大值,默认65000
com.alipay.sofa.tracer.jaeger.flushInterval 向CommandQueue写FlushCommand的间隔
com.alipay.sofa.tracer.jaeger.maxQueueSize CommandQueue的最大长度
com.alipay.sofa.tracer.jaeger.closeEnqueueTimeout 向CommandQueue中写CloseCommand的最长等待时间

chenzhao11 avatar Sep 09 '21 05:09 chenzhao11