report spans to SkyWalking#449
Draft
chenzhao11 wants to merge 2 commits intosofastack:masterfrom
Draft
Conversation
Member
|
@xzchaoo would you please help to review this pr? |
Member
|
@glmapper would you please help to review this pr? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
支持上报span数据到Skywalking中
Modification:
异步上报
使用http上报Json格式的segment数据到后端,上报时以message为单位,多个segment组合成一个message。流程如下图,span结束后将转换好的segment加入到segment缓冲数组中,另一个线程不断到数组中刷新数据到message,当message的大小达到最大值或等待发送的时间达到设定值就发送一次数据。
设置的message最大为2MB,计算每个segment的字节大小方法是把segment转换成Json String计算其长度,长度作为这个segment的字节大小。
关于拓扑图的展示问题的讨论
#443
这次提交的结果,设置
skipAnalysis为true,不显示拓扑图和其他的一个指标只能查询trace信息设置error
使用的是其他插件中使用的判断方法,这样当404的时候也会显示为错误
SegmentId
每一个segment中只有一个span,在segment中的spanId是从0开始的递增整数。在转换过程中
segmentId = traceId + SpanId + server/client ,其中server和client分别用0和1代替。最后需要加上client和server的原因是在Dubbo和SOFARpc中存在
server -> server的情况,其中RPC调用的client、server span的spanId和parentId都一样,需要以此来区分它们。Dubbo 与 SOFARpc中的特殊处理
存在
server -> server的情况,client span、server span的parentId和spanId都一样,parentSegmentId
主要是找出
parentSegmentId,在非SOFARpc和Dubbo情况下,遵循server -> client,client -> server也就是client的父spa只能是server类型的,server类型的父span只能为空或client类型。最后结果是parentSegmentId = traceId + parentId + clientparentSegmentId = traceId + parentId + server在SOFARpc和Dubbo中,根据使用Skywalking Java Agent后两者的链路展示,按照
parentSegmentId = traceId + spanId + clientparentSegmentId = traceId + parentId + serverPeer字段和networkAddressUsedAtPeer字段
peer字段
在Dubbo中peer字段可以通过
remote.host、remote.port两个tag组成SofaRPC中在
remote.ip中包含了ip和port,只使用IPnetworkAddressUsedAtPeer
Dubbo可以通过span中的tag信息组成地址,其中port是通过修改Dubbo插件添加的Tag
SofaPRC中不能直接从Span中国获取到本机的ip,使用的是获取本机的第一个有效IPV4地址,但是没有端口号,所以在上面的peer字段中也只用了IP
增加的配置项
Result:
Fixes #443.