Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
06445fc5
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / SkyWalking
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
06445fc5
编写于
3月 02, 2016
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.提交部分TraceSpanTree的序列化代码。解决引用序列化问题。
上级
1b60750e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
105 addition
and
31 deletion
+105
-31
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/entity/TraceSpanNode.java
.../skywalking/analysis/chainbuild/entity/TraceSpanNode.java
+71
-25
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/entity/TraceSpanTree.java
.../skywalking/analysis/chainbuild/entity/TraceSpanTree.java
+15
-4
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/entity/VisualTraceSpanNode.java
...lking/analysis/chainbuild/entity/VisualTraceSpanNode.java
+6
-2
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/exception/TraceSpanTreeSerializeException.java
...chainbuild/exception/TraceSpanTreeSerializeException.java
+13
-0
未找到文件。
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/entity/TraceSpanNode.java
浏览文件 @
06445fc5
package
com.ai.cloud.skywalking.analysis.chainbuild.entity
;
import
java.util.List
;
import
com.ai.cloud.skywalking.analysis.chainbuild.exception.TraceSpanTreeSerializeException
;
import
com.ai.cloud.skywalking.analysis.chainbuild.util.StringUtil
;
import
com.ai.cloud.skywalking.protocol.CallType
;
import
com.ai.cloud.skywalking.protocol.Span
;
...
...
@@ -13,6 +16,16 @@ public class TraceSpanNode {
protected
TraceSpanNode
sub
=
null
;
protected
String
prevNodeRefToken
=
null
;
protected
String
nextNodeRefToken
=
null
;
protected
String
parentNodeRefToken
=
null
;
protected
String
subNodeRefToken
=
null
;
protected
String
nodeRefToken
=
null
;
protected
boolean
visualNode
=
true
;
protected
String
parentLevel
;
...
...
@@ -57,8 +70,8 @@ public class TraceSpanNode {
*/
protected
String
applicationId
=
""
;
public
TraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
,
Span
span
)
{
this
(
parent
,
sub
,
prev
,
next
);
public
TraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
,
Span
span
,
List
<
TraceSpanNode
>
spanContainer
)
{
this
(
parent
,
sub
,
prev
,
next
,
spanContainer
);
this
.
visualNode
=
false
;
this
.
parentLevel
=
span
.
getParentLevel
();
this
.
levelId
=
span
.
getLevelId
();
...
...
@@ -75,30 +88,33 @@ public class TraceSpanNode {
this
.
spanType
=
span
.
getSpanType
();
this
.
businessKey
=
span
.
getBusinessKey
();
this
.
applicationId
=
span
.
getApplicationId
();
//TODO: to set nodeToken
}
p
ublic
TraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
){
p
rotected
TraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
,
List
<
TraceSpanNode
>
spanContainer
){
this
.
visualNode
=
true
;
this
.
parent
=
parent
;
this
.
setParent
(
parent
)
;
if
(
parent
!=
null
){
parent
.
s
ub
=
this
;
parent
.
s
etSub
(
this
)
;
}
this
.
s
ub
=
sub
;
this
.
s
etSub
(
sub
)
;
if
(
sub
!=
null
){
sub
.
parent
=
this
;
sub
.
setParent
(
this
)
;
}
this
.
prev
=
prev
;
this
.
setPrev
(
prev
)
;
if
(
prev
!=
null
){
prev
.
next
=
this
;
prev
.
setNext
(
this
)
;
}
this
.
next
=
next
;
this
.
setNext
(
next
)
;
if
(
next
!=
null
){
next
.
prev
=
this
;
next
.
setPrev
(
this
)
;
}
spanContainer
.
add
(
this
);
}
protected
TraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
,
String
parentLevelId
,
int
levelId
){
this
(
parent
,
sub
,
prev
,
next
);
protected
TraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
,
String
parentLevelId
,
int
levelId
,
List
<
TraceSpanNode
>
spanContainer
){
this
(
parent
,
sub
,
prev
,
next
,
spanContainer
);
this
.
parentLevel
=
parentLevelId
;
this
.
levelId
=
levelId
;
this
.
callTimes
=
0
;
...
...
@@ -134,30 +150,38 @@ public class TraceSpanNode {
}
}
TraceSpanNode
next
(){
return
this
.
next
;
}
TraceSpanNode
sub
(){
return
this
.
sub
;
}
public
TraceSpanNode
getPrev
()
{
public
TraceSpanNode
prev
()
{
return
prev
;
}
public
TraceSpanNode
getN
ext
()
{
public
TraceSpanNode
n
ext
()
{
return
next
;
}
public
TraceSpanNode
getP
arent
()
{
public
TraceSpanNode
p
arent
()
{
return
parent
;
}
public
TraceSpanNode
getS
ub
()
{
public
TraceSpanNode
s
ub
()
{
return
sub
;
}
public
void
setPrev
(
TraceSpanNode
prev
)
{
this
.
prev
=
prev
;
}
public
void
setNext
(
TraceSpanNode
next
)
{
this
.
next
=
next
;
}
public
void
setParent
(
TraceSpanNode
parent
)
{
this
.
parent
=
parent
;
}
public
void
setSub
(
TraceSpanNode
sub
)
{
this
.
sub
=
sub
;
}
public
boolean
isVisualNode
()
{
return
visualNode
;
}
...
...
@@ -197,4 +221,26 @@ public class TraceSpanNode {
public
String
getApplicationId
()
{
return
applicationId
;
}
public
String
getNodeRefToken
()
throws
TraceSpanTreeSerializeException
{
if
(
StringUtil
.
isBlank
(
nodeRefToken
)){
throw
new
TraceSpanTreeSerializeException
(
"parentLevel="
+
parentLevel
+
", levelId="
+
levelId
+
", viewPointId="
+
viewPointId
+
", node ref token is null."
);
}
return
nodeRefToken
;
}
void
serializeRef
()
throws
TraceSpanTreeSerializeException
{
if
(
prev
!=
null
){
prevNodeRefToken
=
prev
.
getNodeRefToken
();
}
if
(
parent
!=
null
){
parentNodeRefToken
=
parent
.
getNodeRefToken
();
}
if
(
next
!=
null
){
nextNodeRefToken
=
next
.
getNodeRefToken
();
}
if
(
sub
!=
null
){
subNodeRefToken
=
sub
.
getNodeRefToken
();
}
}
}
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/entity/TraceSpanTree.java
浏览文件 @
06445fc5
package
com.ai.cloud.skywalking.analysis.chainbuild.entity
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
...
...
@@ -8,6 +9,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
com.ai.cloud.skywalking.analysis.chainbuild.exception.BuildTraceSpanTreeException
;
import
com.ai.cloud.skywalking.analysis.chainbuild.exception.TraceSpanTreeSerializeException
;
import
com.ai.cloud.skywalking.analysis.chainbuild.util.StringUtil
;
import
com.ai.cloud.skywalking.analysis.chainbuild.util.TokenGenerator
;
import
com.ai.cloud.skywalking.protocol.Span
;
...
...
@@ -20,6 +22,8 @@ public class TraceSpanTree {
private
String
cid
;
private
TraceSpanNode
treeRoot
;
private
List
<
TraceSpanNode
>
spanContainer
=
new
ArrayList
<
TraceSpanNode
>();
public
TraceSpanTree
()
{
}
...
...
@@ -40,7 +44,7 @@ public class TraceSpanTree {
}
});
cid
=
generateChainToken
(
spanList
.
get
(
0
));
treeRoot
=
new
TraceSpanNode
(
null
,
null
,
null
,
null
,
spanList
.
get
(
0
));
treeRoot
=
new
TraceSpanNode
(
null
,
null
,
null
,
null
,
spanList
.
get
(
0
)
,
spanContainer
);
if
(
spanList
.
size
()
>
1
)
{
for
(
int
i
=
1
;
i
<
spanList
.
size
();
i
++)
{
this
.
build
(
spanList
.
get
(
i
));
...
...
@@ -65,7 +69,7 @@ public class TraceSpanTree {
TraceSpanNode
foundNode
=
findNodeAndCreateVisualNodeIfNess
(
span
.
getParentLevel
(),
span
.
getLevelId
()
-
1
);
if
(
foundNode
!=
null
)
{
new
TraceSpanNode
(
null
,
null
,
foundNode
,
foundNode
.
next
(),
span
);
new
TraceSpanNode
(
null
,
null
,
foundNode
,
foundNode
.
next
(),
span
,
spanContainer
);
}
}
else
{
/**
...
...
@@ -101,7 +105,7 @@ public class TraceSpanTree {
}
else
{
// create visual next node
currentNode
=
new
VisualTraceSpanNode
(
null
,
null
,
currentNode
,
null
,
contextParentLevelId
,
i
);
currentNode
,
null
,
contextParentLevelId
,
i
,
spanContainer
);
}
}
contextParentLevelId
=
contextParentLevelId
==
""
?
(
""
+
currentLevelInt
)
...
...
@@ -111,7 +115,7 @@ public class TraceSpanTree {
}
else
{
// create visual sub node
currentNode
=
new
VisualTraceSpanNode
(
currentNode
,
null
,
null
,
null
,
contextParentLevelId
,
0
);
null
,
contextParentLevelId
,
0
,
spanContainer
);
}
}
...
...
@@ -130,5 +134,12 @@ public class TraceSpanTree {
+
level0Span
.
getTraceId
()
+
" level0 span data is illegal"
);
}
}
private
void
beforeSerialize
()
throws
TraceSpanTreeSerializeException
{
for
(
TraceSpanNode
treeNode
:
spanContainer
){
treeNode
.
serializeRef
();
}
}
}
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/entity/VisualTraceSpanNode.java
浏览文件 @
06445fc5
package
com.ai.cloud.skywalking.analysis.chainbuild.entity
;
import
java.util.List
;
public
class
VisualTraceSpanNode
extends
TraceSpanNode
{
protected
VisualTraceSpanNode
(
TraceSpanNode
parent
,
TraceSpanNode
sub
,
TraceSpanNode
prev
,
TraceSpanNode
next
,
String
parentLevelId
,
int
levelId
)
{
super
(
parent
,
sub
,
prev
,
next
,
parentLevelId
,
levelId
);
int
levelId
,
List
<
TraceSpanNode
>
spanContainer
)
{
super
(
parent
,
sub
,
prev
,
next
,
parentLevelId
,
levelId
,
spanContainer
);
//TODO: to set nodeToken
}
...
...
skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/exception/TraceSpanTreeSerializeException.java
0 → 100644
浏览文件 @
06445fc5
package
com.ai.cloud.skywalking.analysis.chainbuild.exception
;
public
class
TraceSpanTreeSerializeException
extends
Exception
{
private
static
final
long
serialVersionUID
=
7857716041262993579L
;
public
TraceSpanTreeSerializeException
(
String
msg
){
super
(
msg
);
}
public
TraceSpanTreeSerializeException
(
String
msg
,
Exception
cause
){
super
(
msg
,
cause
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录