Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
020a9953
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,发现更多精彩内容 >>
未验证
提交
020a9953
编写于
1月 16, 2021
作者:
E
Evan
提交者:
GitHub
1月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change spanId toolkit api type (#6216)
上级
cbfe7ee8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
21 addition
and
17 deletion
+21
-17
apm-application-toolkit/apm-toolkit-trace/src/main/java/org/apache/skywalking/apm/toolkit/trace/TraceContext.java
...org/apache/skywalking/apm/toolkit/trace/TraceContext.java
+4
-3
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/AbstractTracerContext.java
...walking/apm/agent/core/context/AbstractTracerContext.java
+1
-1
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java
...che/skywalking/apm/agent/core/context/ContextManager.java
+5
-5
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java
...ywalking/apm/agent/core/context/IgnoredTracerContext.java
+2
-2
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
+2
-2
test/plugin/scenarios/apm-toolkit-trace-scenario/src/main/java/org/apache/skywalking/apm/toolkit/trace/TraceContext.java
...org/apache/skywalking/apm/toolkit/trace/TraceContext.java
+4
-3
test/plugin/scenarios/apm-toolkit-trace-scenario/src/main/java/test/apache/skywalking/apm/testcase/toolkit/controller/TestController.java
...lking/apm/testcase/toolkit/controller/TestController.java
+3
-1
未找到文件。
apm-application-toolkit/apm-toolkit-trace/src/main/java/org/apache/skywalking/apm/toolkit/trace/TraceContext.java
浏览文件 @
020a9953
...
...
@@ -46,12 +46,13 @@ public class TraceContext {
}
/**
* Try to get the spanId of current trace context.
* Try to get the spanId of current trace context. The spanId is a negative number when the trace context is
* missing.
*
* @return spanId, if it exists, or empty {@link String}.
*/
public
static
String
spanId
()
{
return
""
;
public
static
int
spanId
()
{
return
-
1
;
}
/**
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/AbstractTracerContext.java
浏览文件 @
020a9953
...
...
@@ -74,7 +74,7 @@ public interface AbstractTracerContext {
*
* @return the string represents the id.
*/
String
getSpanId
();
int
getSpanId
();
/**
* Create an entry span
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java
浏览文件 @
020a9953
...
...
@@ -70,7 +70,7 @@ public class ContextManager implements BootService {
}
/**
* @return the first global trace id
if needEnhance
. Otherwise, "N/A".
* @return the first global trace id
when tracing
. Otherwise, "N/A".
*/
public
static
String
getGlobalTraceId
()
{
AbstractTracerContext
context
=
CONTEXT
.
get
();
...
...
@@ -78,7 +78,7 @@ public class ContextManager implements BootService {
}
/**
* @return the current segment id
if needEnhance
. Otherwise, "N/A".
* @return the current segment id
when tracing
. Otherwise, "N/A".
*/
public
static
String
getSegmentId
()
{
AbstractTracerContext
context
=
CONTEXT
.
get
();
...
...
@@ -86,11 +86,11 @@ public class ContextManager implements BootService {
}
/**
* @return the current span id
if needEnhance. Otherwise, "N/A"
.
* @return the current span id
when tracing. Otherwise, the value is -1
.
*/
public
static
String
getSpanId
()
{
public
static
int
getSpanId
()
{
AbstractTracerContext
context
=
CONTEXT
.
get
();
return
Objects
.
nonNull
(
context
)
?
context
.
getSpanId
()
:
EMPTY_TRACE_CONTEXT_ID
;
return
Objects
.
nonNull
(
context
)
?
context
.
getSpanId
()
:
-
1
;
}
public
static
AbstractSpan
createEntrySpan
(
String
operationName
,
ContextCarrier
carrier
)
{
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java
浏览文件 @
020a9953
...
...
@@ -75,8 +75,8 @@ public class IgnoredTracerContext implements AbstractTracerContext {
}
@Override
public
String
getSpanId
()
{
return
IGNORE_TRACE
;
public
int
getSpanId
()
{
return
-
1
;
}
@Override
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java
浏览文件 @
020a9953
...
...
@@ -249,8 +249,8 @@ public class TracingContext implements AbstractTracerContext {
}
@Override
public
String
getSpanId
()
{
return
String
.
valueOf
(
activeSpan
().
getSpanId
()
);
public
int
getSpanId
()
{
return
activeSpan
().
getSpanId
(
);
}
/**
...
...
test/plugin/scenarios/apm-toolkit-trace-scenario/src/main/java/org/apache/skywalking/apm/toolkit/trace/TraceContext.java
浏览文件 @
020a9953
...
...
@@ -46,12 +46,13 @@ public class TraceContext {
}
/**
* Try to get the spanId of current trace context.
* Try to get the spanId of current trace context. The spanId is a negative number when the trace context is
* missing.
*
* @return spanId, if it exists, or empty {@link String}.
*/
public
static
String
spanId
()
{
return
""
;
public
static
int
spanId
()
{
return
-
1
;
}
/**
...
...
test/plugin/scenarios/apm-toolkit-trace-scenario/src/main/java/test/apache/skywalking/apm/testcase/toolkit/controller/TestController.java
浏览文件 @
020a9953
...
...
@@ -61,7 +61,9 @@ public class TestController {
TraceContext
.
putCorrelation
(
CORRELATION_CONTEXT_KEY
,
CORRELATION_CONTEXT_VALUE
);
ActiveSpan
.
tag
(
"traceID"
,
TraceContext
.
traceId
());
ActiveSpan
.
tag
(
"segmentID"
,
TraceContext
.
segmentId
());
ActiveSpan
.
tag
(
"spanID"
,
TraceContext
.
spanId
());
if
(
TraceContext
.
spanId
()
>
-
1
)
{
ActiveSpan
.
tag
(
"spanID"
,
String
.
valueOf
(
TraceContext
.
spanId
()));
}
testService
.
asyncCallable
(()
->
{
visit
(
"http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/callable"
);
return
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录