Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
5bcc6fbf
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 1 年多
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
提交
5bcc6fbf
编写于
7月 02, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor ContextCarrier.
上级
c7c0256c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
8 deletion
+46
-8
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/ContextCarrier.java
...org/skywalking/apm/agent/core/context/ContextCarrier.java
+8
-7
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/TracingContext.java
...org/skywalking/apm/agent/core/context/TracingContext.java
+21
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java
...ing/apm/agent/core/context/trace/AbstractTracingSpan.java
+4
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/TraceSegment.java
...skywalking/apm/agent/core/context/trace/TraceSegment.java
+4
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/TraceSegmentRef.java
...walking/apm/agent/core/context/trace/TraceSegmentRef.java
+9
-1
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/ContextCarrier.java
浏览文件 @
5bcc6fbf
...
...
@@ -6,6 +6,7 @@ import java.util.List;
import
org.skywalking.apm.agent.core.context.ids.DistributedTraceId
;
import
org.skywalking.apm.agent.core.context.ids.PropagatedTraceId
;
import
org.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.skywalking.apm.agent.core.dictionary.DictionaryManager
;
import
org.skywalking.apm.agent.core.dictionary.DictionaryUtil
;
import
org.skywalking.apm.util.StringUtil
;
...
...
@@ -96,11 +97,11 @@ public class ContextCarrier implements Serializable {
return
entryOperationName
;
}
public
void
setEntryOperationName
(
String
entryOperationName
)
{
void
setEntryOperationName
(
String
entryOperationName
)
{
this
.
entryOperationName
=
'#'
+
entryOperationName
;
}
public
void
setEntryOperationId
(
int
entryOperationId
)
{
void
setEntryOperationId
(
int
entryOperationId
)
{
this
.
entryOperationName
=
entryOperationId
+
""
;
}
...
...
@@ -112,11 +113,11 @@ public class ContextCarrier implements Serializable {
return
spanId
;
}
public
void
setTraceSegmentId
(
String
traceSegmentId
)
{
void
setTraceSegmentId
(
String
traceSegmentId
)
{
this
.
traceSegmentId
=
traceSegmentId
;
}
public
void
setSpanId
(
int
spanId
)
{
void
setSpanId
(
int
spanId
)
{
this
.
spanId
=
spanId
;
}
...
...
@@ -124,7 +125,7 @@ public class ContextCarrier implements Serializable {
return
applicationId
;
}
public
void
setApplicationId
(
int
applicationId
)
{
void
setApplicationId
(
int
applicationId
)
{
this
.
applicationId
=
applicationId
;
}
...
...
@@ -132,11 +133,11 @@ public class ContextCarrier implements Serializable {
return
peerHost
;
}
public
void
setPeerHost
(
String
peerHost
)
{
void
setPeerHost
(
String
peerHost
)
{
this
.
peerHost
=
'#'
+
peerHost
;
}
public
void
setPeerId
(
int
peerId
)
{
void
setPeerId
(
int
peerId
)
{
this
.
peerHost
=
peerId
+
""
;
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/TracingContext.java
浏览文件 @
5bcc6fbf
...
...
@@ -60,6 +60,23 @@ public class TracingContext implements AbstractTracerContext {
}
else
{
carrier
.
setPeerId
(
exitSpan
.
getPeerId
());
}
List
<
TraceSegmentRef
>
refs
=
this
.
segment
.
getRefs
();
int
operationId
;
String
operationName
;
if
(
refs
!=
null
&&
refs
.
size
()
>
0
)
{
TraceSegmentRef
ref
=
refs
.
get
(
0
);
operationId
=
ref
.
getOperationId
();
operationName
=
ref
.
getOperationName
();
}
else
{
AbstractTracingSpan
firstSpan
=
first
();
operationId
=
firstSpan
.
getOperationId
();
operationName
=
firstSpan
.
getOperationName
();
}
if
(
operationId
==
DictionaryUtil
.
nullValue
())
{
carrier
.
setEntryOperationName
(
operationName
);
}
else
{
carrier
.
setEntryOperationId
(
operationId
);
}
carrier
.
setDistributedTraceIds
(
this
.
segment
.
getRelatedGlobalTraces
());
}
...
...
@@ -274,4 +291,8 @@ public class TracingContext implements AbstractTracerContext {
}
return
activeSpanStack
.
getLast
();
}
private
AbstractTracingSpan
first
()
{
return
activeSpanStack
.
getFirst
();
}
}
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java
浏览文件 @
5bcc6fbf
...
...
@@ -121,6 +121,10 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
return
operationId
;
}
public
String
getOperationName
()
{
return
operationName
;
}
@Override
public
AbstractSpan
setLayer
(
SpanLayer
layer
)
{
this
.
layer
=
layer
;
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/TraceSegment.java
浏览文件 @
5bcc6fbf
...
...
@@ -178,6 +178,10 @@ public class TraceSegment {
return
!(
refs
==
null
||
refs
.
size
()
==
0
);
}
public
List
<
TraceSegmentRef
>
getRefs
()
{
return
refs
;
}
public
List
<
DistributedTraceId
>
getRelatedGlobalTraces
()
{
return
relatedGlobalTraces
.
getRelatedGlobalTraces
();
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/TraceSegmentRef.java
浏览文件 @
5bcc6fbf
...
...
@@ -24,7 +24,7 @@ public class TraceSegmentRef {
private
String
operationName
;
private
int
operationId
;
private
int
operationId
=
DictionaryUtil
.
nullValue
()
;
/**
* {@link DistributedTraceId}
...
...
@@ -56,6 +56,14 @@ public class TraceSegmentRef {
this
.
distributedTraceIds
=
carrier
.
getDistributedTraceIds
();
}
public
String
getOperationName
()
{
return
operationName
;
}
public
int
getOperationId
()
{
return
operationId
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录