Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
b67ad99c
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 搜索 >>
提交
b67ad99c
编写于
8月 04, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize the entry span’s operationName.
上级
786263cc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
11 deletion
+38
-11
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/TracingContext.java
...org/skywalking/apm/agent/core/context/TracingContext.java
+4
-4
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/EntrySpan.java
...rg/skywalking/apm/agent/core/context/trace/EntrySpan.java
+18
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/dictionary/OperationNameDictionary.java
...ng/apm/agent/core/dictionary/OperationNameDictionary.java
+11
-2
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/AbstractClassEnhancePluginDefine.java
...m/agent/core/plugin/AbstractClassEnhancePluginDefine.java
+2
-2
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginFinder.java
...va/org/skywalking/apm/agent/core/plugin/PluginFinder.java
+1
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginResourcesResolver.java
...alking/apm/agent/core/plugin/PluginResourcesResolver.java
+2
-2
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/TracingContext.java
浏览文件 @
b67ad99c
...
...
@@ -202,7 +202,7 @@ public class TracingContext implements AbstractTracerContext {
final
int
parentSpanId
=
parentSpan
==
null
?
-
1
:
parentSpan
.
getSpanId
();
if
(
parentSpan
==
null
)
{
entrySpan
=
(
AbstractTracingSpan
)
DictionaryManager
.
findOperationNameCodeSection
()
.
find
(
segment
.
getApplicationId
(),
operationName
)
.
find
Only
(
segment
.
getApplicationId
(),
operationName
)
.
doInCondition
(
new
PossibleFound
.
FoundAndObtain
()
{
@Override
public
Object
doProcess
(
int
operationId
)
{
return
new
EntrySpan
(
spanIdGenerator
++,
parentSpanId
,
operationId
);
...
...
@@ -216,7 +216,7 @@ public class TracingContext implements AbstractTracerContext {
return
push
(
entrySpan
);
}
else
if
(
parentSpan
.
isEntry
())
{
entrySpan
=
(
AbstractTracingSpan
)
DictionaryManager
.
findOperationNameCodeSection
()
.
find
(
segment
.
getApplicationId
(),
operationName
)
.
find
Only
(
segment
.
getApplicationId
(),
operationName
)
.
doInCondition
(
new
PossibleFound
.
FoundAndObtain
()
{
@Override
public
Object
doProcess
(
int
operationId
)
{
return
parentSpan
.
setOperationId
(
operationId
);
...
...
@@ -244,7 +244,7 @@ public class TracingContext implements AbstractTracerContext {
AbstractTracingSpan
parentSpan
=
peek
();
final
int
parentSpanId
=
parentSpan
==
null
?
-
1
:
parentSpan
.
getSpanId
();
AbstractTracingSpan
span
=
(
AbstractTracingSpan
)
DictionaryManager
.
findOperationNameCodeSection
()
.
find
(
segment
.
getApplicationId
(),
operationName
)
.
find
OrPrepare4Register
(
segment
.
getApplicationId
(),
operationName
)
.
doInCondition
(
new
PossibleFound
.
FoundAndObtain
()
{
@Override
public
Object
doProcess
(
int
operationId
)
{
...
...
@@ -282,7 +282,7 @@ public class TracingContext implements AbstractTracerContext {
@Override
public
Object
doProcess
(
final
int
applicationId
)
{
return
DictionaryManager
.
findOperationNameCodeSection
()
.
find
(
applicationId
,
operationName
)
.
find
OrPrepare4Register
(
applicationId
,
operationName
)
.
doInCondition
(
new
PossibleFound
.
FoundAndObtain
()
{
@Override
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/EntrySpan.java
浏览文件 @
b67ad99c
package
org.skywalking.apm.agent.core.context.trace
;
import
org.skywalking.apm.agent.core.dictionary.DictionaryManager
;
import
org.skywalking.apm.agent.core.dictionary.DictionaryUtil
;
import
org.skywalking.apm.agent.core.dictionary.PossibleFound
;
import
org.skywalking.apm.network.trace.component.Component
;
/**
...
...
@@ -82,6 +84,22 @@ public class EntrySpan extends AbstractTracingSpan {
@Override
public
boolean
finish
(
TraceSegment
owner
)
{
if
(--
stackDepth
==
0
)
{
if
(
this
.
operationId
==
DictionaryUtil
.
nullValue
())
{
this
.
operationId
=
(
Integer
)
DictionaryManager
.
findOperationNameCodeSection
()
.
findOrPrepare4Register
(
owner
.
getApplicationId
(),
operationName
)
.
doInCondition
(
new
PossibleFound
.
FoundAndObtain
()
{
@Override
public
Object
doProcess
(
int
value
)
{
return
value
;
}
},
new
PossibleFound
.
NotFoundAndObtain
()
{
@Override
public
Object
doProcess
()
{
return
DictionaryUtil
.
nullValue
();
}
}
);
}
return
super
.
finish
(
owner
);
}
else
{
return
false
;
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/dictionary/OperationNameDictionary.java
浏览文件 @
b67ad99c
...
...
@@ -20,7 +20,15 @@ public enum OperationNameDictionary {
private
Map
<
OperationNameKey
,
Integer
>
operationNameDictionary
=
new
ConcurrentHashMap
<
OperationNameKey
,
Integer
>();
private
Set
<
OperationNameKey
>
unRegisterOperationNames
=
new
ConcurrentSet
<
OperationNameKey
>();
public
PossibleFound
find
(
int
applicationId
,
String
operationName
)
{
public
PossibleFound
findOrPrepare4Register
(
int
applicationId
,
String
operationName
)
{
return
find0
(
applicationId
,
operationName
,
true
);
}
public
PossibleFound
findOnly
(
int
applicationId
,
String
operationName
)
{
return
find0
(
applicationId
,
operationName
,
false
);
}
private
PossibleFound
find0
(
int
applicationId
,
String
operationName
,
boolean
registerWhenNotFound
)
{
if
(
operationName
==
null
||
operationName
.
length
()
==
0
)
{
return
new
NotFound
();
}
...
...
@@ -29,7 +37,8 @@ public enum OperationNameDictionary {
if
(
operationId
!=
null
)
{
return
new
Found
(
applicationId
);
}
else
{
if
(
operationNameDictionary
.
size
()
+
unRegisterOperationNames
.
size
()
<
OPERATION_NAME_BUFFER_SIZE
)
{
if
(
registerWhenNotFound
&&
operationNameDictionary
.
size
()
+
unRegisterOperationNames
.
size
()
<
OPERATION_NAME_BUFFER_SIZE
)
{
unRegisterOperationNames
.
add
(
key
);
}
return
new
NotFound
();
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/AbstractClassEnhancePluginDefine.java
浏览文件 @
b67ad99c
...
...
@@ -37,7 +37,7 @@ public abstract class AbstractClassEnhancePluginDefine {
logger
.
debug
(
"prepare to enhance class {} by {}."
,
transformClassName
,
interceptorDefineClassName
);
/**
* find witness classes for enhance class
* find
OrPrepare4Register
witness classes for enhance class
*/
String
[]
witnessClasses
=
witnessClasses
();
if
(
witnessClasses
!=
null
)
{
...
...
@@ -51,7 +51,7 @@ public abstract class AbstractClassEnhancePluginDefine {
}
/**
* find origin class source code for interceptor
* find
OrPrepare4Register
origin class source code for interceptor
*/
DynamicType
.
Builder
<?>
newClassBuilder
=
this
.
enhance
(
transformClassName
,
builder
,
classLoader
);
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginFinder.java
浏览文件 @
b67ad99c
...
...
@@ -16,7 +16,7 @@ import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
not
;
/**
* The <code>PluginFinder</code> represents a finder , which assist to find the one
* The <code>PluginFinder</code> represents a finder , which assist to find
OrPrepare4Register
the one
* from the given {@link AbstractClassEnhancePluginDefine} list.
*
* @author wusheng
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/PluginResourcesResolver.java
浏览文件 @
b67ad99c
...
...
@@ -27,7 +27,7 @@ public class PluginResourcesResolver {
while
(
urls
.
hasMoreElements
())
{
URL
pluginUrl
=
urls
.
nextElement
();
cfgUrlPaths
.
add
(
pluginUrl
);
logger
.
info
(
"find skywalking plugin define in {}"
,
pluginUrl
);
logger
.
info
(
"find
OrPrepare4Register
skywalking plugin define in {}"
,
pluginUrl
);
}
return
cfgUrlPaths
;
...
...
@@ -42,7 +42,7 @@ public class PluginResourcesResolver {
* First get current thread's classloader,
* if fail, get {@link PluginResourcesResolver}'s classloader.
*
* @return the classloader to find plugin definitions.
* @return the classloader to find
OrPrepare4Register
plugin definitions.
*/
private
ClassLoader
getDefaultClassLoader
()
{
ClassLoader
cl
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录