Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
fb9200a9
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,发现更多精彩内容 >>
提交
fb9200a9
编写于
10月 12, 2017
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create cache module to provide id or name get. e.g.. application id, instance id, service id…
#423
上级
241e447e
变更
50
隐藏空白更改
内联
并排
Showing
50 changed file
with
245 addition
and
239 deletion
+245
-239
apm-collector/apm-collector-agentregister/pom.xml
apm-collector/apm-collector-agentregister/pom.xml
+5
-0
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/application/ApplicationIDService.java
...ector/agentregister/application/ApplicationIDService.java
+1
-1
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/servicename/ServiceNameService.java
...llector/agentregister/servicename/ServiceNameService.java
+1
-1
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterSerialWorker.java
...r/worker/application/ApplicationRegisterSerialWorker.java
+3
-1
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationEsDAO.java
...gentregister/worker/application/dao/ApplicationEsDAO.java
+0
-23
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationH2DAO.java
...gentregister/worker/application/dao/ApplicationH2DAO.java
+0
-6
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/IApplicationDAO.java
...agentregister/worker/application/dao/IApplicationDAO.java
+0
-2
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/cache/ApplicationCache.java
...ollector/agentregister/worker/cache/ApplicationCache.java
+0
-53
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/IInstanceDAO.java
...ector/agentregister/worker/instance/dao/IInstanceDAO.java
+0
-2
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceEsDAO.java
...ctor/agentregister/worker/instance/dao/InstanceEsDAO.java
+0
-10
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceH2DAO.java
...ctor/agentregister/worker/instance/dao/InstanceH2DAO.java
+1
-4
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterSerialWorker.java
...r/worker/servicename/ServiceNameRegisterSerialWorker.java
+3
-2
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/IServiceNameDAO.java
...agentregister/worker/servicename/dao/IServiceNameDAO.java
+0
-4
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameEsDAO.java
...gentregister/worker/servicename/dao/ServiceNameEsDAO.java
+0
-38
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameH2DAO.java
...gentregister/worker/servicename/dao/ServiceNameH2DAO.java
+0
-8
apm-collector/apm-collector-agentstream/pom.xml
apm-collector/apm-collector-agentstream/pom.xml
+5
-0
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/cache/ServiceCache.java
.../apm/collector/agentstream/worker/cache/ServiceCache.java
+0
-44
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java
...agentstream/worker/noderef/NodeReferenceSpanListener.java
+1
-1
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java
...ntstream/worker/segment/cost/SegmentCostSpanListener.java
+2
-2
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java
...stream/worker/service/entry/ServiceEntrySpanListener.java
+2
-2
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java
...tream/worker/serviceref/ServiceReferenceSpanListener.java
+1
-1
apm-collector/apm-collector-cache/pom.xml
apm-collector/apm-collector-cache/pom.xml
+27
-0
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ApplicationCache.java
.../org/skywalking/apm/collector/cache/ApplicationCache.java
+28
-6
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/InstanceCache.java
...ava/org/skywalking/apm/collector/cache/InstanceCache.java
+2
-2
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceIdCache.java
...va/org/skywalking/apm/collector/cache/ServiceIdCache.java
+2
-2
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceNameCache.java
.../org/skywalking/apm/collector/cache/ServiceNameCache.java
+2
-2
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationEsDAO.java
.../skywalking/apm/collector/cache/dao/ApplicationEsDAO.java
+24
-1
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationH2DAO.java
.../skywalking/apm/collector/cache/dao/ApplicationH2DAO.java
+7
-1
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IApplicationDAO.java
...g/skywalking/apm/collector/cache/dao/IApplicationDAO.java
+3
-1
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IInstanceDAO.java
.../org/skywalking/apm/collector/cache/dao/IInstanceDAO.java
+26
-0
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IServiceNameDAO.java
...g/skywalking/apm/collector/cache/dao/IServiceNameDAO.java
+1
-1
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceEsDAO.java
...org/skywalking/apm/collector/cache/dao/InstanceEsDAO.java
+42
-0
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceH2DAO.java
...org/skywalking/apm/collector/cache/dao/InstanceH2DAO.java
+30
-0
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameEsDAO.java
.../skywalking/apm/collector/cache/dao/ServiceNameEsDAO.java
+1
-1
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameH2DAO.java
.../skywalking/apm/collector/cache/dao/ServiceNameH2DAO.java
+1
-1
apm-collector/apm-collector-cache/src/main/resources/META-INF/defines/es_dao.define
...r-cache/src/main/resources/META-INF/defines/es_dao.define
+3
-0
apm-collector/apm-collector-cache/src/main/resources/META-INF/defines/h2_dao.define
...r-cache/src/main/resources/META-INF/defines/h2_dao.define
+3
-0
apm-collector/apm-collector-ui/pom.xml
apm-collector/apm-collector-ui/pom.xml
+5
-0
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java
...va/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java
...g/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java
...org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java
...g/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java
...rg/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java
...kywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java
+2
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java
...lking/apm/collector/ui/service/InstanceHealthService.java
+1
-1
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SpanService.java
.../org/skywalking/apm/collector/ui/service/SpanService.java
+2
-2
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceStackService.java
...kywalking/apm/collector/ui/service/TraceStackService.java
+2
-2
apm-collector/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define
...ctor-ui/src/main/resources/META-INF/defines/es_dao.define
+0
-2
apm-collector/apm-collector-ui/src/main/resources/META-INF/defines/h2_dao.define
...ctor-ui/src/main/resources/META-INF/defines/h2_dao.define
+0
-2
apm-collector/pom.xml
apm-collector/pom.xml
+1
-0
未找到文件。
apm-collector/apm-collector-agentregister/pom.xml
浏览文件 @
fb9200a9
...
...
@@ -51,5 +51,10 @@
<artifactId>
apm-network
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-collector-cache
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/application/ApplicationIDService.java
浏览文件 @
fb9200a9
...
...
@@ -19,7 +19,7 @@
package
org.skywalking.apm.collector.agentregister.application
;
import
org.skywalking.apm.collector.agentregister.worker.application.ApplicationRegisterRemoteWorker
;
import
org.skywalking.apm.collector.
agentregister.worker.
cache.ApplicationCache
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.storage.define.register.ApplicationDataDefine
;
import
org.skywalking.apm.collector.stream.StreamModuleContext
;
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/servicename/ServiceNameService.java
浏览文件 @
fb9200a9
...
...
@@ -19,7 +19,7 @@
package
org.skywalking.apm.collector.agentregister.servicename
;
import
org.skywalking.apm.collector.agentregister.worker.servicename.ServiceNameRegisterRemoteWorker
;
import
org.skywalking.apm.collector.
agentregister.worker.servicenam
e.dao.IServiceNameDAO
;
import
org.skywalking.apm.collector.
cach
e.dao.IServiceNameDAO
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.storage.define.register.ServiceNameDataDefine
;
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterSerialWorker.java
浏览文件 @
fb9200a9
...
...
@@ -55,8 +55,10 @@ public class ApplicationRegisterSerialWorker extends AbstractLocalAsyncWorker {
ApplicationDataDefine
.
Application
application
=
(
ApplicationDataDefine
.
Application
)
message
;
logger
.
debug
(
"register application, application code: {}"
,
application
.
getApplicationCode
());
org
.
skywalking
.
apm
.
collector
.
cache
.
dao
.
IApplicationDAO
cacheDao
=
(
org
.
skywalking
.
apm
.
collector
.
cache
.
dao
.
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
org
.
skywalking
.
apm
.
collector
.
cache
.
dao
.
IApplicationDAO
.
class
.
getName
());
int
applicationId
=
cacheDao
.
getApplicationId
(
application
.
getApplicationCode
());
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
int
applicationId
=
dao
.
getApplicationId
(
application
.
getApplicationCode
());
if
(
applicationId
==
0
)
{
int
min
=
dao
.
getMinApplicationId
();
if
(
min
==
0
)
{
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -21,12 +21,7 @@ package org.skywalking.apm.collector.agentregister.worker.application.dao;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.elasticsearch.action.index.IndexResponse
;
import
org.elasticsearch.action.search.SearchRequestBuilder
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.search.SearchType
;
import
org.elasticsearch.action.support.WriteRequest
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.SearchHit
;
import
org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.skywalking.apm.collector.storage.define.register.ApplicationDataDefine
;
import
org.skywalking.apm.collector.storage.define.register.ApplicationTable
;
...
...
@@ -41,24 +36,6 @@ public class ApplicationEsDAO extends EsDAO implements IApplicationDAO {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationEsDAO
.
class
);
@Override
public
int
getApplicationId
(
String
applicationCode
)
{
ElasticSearchClient
client
=
getClient
();
SearchRequestBuilder
searchRequestBuilder
=
client
.
prepareSearch
(
ApplicationTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
"type"
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
QUERY_THEN_FETCH
);
searchRequestBuilder
.
setQuery
(
QueryBuilders
.
termQuery
(
ApplicationTable
.
COLUMN_APPLICATION_CODE
,
applicationCode
));
searchRequestBuilder
.
setSize
(
1
);
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
if
(
searchResponse
.
getHits
().
totalHits
>
0
)
{
SearchHit
searchHit
=
searchResponse
.
getHits
().
iterator
().
next
();
int
applicationId
=
(
int
)
searchHit
.
getSource
().
get
(
ApplicationTable
.
COLUMN_APPLICATION_ID
);
return
applicationId
;
}
return
0
;
}
@Override
public
int
getMaxApplicationId
()
{
return
getMaxId
(
ApplicationTable
.
TABLE
,
ApplicationTable
.
COLUMN_APPLICATION_ID
);
}
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationH2DAO.java
浏览文件 @
fb9200a9
...
...
@@ -18,7 +18,6 @@
package
org.skywalking.apm.collector.agentregister.worker.application.dao
;
import
org.skywalking.apm.collector.client.h2.H2Client
;
import
org.skywalking.apm.collector.storage.define.register.ApplicationDataDefine
;
import
org.skywalking.apm.collector.storage.h2.dao.H2DAO
;
...
...
@@ -27,11 +26,6 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
*/
public
class
ApplicationH2DAO
extends
H2DAO
implements
IApplicationDAO
{
@Override
public
int
getApplicationId
(
String
applicationCode
)
{
H2Client
client
=
getClient
();
return
100
;
}
@Override
public
int
getMaxApplicationId
()
{
return
0
;
}
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/IApplicationDAO.java
浏览文件 @
fb9200a9
...
...
@@ -24,8 +24,6 @@ import org.skywalking.apm.collector.storage.define.register.ApplicationDataDefin
* @author pengys5
*/
public
interface
IApplicationDAO
{
int
getApplicationId
(
String
applicationCode
);
int
getMaxApplicationId
();
int
getMinApplicationId
();
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/cache/ApplicationCache.java
已删除
100644 → 0
浏览文件 @
241e447e
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.agentregister.worker.cache
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
org.skywalking.apm.collector.agentregister.worker.application.dao.IApplicationDAO
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
/**
* @author pengys5
*/
public
class
ApplicationCache
{
private
static
Cache
<
String
,
Integer
>
CACHE
=
CacheBuilder
.
newBuilder
().
initialCapacity
(
100
).
maximumSize
(
1000
).
build
();
public
static
int
get
(
String
applicationCode
)
{
int
applicationId
=
0
;
try
{
applicationId
=
CACHE
.
get
(
applicationCode
,
()
->
{
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
return
dao
.
getApplicationId
(
applicationCode
);
});
}
catch
(
Throwable
e
)
{
return
applicationId
;
}
if
(
applicationId
==
0
)
{
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
applicationId
=
dao
.
getApplicationId
(
applicationCode
);
if
(
applicationId
!=
0
)
{
CACHE
.
put
(
applicationCode
,
applicationId
);
}
}
return
applicationId
;
}
}
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/IInstanceDAO.java
浏览文件 @
fb9200a9
...
...
@@ -33,6 +33,4 @@ public interface IInstanceDAO {
void
save
(
InstanceDataDefine
.
Instance
instance
);
void
updateHeartbeatTime
(
int
instanceId
,
long
heartbeatTime
);
int
getApplicationId
(
int
applicationInstanceId
);
}
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -20,7 +20,6 @@ package org.skywalking.apm.collector.agentregister.worker.instance.dao;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.elasticsearch.action.index.IndexResponse
;
import
org.elasticsearch.action.search.SearchRequestBuilder
;
import
org.elasticsearch.action.search.SearchResponse
;
...
...
@@ -101,13 +100,4 @@ public class InstanceEsDAO extends EsDAO implements IInstanceDAO {
updateRequest
.
doc
(
source
);
client
.
update
(
updateRequest
);
}
@Override
public
int
getApplicationId
(
int
applicationInstanceId
)
{
GetResponse
response
=
getClient
().
prepareGet
(
InstanceTable
.
TABLE
,
String
.
valueOf
(
applicationInstanceId
)).
get
();
if
(
response
.
isExists
())
{
return
(
int
)
response
.
getSource
().
get
(
InstanceTable
.
COLUMN_APPLICATION_ID
);
}
else
{
return
0
;
}
}
}
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceH2DAO.java
浏览文件 @
fb9200a9
...
...
@@ -25,6 +25,7 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
* @author pengys5
*/
public
class
InstanceH2DAO
extends
H2DAO
implements
IInstanceDAO
{
@Override
public
int
getInstanceId
(
int
applicationId
,
String
agentUUID
)
{
return
0
;
}
...
...
@@ -44,8 +45,4 @@ public class InstanceH2DAO extends H2DAO implements IInstanceDAO {
@Override
public
void
updateHeartbeatTime
(
int
instanceId
,
long
heartbeatTime
)
{
}
@Override
public
int
getApplicationId
(
int
applicationInstanceId
)
{
return
0
;
}
}
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterSerialWorker.java
浏览文件 @
fb9200a9
...
...
@@ -55,9 +55,10 @@ public class ServiceNameRegisterSerialWorker extends AbstractLocalAsyncWorker {
ServiceNameDataDefine
.
ServiceName
serviceName
=
(
ServiceNameDataDefine
.
ServiceName
)
message
;
logger
.
debug
(
"register service name: {}, application id: {}"
,
serviceName
.
getServiceName
(),
serviceName
.
getApplicationId
());
IServiceNameDAO
dao
=
(
IServiceNameDAO
)
DAOContainer
.
INSTANCE
.
get
(
IServiceNameDAO
.
class
.
getName
());
int
serviceId
=
d
ao
.
getServiceId
(
serviceName
.
getApplicationId
(),
serviceName
.
getServiceName
());
org
.
skywalking
.
apm
.
collector
.
cache
.
dao
.
IServiceNameDAO
cacheDao
=
(
org
.
skywalking
.
apm
.
collector
.
cache
.
dao
.
IServiceNameDAO
)
DAOContainer
.
INSTANCE
.
get
(
IServiceNameDAO
.
class
.
getName
());
int
serviceId
=
cacheD
ao
.
getServiceId
(
serviceName
.
getApplicationId
(),
serviceName
.
getServiceName
());
IServiceNameDAO
dao
=
(
IServiceNameDAO
)
DAOContainer
.
INSTANCE
.
get
(
IServiceNameDAO
.
class
.
getName
());
if
(
serviceId
==
0
)
{
int
min
=
dao
.
getMinServiceId
();
if
(
min
==
0
)
{
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/IServiceNameDAO.java
浏览文件 @
fb9200a9
...
...
@@ -24,10 +24,6 @@ import org.skywalking.apm.collector.storage.define.register.ServiceNameDataDefin
* @author pengys5
*/
public
interface
IServiceNameDAO
{
int
getServiceId
(
int
applicationId
,
String
serviceName
);
String
getServiceName
(
int
serviceId
);
int
getMaxServiceId
();
int
getMinServiceId
();
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -20,17 +20,9 @@ package org.skywalking.apm.collector.agentregister.worker.servicename.dao;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.elasticsearch.action.index.IndexResponse
;
import
org.elasticsearch.action.search.SearchRequestBuilder
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.search.SearchType
;
import
org.elasticsearch.action.support.WriteRequest
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.SearchHit
;
import
org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.storage.define.register.ServiceNameDataDefine
;
import
org.skywalking.apm.collector.storage.define.register.ServiceNameTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
...
...
@@ -44,27 +36,6 @@ public class ServiceNameEsDAO extends EsDAO implements IServiceNameDAO {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceNameEsDAO
.
class
);
@Override
public
int
getServiceId
(
int
applicationId
,
String
serviceName
)
{
ElasticSearchClient
client
=
getClient
();
SearchRequestBuilder
searchRequestBuilder
=
client
.
prepareSearch
(
ServiceNameTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
ServiceNameTable
.
TABLE_TYPE
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
QUERY_THEN_FETCH
);
BoolQueryBuilder
builder
=
QueryBuilders
.
boolQuery
();
builder
.
must
().
add
(
QueryBuilders
.
termQuery
(
ServiceNameTable
.
COLUMN_APPLICATION_ID
,
applicationId
));
builder
.
must
().
add
(
QueryBuilders
.
termQuery
(
ServiceNameTable
.
COLUMN_SERVICE_NAME
,
serviceName
));
searchRequestBuilder
.
setQuery
(
builder
);
searchRequestBuilder
.
setSize
(
1
);
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
if
(
searchResponse
.
getHits
().
totalHits
>
0
)
{
SearchHit
searchHit
=
searchResponse
.
getHits
().
iterator
().
next
();
int
serviceId
=
(
int
)
searchHit
.
getSource
().
get
(
ServiceNameTable
.
COLUMN_SERVICE_ID
);
return
serviceId
;
}
return
0
;
}
@Override
public
int
getMaxServiceId
()
{
return
getMaxId
(
ServiceNameTable
.
TABLE
,
ServiceNameTable
.
COLUMN_SERVICE_ID
);
}
...
...
@@ -73,15 +44,6 @@ public class ServiceNameEsDAO extends EsDAO implements IServiceNameDAO {
return
getMinId
(
ServiceNameTable
.
TABLE
,
ServiceNameTable
.
COLUMN_SERVICE_ID
);
}
@Override
public
String
getServiceName
(
int
serviceId
)
{
GetResponse
response
=
getClient
().
prepareGet
(
ServiceNameTable
.
TABLE
,
String
.
valueOf
(
serviceId
)).
get
();
if
(
response
.
isExists
())
{
return
(
String
)
response
.
getSource
().
get
(
ServiceNameTable
.
COLUMN_SERVICE_NAME
);
}
else
{
return
Const
.
EMPTY_STRING
;
}
}
@Override
public
void
save
(
ServiceNameDataDefine
.
ServiceName
serviceName
)
{
logger
.
debug
(
"save service name register info, application id: {}, service name: {}"
,
serviceName
.
getApplicationId
(),
serviceName
.
getServiceName
());
ElasticSearchClient
client
=
getClient
();
...
...
apm-collector/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameH2DAO.java
浏览文件 @
fb9200a9
...
...
@@ -26,10 +26,6 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
*/
public
class
ServiceNameH2DAO
extends
H2DAO
implements
IServiceNameDAO
{
@Override
public
int
getServiceId
(
int
applicationId
,
String
serviceName
)
{
return
0
;
}
@Override
public
int
getMaxServiceId
()
{
return
0
;
}
...
...
@@ -38,10 +34,6 @@ public class ServiceNameH2DAO extends H2DAO implements IServiceNameDAO {
return
0
;
}
@Override
public
String
getServiceName
(
int
serviceId
)
{
return
null
;
}
@Override
public
void
save
(
ServiceNameDataDefine
.
ServiceName
serviceName
)
{
}
...
...
apm-collector/apm-collector-agentstream/pom.xml
浏览文件 @
fb9200a9
...
...
@@ -61,5 +61,10 @@
<artifactId>
apm-collector-agentregister
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-collector-cache
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/cache/ServiceCache.java
已删除
100644 → 0
浏览文件 @
241e447e
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.agentstream.worker.cache
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
org.skywalking.apm.collector.agentregister.worker.servicename.dao.IServiceNameDAO
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
/**
* @author pengys5
*/
public
class
ServiceCache
{
private
static
Cache
<
Integer
,
String
>
CACHE
=
CacheBuilder
.
newBuilder
().
initialCapacity
(
1000
).
maximumSize
(
20000
).
build
();
public
static
String
getServiceName
(
int
serviceId
)
{
try
{
return
CACHE
.
get
(
serviceId
,
()
->
{
IServiceNameDAO
dao
=
(
IServiceNameDAO
)
DAOContainer
.
INSTANCE
.
get
(
IServiceNameDAO
.
class
.
getName
());
return
dao
.
getServiceName
(
serviceId
);
});
}
catch
(
Throwable
e
)
{
return
Const
.
EMPTY_STRING
;
}
}
}
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java
浏览文件 @
fb9200a9
...
...
@@ -20,10 +20,10 @@ package org.skywalking.apm.collector.agentstream.worker.noderef;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.skywalking.apm.collector.agentstream.worker.cache.InstanceCache
;
import
org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.ExitSpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.RefsListener
;
import
org.skywalking.apm.collector.cache.InstanceCache
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.core.util.CollectionUtils
;
import
org.skywalking.apm.collector.core.util.Const
;
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java
浏览文件 @
fb9200a9
...
...
@@ -20,11 +20,11 @@ package org.skywalking.apm.collector.agentstream.worker.segment.cost;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.skywalking.apm.collector.agentstream.worker.cache.ServiceCache
;
import
org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.ExitSpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.LocalSpanListener
;
import
org.skywalking.apm.collector.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
import
org.skywalking.apm.collector.storage.define.segment.SegmentCostDataDefine
;
...
...
@@ -64,7 +64,7 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe
if
(
spanObject
.
getOperationNameId
()
==
0
)
{
segmentCost
.
setServiceName
(
spanObject
.
getOperationName
());
}
else
{
segmentCost
.
setServiceName
(
Service
Cache
.
getServiceName
(
spanObject
.
getOperationNameId
()));
segmentCost
.
setServiceName
(
Service
NameCache
.
get
(
spanObject
.
getOperationNameId
()));
}
segmentCosts
.
add
(
segmentCost
);
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java
浏览文件 @
fb9200a9
...
...
@@ -18,10 +18,10 @@
package
org.skywalking.apm.collector.agentstream.worker.service.entry
;
import
org.skywalking.apm.collector.agentstream.worker.cache.ServiceCache
;
import
org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.RefsListener
;
import
org.skywalking.apm.collector.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
...
...
@@ -56,7 +56,7 @@ public class ServiceEntrySpanListener implements RefsListener, FirstSpanListener
if
(
spanObject
.
getOperationNameId
()
==
0
)
{
this
.
entryServiceName
=
spanObject
.
getOperationName
();
}
else
{
this
.
entryServiceName
=
Service
Cache
.
getServiceName
(
this
.
entryServiceId
);
this
.
entryServiceName
=
Service
NameCache
.
get
(
this
.
entryServiceId
);
}
this
.
hasEntry
=
true
;
}
...
...
apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java
浏览文件 @
fb9200a9
...
...
@@ -20,10 +20,10 @@ package org.skywalking.apm.collector.agentstream.worker.serviceref;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.skywalking.apm.collector.agentstream.worker.cache.InstanceCache
;
import
org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener
;
import
org.skywalking.apm.collector.agentstream.worker.segment.RefsListener
;
import
org.skywalking.apm.collector.cache.InstanceCache
;
import
org.skywalking.apm.collector.core.framework.CollectorContextHelper
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
...
...
apm-collector/apm-collector-cache/pom.xml
0 → 100644
浏览文件 @
fb9200a9
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
apm-collector
</artifactId>
<groupId>
org.skywalking
</groupId>
<version>
3.2.3-2017
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-collector-cache
</artifactId>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-collector-core
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-collector-storage
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/cache/ApplicationCache.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector
/cache/ApplicationCache.java
浏览文件 @
fb9200a9
...
...
@@ -16,25 +16,47 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui.
cache
;
package
org.skywalking.apm.collector.cache
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
org.skywalking.apm.collector.cache.dao.IApplicationDAO
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.ui.dao.IApplicationDAO
;
/**
* @author pengys5
*/
public
class
ApplicationCache
{
//TODO size configuration
private
static
Cache
<
Integer
,
String
>
CACHE
=
CacheBuilder
.
newBuilder
().
maximumSize
(
1000
).
build
();
private
static
Cache
<
String
,
Integer
>
CODE_CACHE
=
CacheBuilder
.
newBuilder
().
initialCapacity
(
100
).
maximumSize
(
1000
).
build
();
public
static
int
get
(
String
applicationCode
)
{
int
applicationId
=
0
;
try
{
applicationId
=
CODE_CACHE
.
get
(
applicationCode
,
()
->
{
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
return
dao
.
getApplicationId
(
applicationCode
);
});
}
catch
(
Throwable
e
)
{
return
applicationId
;
}
if
(
applicationId
==
0
)
{
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
applicationId
=
dao
.
getApplicationId
(
applicationCode
);
if
(
applicationId
!=
0
)
{
CODE_CACHE
.
put
(
applicationCode
,
applicationId
);
}
}
return
applicationId
;
}
private
static
Cache
<
Integer
,
String
>
ID_CACHE
=
CacheBuilder
.
newBuilder
().
maximumSize
(
1000
).
build
();
public
static
String
get
(
int
applicationId
)
{
try
{
return
CACHE
.
get
(
applicationId
,
()
->
{
return
ID_
CACHE
.
get
(
applicationId
,
()
->
{
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
return
dao
.
getApplicationCode
(
applicationId
);
});
...
...
@@ -48,7 +70,7 @@ public class ApplicationCache {
if
(
applicationCode
.
equals
(
"Unknown"
))
{
IApplicationDAO
dao
=
(
IApplicationDAO
)
DAOContainer
.
INSTANCE
.
get
(
IApplicationDAO
.
class
.
getName
());
applicationCode
=
dao
.
getApplicationCode
(
applicationId
);
CACHE
.
put
(
applicationId
,
applicationCode
);
ID_
CACHE
.
put
(
applicationId
,
applicationCode
);
}
return
applicationCode
;
}
...
...
apm-collector/apm-collector-
agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worke
r/cache/InstanceCache.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collecto
r/cache/InstanceCache.java
浏览文件 @
fb9200a9
...
...
@@ -16,11 +16,11 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
agentstream.worker.
cache
;
package
org.skywalking.apm.collector.cache
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
org.skywalking.apm.collector.
agentregister.worker.instanc
e.dao.IInstanceDAO
;
import
org.skywalking.apm.collector.
cach
e.dao.IInstanceDAO
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
/**
...
...
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/cache/ServiceIdCache.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector
/cache/ServiceIdCache.java
浏览文件 @
fb9200a9
...
...
@@ -16,13 +16,13 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui.
cache
;
package
org.skywalking.apm.collector.cache
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
org.skywalking.apm.collector.cache.dao.IServiceNameDAO
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.ui.dao.IServiceNameDAO
;
/**
* @author pengys5
...
...
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/cache/ServiceNameCache.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector
/cache/ServiceNameCache.java
浏览文件 @
fb9200a9
...
...
@@ -16,13 +16,13 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui.
cache
;
package
org.skywalking.apm.collector.cache
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
org.skywalking.apm.collector.cache.dao.IServiceNameDAO
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.ui.dao.IServiceNameDAO
;
/**
* @author pengys5
...
...
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/dao/ApplicationEsDAO.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector/cache
/dao/ApplicationEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -16,10 +16,15 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui
.dao
;
package
org.skywalking.apm.collector.
cache
.dao
;
import
org.elasticsearch.action.get.GetRequestBuilder
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.elasticsearch.action.search.SearchRequestBuilder
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.search.SearchType
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.SearchHit
;
import
org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.storage.define.register.ApplicationTable
;
...
...
@@ -34,6 +39,24 @@ public class ApplicationEsDAO extends EsDAO implements IApplicationDAO {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationEsDAO
.
class
);
@Override
public
int
getApplicationId
(
String
applicationCode
)
{
ElasticSearchClient
client
=
getClient
();
SearchRequestBuilder
searchRequestBuilder
=
client
.
prepareSearch
(
ApplicationTable
.
TABLE
);
searchRequestBuilder
.
setTypes
(
"type"
);
searchRequestBuilder
.
setSearchType
(
SearchType
.
QUERY_THEN_FETCH
);
searchRequestBuilder
.
setQuery
(
QueryBuilders
.
termQuery
(
ApplicationTable
.
COLUMN_APPLICATION_CODE
,
applicationCode
));
searchRequestBuilder
.
setSize
(
1
);
SearchResponse
searchResponse
=
searchRequestBuilder
.
execute
().
actionGet
();
if
(
searchResponse
.
getHits
().
totalHits
>
0
)
{
SearchHit
searchHit
=
searchResponse
.
getHits
().
iterator
().
next
();
int
applicationId
=
(
int
)
searchHit
.
getSource
().
get
(
ApplicationTable
.
COLUMN_APPLICATION_ID
);
return
applicationId
;
}
return
0
;
}
@Override
public
String
getApplicationCode
(
int
applicationId
)
{
logger
.
debug
(
"get application code, applicationId: {}"
,
applicationId
);
ElasticSearchClient
client
=
getClient
();
...
...
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/dao/ApplicationH2DAO.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector/cache
/dao/ApplicationH2DAO.java
浏览文件 @
fb9200a9
...
...
@@ -16,8 +16,9 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui
.dao
;
package
org.skywalking.apm.collector.
cache
.dao
;
import
org.skywalking.apm.collector.client.h2.H2Client
;
import
org.skywalking.apm.collector.storage.h2.dao.H2DAO
;
/**
...
...
@@ -25,6 +26,11 @@ import org.skywalking.apm.collector.storage.h2.dao.H2DAO;
*/
public
class
ApplicationH2DAO
extends
H2DAO
implements
IApplicationDAO
{
@Override
public
int
getApplicationId
(
String
applicationCode
)
{
H2Client
client
=
getClient
();
return
100
;
}
@Override
public
String
getApplicationCode
(
int
applicationId
)
{
return
null
;
}
...
...
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/dao/IApplicationDAO.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector/cache
/dao/IApplicationDAO.java
浏览文件 @
fb9200a9
...
...
@@ -16,11 +16,13 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui
.dao
;
package
org.skywalking.apm.collector.
cache
.dao
;
/**
* @author pengys5
*/
public
interface
IApplicationDAO
{
int
getApplicationId
(
String
applicationCode
);
String
getApplicationCode
(
int
applicationId
);
}
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IInstanceDAO.java
0 → 100644
浏览文件 @
fb9200a9
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cache.dao
;
/**
* @author pengys5
*/
public
interface
IInstanceDAO
{
int
getApplicationId
(
int
applicationInstanceId
);
}
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/dao/IServiceNameDAO.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector/cache
/dao/IServiceNameDAO.java
浏览文件 @
fb9200a9
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui
.dao
;
package
org.skywalking.apm.collector.
cache
.dao
;
/**
* @author pengys5
...
...
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceEsDAO.java
0 → 100644
浏览文件 @
fb9200a9
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cache.dao
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.skywalking.apm.collector.storage.define.register.InstanceTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author pengys5
*/
public
class
InstanceEsDAO
extends
EsDAO
implements
IInstanceDAO
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
InstanceEsDAO
.
class
);
@Override
public
int
getApplicationId
(
int
applicationInstanceId
)
{
GetResponse
response
=
getClient
().
prepareGet
(
InstanceTable
.
TABLE
,
String
.
valueOf
(
applicationInstanceId
)).
get
();
if
(
response
.
isExists
())
{
return
(
int
)
response
.
getSource
().
get
(
InstanceTable
.
COLUMN_APPLICATION_ID
);
}
else
{
return
0
;
}
}
}
apm-collector/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceH2DAO.java
0 → 100644
浏览文件 @
fb9200a9
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cache.dao
;
import
org.skywalking.apm.collector.storage.h2.dao.H2DAO
;
/**
* @author pengys5
*/
public
class
InstanceH2DAO
extends
H2DAO
implements
IInstanceDAO
{
@Override
public
int
getApplicationId
(
int
applicationInstanceId
)
{
return
0
;
}
}
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/dao/ServiceNameEsDAO.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector/cache
/dao/ServiceNameEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui
.dao
;
package
org.skywalking.apm.collector.
cache
.dao
;
import
org.elasticsearch.action.get.GetRequestBuilder
;
import
org.elasticsearch.action.get.GetResponse
;
...
...
apm-collector/apm-collector-
ui/src/main/java/org/skywalking/apm/collector/ui
/dao/ServiceNameH2DAO.java
→
apm-collector/apm-collector-
cache/src/main/java/org/skywalking/apm/collector/cache
/dao/ServiceNameH2DAO.java
浏览文件 @
fb9200a9
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.
ui
.dao
;
package
org.skywalking.apm.collector.
cache
.dao
;
import
org.skywalking.apm.collector.storage.h2.dao.H2DAO
;
...
...
apm-collector/apm-collector-cache/src/main/resources/META-INF/defines/es_dao.define
0 → 100644
浏览文件 @
fb9200a9
org.skywalking.apm.collector.cache.dao.ApplicationEsDAO
org.skywalking.apm.collector.cache.dao.InstanceEsDAO
org.skywalking.apm.collector.cache.dao.ServiceNameEsDAO
\ No newline at end of file
apm-collector/apm-collector-cache/src/main/resources/META-INF/defines/h2_dao.define
0 → 100644
浏览文件 @
fb9200a9
org.skywalking.apm.collector.cache.dao.ApplicationH2DAO
org.skywalking.apm.collector.cache.dao.InstanceH2DAO
org.skywalking.apm.collector.cache.dao.ServiceNameH2DAO
\ No newline at end of file
apm-collector/apm-collector-ui/pom.xml
浏览文件 @
fb9200a9
...
...
@@ -51,5 +51,10 @@
<artifactId>
apm-collector-storage
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-collector-cache
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -37,11 +37,11 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import
org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount
;
import
org.elasticsearch.search.sort.SortBuilders
;
import
org.elasticsearch.search.sort.SortMode
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
import
org.skywalking.apm.collector.storage.define.register.InstanceDataDefine
;
import
org.skywalking.apm.collector.storage.define.register.InstanceTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -26,10 +26,10 @@ import org.elasticsearch.action.search.SearchType;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.define.node.NodeComponentTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -26,10 +26,10 @@ import org.elasticsearch.action.search.SearchType;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.define.node.NodeMappingTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -28,10 +28,10 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.aggregations.metrics.sum.Sum
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.define.noderef.NodeReferenceTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -29,11 +29,11 @@ import org.elasticsearch.search.SearchHit;
import
org.elasticsearch.search.SearchHits
;
import
org.elasticsearch.search.sort.SortBuilders
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.util.ColumnNameUtils
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.define.service.ServiceEntryTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
/**
* @author pengys5
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java
浏览文件 @
fb9200a9
...
...
@@ -31,14 +31,14 @@ import org.elasticsearch.index.query.QueryBuilders;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.metrics.sum.Sum
;
import
org.skywalking.apm.collector.cache.ServiceIdCache
;
import
org.skywalking.apm.collector.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.core.util.ColumnNameUtils
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.ObjectUtils
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.define.serviceref.ServiceReferenceTable
;
import
org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO
;
import
org.skywalking.apm.collector.ui.cache.ServiceIdCache
;
import
org.skywalking.apm.collector.ui.cache.ServiceNameCache
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java
浏览文件 @
fb9200a9
...
...
@@ -21,10 +21,10 @@ package org.skywalking.apm.collector.ui.service;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
java.util.List
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.core.util.TimeBucketUtils
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.storage.define.register.InstanceDataDefine
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.skywalking.apm.collector.ui.dao.IGCMetricDAO
;
import
org.skywalking.apm.collector.ui.dao.IInstPerformanceDAO
;
import
org.skywalking.apm.collector.ui.dao.IInstanceDAO
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SpanService.java
浏览文件 @
fb9200a9
...
...
@@ -21,11 +21,11 @@ package org.skywalking.apm.collector.ui.service;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
java.util.List
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.skywalking.apm.collector.ui.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.ui.dao.ISegmentDAO
;
import
org.skywalking.apm.network.proto.KeyWithStringValue
;
import
org.skywalking.apm.network.proto.LogMessage
;
...
...
apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceStackService.java
浏览文件 @
fb9200a9
...
...
@@ -22,13 +22,13 @@ import com.google.gson.JsonArray;
import
com.google.gson.JsonObject
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.skywalking.apm.collector.cache.ApplicationCache
;
import
org.skywalking.apm.collector.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.core.util.CollectionUtils
;
import
org.skywalking.apm.collector.core.util.Const
;
import
org.skywalking.apm.collector.core.util.ObjectUtils
;
import
org.skywalking.apm.collector.core.util.StringUtils
;
import
org.skywalking.apm.collector.storage.dao.DAOContainer
;
import
org.skywalking.apm.collector.ui.cache.ApplicationCache
;
import
org.skywalking.apm.collector.ui.cache.ServiceNameCache
;
import
org.skywalking.apm.collector.ui.dao.IGlobalTraceDAO
;
import
org.skywalking.apm.collector.ui.dao.ISegmentDAO
;
import
org.skywalking.apm.network.proto.SpanObject
;
...
...
apm-collector/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define
浏览文件 @
fb9200a9
...
...
@@ -4,8 +4,6 @@ org.skywalking.apm.collector.ui.dao.NodeReferenceEsDAO
org.skywalking.apm.collector.ui.dao.SegmentCostEsDAO
org.skywalking.apm.collector.ui.dao.GlobalTraceEsDAO
org.skywalking.apm.collector.ui.dao.SegmentEsDAO
org.skywalking.apm.collector.ui.dao.ApplicationEsDAO
org.skywalking.apm.collector.ui.dao.ServiceNameEsDAO
org.skywalking.apm.collector.ui.dao.InstanceEsDAO
org.skywalking.apm.collector.ui.dao.InstPerformanceEsDAO
org.skywalking.apm.collector.ui.dao.CpuMetricEsDAO
...
...
apm-collector/apm-collector-ui/src/main/resources/META-INF/defines/h2_dao.define
浏览文件 @
fb9200a9
...
...
@@ -4,8 +4,6 @@ org.skywalking.apm.collector.ui.dao.NodeReferenceH2DAO
org.skywalking.apm.collector.ui.dao.SegmentCostH2DAO
org.skywalking.apm.collector.ui.dao.GlobalTraceH2DAO
org.skywalking.apm.collector.ui.dao.SegmentH2DAO
org.skywalking.apm.collector.ui.dao.ApplicationH2DAO
org.skywalking.apm.collector.ui.dao.ServiceNameH2DAO
org.skywalking.apm.collector.ui.dao.InstanceH2DAO
org.skywalking.apm.collector.ui.dao.InstPerformanceH2DAO
org.skywalking.apm.collector.ui.dao.GCMetricH2DAO
...
...
apm-collector/pom.xml
浏览文件 @
fb9200a9
...
...
@@ -35,6 +35,7 @@
<module>
apm-collector-agentregister
</module>
<module>
apm-collector-agentjvm
</module>
<module>
apm-collector-remote
</module>
<module>
apm-collector-cache
</module>
</modules>
<parent>
<artifactId>
apm
</artifactId>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录