Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
f71bb057
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
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,发现更多精彩内容 >>
提交
f71bb057
编写于
8月 03, 2017
作者:
P
pengys5
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no message
上级
5db84039
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
59 deletion
+47
-59
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/cache/ComponentCache.java
...pm/collector/agentstream/worker/cache/ComponentCache.java
+4
-4
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java
...ream/worker/node/component/NodeComponentSpanListener.java
+2
-2
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/IDNameExchangeTimer.java
...ector/agentstream/worker/storage/IDNameExchangeTimer.java
+4
-13
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/PersistenceTimer.java
...ollector/agentstream/worker/storage/PersistenceTimer.java
+4
-14
apm-network/src/main/java/org/skywalking/apm/network/trace/component/ComponentsDefine.java
...walking/apm/network/trace/component/ComponentsDefine.java
+33
-26
未找到文件。
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/cache/ComponentCache.java
浏览文件 @
f71bb057
...
...
@@ -14,11 +14,11 @@ public class ComponentCache {
private
static
Cache
<
String
,
Integer
>
CACHE
=
CacheBuilder
.
newBuilder
().
maximumSize
(
1000
).
build
();
public
static
int
get
(
int
applicationId
,
String
componentName
)
{
INodeComponentDAO
dao
=
(
INodeComponentDAO
)
DAOContainer
.
INSTANCE
.
get
(
INodeComponentDAO
.
class
.
getName
());
try
{
return
CACHE
.
get
(
applicationId
+
Const
.
ID_SPLIT
+
componentName
,
()
->
dao
.
getComponentId
(
applicationId
,
componentName
)
);
return
CACHE
.
get
(
applicationId
+
Const
.
ID_SPLIT
+
componentName
,
()
->
{
INodeComponentDAO
dao
=
(
INodeComponentDAO
)
DAOContainer
.
INSTANCE
.
get
(
INodeComponentDAO
.
class
.
getName
());
return
dao
.
getComponentId
(
applicationId
,
componentName
);
});
}
catch
(
Throwable
e
)
{
return
0
;
}
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java
浏览文件 @
f71bb057
...
...
@@ -29,13 +29,13 @@ public class NodeComponentSpanListener implements EntrySpanListener, ExitSpanLis
@Override
public
void
parseExit
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
String
componentName
=
ComponentsDefine
.
getComponentName
(
spanObject
.
getComponentId
());
String
componentName
=
ComponentsDefine
.
get
Instance
().
get
ComponentName
(
spanObject
.
getComponentId
());
createNodeComponent
(
spanObject
,
applicationId
,
componentName
);
}
@Override
public
void
parseEntry
(
SpanObject
spanObject
,
int
applicationId
,
int
applicationInstanceId
,
String
segmentId
)
{
String
componentName
=
ComponentsDefine
.
getComponentName
(
spanObject
.
getComponentId
());
String
componentName
=
ComponentsDefine
.
get
Instance
().
get
ComponentName
(
spanObject
.
getComponentId
());
createNodeComponent
(
spanObject
,
applicationId
,
componentName
);
}
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/IDNameExchangeTimer.java
浏览文件 @
f71bb057
package
org.skywalking.apm.collector.agentstream.worker.storage
;
import
java.util.List
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.collector.core.framework.Starter
;
import
org.skywalking.apm.collector.stream.worker.WorkerException
;
import
org.skywalking.apm.collector.stream.worker.impl.ExchangeWorker
;
...
...
@@ -20,20 +22,9 @@ public class IDNameExchangeTimer implements Starter {
logger
.
info
(
"id and name exchange timer start"
);
//TODO timer value config
// final long timeInterval = EsConfig.Es.Persistence.Timer.VALUE * 1000;
final
long
timeInterval
=
3
*
1000
;
final
long
timeInterval
=
3
;
Thread
exchangeThread
=
new
Thread
(()
->
{
while
(
true
)
{
try
{
exchangeLastData
();
Thread
.
sleep
(
timeInterval
);
}
catch
(
Throwable
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
});
exchangeThread
.
setName
(
"timerExchange"
);
exchangeThread
.
start
();
Executors
.
newSingleThreadScheduledExecutor
().
schedule
(()
->
exchangeLastData
(),
timeInterval
,
TimeUnit
.
SECONDS
);
}
private
void
exchangeLastData
()
{
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/PersistenceTimer.java
浏览文件 @
f71bb057
...
...
@@ -2,6 +2,8 @@ package org.skywalking.apm.collector.agentstream.worker.storage;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.collector.core.framework.Starter
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.storage.dao.IBatchDAO
;
...
...
@@ -23,20 +25,8 @@ public class PersistenceTimer implements Starter {
logger
.
info
(
"persistence timer start"
);
//TODO timer value config
// final long timeInterval = EsConfig.Es.Persistence.Timer.VALUE * 1000;
final
long
timeInterval
=
3
*
1000
;
Thread
persistenceThread
=
new
Thread
(()
->
{
while
(
true
)
{
try
{
extractDataAndSave
();
Thread
.
sleep
(
timeInterval
);
}
catch
(
Throwable
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
});
persistenceThread
.
setName
(
"timerPersistence"
);
persistenceThread
.
start
();
final
long
timeInterval
=
3
;
Executors
.
newSingleThreadScheduledExecutor
().
schedule
(()
->
extractDataAndSave
(),
timeInterval
,
TimeUnit
.
SECONDS
);
}
private
void
extractDataAndSave
()
{
...
...
apm-network/src/main/java/org/skywalking/apm/network/trace/component/ComponentsDefine.java
浏览文件 @
f71bb057
...
...
@@ -6,6 +6,7 @@ package org.skywalking.apm.network.trace.component;
* @author wusheng
*/
public
class
ComponentsDefine
{
public
static
final
OfficialComponent
TOMCAT
=
new
OfficialComponent
(
1
,
"Tomcat"
);
public
static
final
OfficialComponent
HTTPCLIENT
=
new
OfficialComponent
(
2
,
"HttpClient"
);
...
...
@@ -30,33 +31,39 @@ public class ComponentsDefine {
public
static
final
OfficialComponent
OKHTTP
=
new
OfficialComponent
(
12
,
"OKHttp"
);
public
static
String
getComponentName
(
int
componentId
)
{
if
(
TOMCAT
.
getId
()
==
componentId
)
{
return
TOMCAT
.
getName
();
}
else
if
(
HTTPCLIENT
.
getId
()
==
componentId
)
{
return
HTTPCLIENT
.
getName
();
}
else
if
(
DUBBO
.
getId
()
==
componentId
)
{
return
DUBBO
.
getName
();
}
else
if
(
H2
.
getId
()
==
componentId
)
{
return
H2
.
getName
();
}
else
if
(
MYSQL
.
getId
()
==
componentId
)
{
return
MYSQL
.
getName
();
}
else
if
(
ORACLE
.
getId
()
==
componentId
)
{
return
ORACLE
.
getName
();
}
else
if
(
REDIS
.
getId
()
==
componentId
)
{
return
REDIS
.
getName
();
}
else
if
(
MOTAN
.
getId
()
==
componentId
)
{
return
MOTAN
.
getName
();
}
else
if
(
MONGODB
.
getId
()
==
componentId
)
{
return
MONGODB
.
getName
();
}
else
if
(
RESIN
.
getId
()
==
componentId
)
{
return
RESIN
.
getName
();
}
else
if
(
FEIGN
.
getId
()
==
componentId
)
{
return
FEIGN
.
getName
();
}
else
if
(
OKHTTP
.
getId
()
==
componentId
)
{
return
OKHTTP
.
getName
();
}
else
{
private
static
ComponentsDefine
instance
=
new
ComponentsDefine
();
private
String
[]
components
;
public
static
ComponentsDefine
getInstance
()
{
return
instance
;
}
public
ComponentsDefine
()
{
components
=
new
String
[
13
];
addComponent
(
TOMCAT
);
addComponent
(
HTTPCLIENT
);
addComponent
(
DUBBO
);
addComponent
(
H2
);
addComponent
(
MYSQL
);
addComponent
(
ORACLE
);
addComponent
(
REDIS
);
addComponent
(
MOTAN
);
addComponent
(
MONGODB
);
addComponent
(
RESIN
);
addComponent
(
FEIGN
);
addComponent
(
OKHTTP
);
}
private
void
addComponent
(
OfficialComponent
component
)
{
components
[
component
.
getId
()]
=
component
.
getName
();
}
public
String
getComponentName
(
int
componentId
)
{
if
(
componentId
>
components
.
length
-
1
||
componentId
==
0
)
{
return
null
;
}
else
{
return
components
[
componentId
];
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录