Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
b85ada77
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
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,发现更多精彩内容 >>
提交
b85ada77
编写于
12月 14, 2017
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the local span cannot ref other trace segment
上级
2fa0a41f
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
31 addition
and
19 deletion
+31
-19
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java
...che/skywalking/apm/agent/core/context/TracingContext.java
+5
-3
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java
...skywalking/apm/agent/core/context/trace/AbstractSpan.java
+7
-1
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java
...ing/apm/agent/core/context/trace/AbstractTracingSpan.java
+16
-0
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/EntrySpan.java
...he/skywalking/apm/agent/core/context/trace/EntrySpan.java
+0
-15
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/NoopSpan.java
...che/skywalking/apm/agent/core/context/trace/NoopSpan.java
+3
-0
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java
浏览文件 @
b85ada77
...
...
@@ -16,7 +16,6 @@
*
*/
package
org.apache.skywalking.apm.agent.core.context
;
import
java.util.LinkedList
;
...
...
@@ -50,6 +49,7 @@ import org.apache.skywalking.apm.agent.core.sampling.SamplingService;
* ContextCarrier} or {@link ContextSnapshot}.
*
* @author wusheng
* @author zhang xin
*/
public
class
TracingContext
implements
AbstractTracerContext
{
/**
...
...
@@ -159,7 +159,7 @@ public class TracingContext implements AbstractTracerContext {
this
.
segment
.
relatedGlobalTraces
(
carrier
.
getDistributedTraceId
());
AbstractSpan
span
=
this
.
activeSpan
();
if
(
span
instanceof
EntrySpan
)
{
((
EntrySpan
)
span
)
.
ref
(
ref
);
span
.
ref
(
ref
);
}
}
...
...
@@ -213,7 +213,9 @@ public class TracingContext implements AbstractTracerContext {
*/
@Override
public
void
continued
(
ContextSnapshot
snapshot
)
{
this
.
segment
.
ref
(
new
TraceSegmentRef
(
snapshot
));
TraceSegmentRef
segmentRef
=
new
TraceSegmentRef
(
snapshot
);
this
.
segment
.
ref
(
segmentRef
);
this
.
activeSpan
().
ref
(
segmentRef
);
this
.
segment
.
relatedGlobalTraces
(
snapshot
.
getDistributedTraceId
());
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java
浏览文件 @
b85ada77
...
...
@@ -16,7 +16,6 @@
*
*/
package
org.apache.skywalking.apm.agent.core.context.trace
;
import
java.util.Map
;
...
...
@@ -110,4 +109,11 @@ public interface AbstractSpan {
String
getOperationName
();
AbstractSpan
setOperationId
(
int
operationId
);
/**
* Reference other trace segment.
*
* @param ref segment ref
*/
void
ref
(
TraceSegmentRef
ref
);
}
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java
浏览文件 @
b85ada77
...
...
@@ -64,6 +64,13 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
*/
protected
List
<
LogDataEntity
>
logs
;
/**
* The refs of parent trace segments, except the primary one. For most RPC call, {@link #refs} contains only one
* element, but if this segment is a start span of batch process, the segment faces multi parents, at this moment,
* we use this {@link #refs} to link them.
*/
protected
List
<
TraceSegmentRef
>
refs
;
protected
AbstractTracingSpan
(
int
spanId
,
int
parentSpanId
,
String
operationName
)
{
this
.
operationName
=
operationName
;
this
.
operationId
=
DictionaryUtil
.
nullValue
();
...
...
@@ -276,4 +283,13 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
return
spanBuilder
;
}
@Override
public
void
ref
(
TraceSegmentRef
ref
)
{
if
(
refs
==
null
)
{
refs
=
new
LinkedList
<
TraceSegmentRef
>();
}
if
(!
refs
.
contains
(
ref
))
{
refs
.
add
(
ref
);
}
}
}
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/EntrySpan.java
浏览文件 @
b85ada77
...
...
@@ -38,12 +38,6 @@ import org.apache.skywalking.apm.network.trace.component.Component;
* @author wusheng
*/
public
class
EntrySpan
extends
StackBasedTracingSpan
{
/**
* The refs of parent trace segments, except the primary one. For most RPC call, {@link #refs} contains only one
* element, but if this segment is a start span of batch process, the segment faces multi parents, at this moment,
* we use this {@link #refs} to link them.
*/
private
List
<
TraceSegmentRef
>
refs
;
private
int
currentMaxDepth
;
...
...
@@ -146,15 +140,6 @@ public class EntrySpan extends StackBasedTracingSpan {
return
builder
;
}
public
void
ref
(
TraceSegmentRef
ref
)
{
if
(
refs
==
null
)
{
refs
=
new
LinkedList
<
TraceSegmentRef
>();
}
if
(!
refs
.
contains
(
ref
))
{
refs
.
add
(
ref
);
}
}
private
void
clearWhenRestart
()
{
this
.
componentId
=
DictionaryUtil
.
nullValue
();
this
.
componentName
=
null
;
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/NoopSpan.java
浏览文件 @
b85ada77
...
...
@@ -99,4 +99,7 @@ public class NoopSpan implements AbstractSpan {
@Override
public
AbstractSpan
setOperationId
(
int
operationId
)
{
return
this
;
}
@Override
public
void
ref
(
TraceSegmentRef
ref
)
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录