Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
ccd4c8ef
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 搜索 >>
提交
ccd4c8ef
编写于
1月 11, 2018
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CPU metric pyramid aggregate by h2 storage test successful.
上级
d42eb019
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
580 addition
and
437 deletion
+580
-437
apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java
...rpc/provider/handler/JVMMetricServiceHandlerTestCase.java
+3
-3
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java
...pache/skywalking/apm/collector/storage/StorageModule.java
+5
-72
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/base/sql/SqlBuilder.java
...skywalking/apm/collector/storage/base/sql/SqlBuilder.java
+3
-1
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationEsRegisterDAO.java
...tor/storage/es/dao/register/ApplicationEsRegisterDAO.java
+0
-64
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceEsRegisterDAO.java
...lector/storage/es/dao/register/InstanceEsRegisterDAO.java
+0
-84
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameEsRegisterDAO.java
...tor/storage/es/dao/register/ServiceNameEsRegisterDAO.java
+0
-63
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java
...ing/apm/collector/storage/h2/StorageModuleH2Provider.java
+23
-66
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/base/dao/AbstractPersistenceH2DAO.java
...llector/storage/h2/base/dao/AbstractPersistenceH2DAO.java
+95
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java
...pm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java
+0
-73
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/AbstractCpuMetricH2PersistenceDAO.java
...orage/h2/dao/cpump/AbstractCpuMetricH2PersistenceDAO.java
+64
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuDayMetricH2PersistenceDAO.java
...or/storage/h2/dao/cpump/CpuDayMetricH2PersistenceDAO.java
+41
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuHourMetricH2PersistenceDAO.java
...r/storage/h2/dao/cpump/CpuHourMetricH2PersistenceDAO.java
+41
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java
...storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java
+41
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java
.../storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java
+41
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java
...storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java
+41
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/AbstractCpuMetricH2TableDefine.java
...storage/h2/define/cpu/AbstractCpuMetricH2TableDefine.java
+12
-11
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java
...ctor/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java
+33
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java
...tor/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java
+33
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java
...r/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java
+33
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java
...or/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java
+33
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java
...r/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java
+33
-0
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define
...ovider/src/main/resources/META-INF/defines/storage.define
+5
-0
未找到文件。
apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java
浏览文件 @
ccd4c8ef
...
...
@@ -46,9 +46,9 @@ public class JVMMetricServiceHandlerTestCase {
metricBuilder
.
setTime
(
System
.
currentTimeMillis
());
buildCPUMetric
(
metricBuilder
);
buildGCMetric
(
metricBuilder
);
buildMemoryMetric
(
metricBuilder
);
buildMemoryPoolMetric
(
metricBuilder
);
//
buildGCMetric(metricBuilder);
//
buildMemoryMetric(metricBuilder);
//
buildMemoryPoolMetric(metricBuilder);
builder
.
addMetrics
(
metricBuilder
.
build
());
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java
浏览文件 @
ccd4c8ef
...
...
@@ -27,46 +27,14 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
import
org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IGlobalTracePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IGlobalTraceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceHeartBeatPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentCostPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentCostUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentDayPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentHourPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMonthPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingDayPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingHourPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMonthPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO
;
...
...
@@ -76,45 +44,10 @@ import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersi
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingDayPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingHourPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMonthPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.smp.IServiceDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.smp.IServiceHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMonthMetricPersistenceDAO
;
/**
* @author peng-yongsheng
...
...
@@ -155,11 +88,11 @@ public class StorageModule extends Module {
}
private
void
addPersistenceDAO
(
List
<
Class
>
classes
)
{
//
classes.add(ICpuSecondMetricPersistenceDAO.class);
//
classes.add(ICpuMinuteMetricPersistenceDAO.class);
//
classes.add(ICpuHourMetricPersistenceDAO.class);
//
classes.add(ICpuDayMetricPersistenceDAO.class);
//
classes.add(ICpuMonthMetricPersistenceDAO.class);
classes
.
add
(
ICpuSecondMetricPersistenceDAO
.
class
);
classes
.
add
(
ICpuMinuteMetricPersistenceDAO
.
class
);
classes
.
add
(
ICpuHourMetricPersistenceDAO
.
class
);
classes
.
add
(
ICpuDayMetricPersistenceDAO
.
class
);
classes
.
add
(
ICpuMonthMetricPersistenceDAO
.
class
);
//
// classes.add(IGCSecondMetricPersistenceDAO.class);
// classes.add(IGCMinuteMetricPersistenceDAO.class);
...
...
apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/base/sql/SqlBuilder.java
浏览文件 @
ccd4c8ef
...
...
@@ -16,13 +16,15 @@
*
*/
package
org.apache.skywalking.apm.collector.storage.base.sql
;
import
java.text.MessageFormat
;
import
java.util.List
;
import
java.util.Set
;
/**
* @author peng-yongsheng, clevertension
*/
public
class
SqlBuilder
{
public
static
String
buildSql
(
String
sql
,
Object
...
args
)
{
return
MessageFormat
.
format
(
sql
,
args
);
...
...
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationEsRegisterDAO.java
已删除
100644 → 0
浏览文件 @
d42eb019
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.es.dao.register
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.Application
;
import
org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable
;
import
org.elasticsearch.action.index.IndexResponse
;
import
org.elasticsearch.action.support.WriteRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
ApplicationEsRegisterDAO
extends
EsDAO
implements
IApplicationRegisterDAO
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationEsRegisterDAO
.
class
);
public
ApplicationEsRegisterDAO
(
ElasticSearchClient
client
)
{
super
(
client
);
}
@Override
public
int
getMaxApplicationId
()
{
return
getMaxId
(
ApplicationTable
.
TABLE
,
ApplicationTable
.
COLUMN_APPLICATION_ID
);
}
@Override
public
int
getMinApplicationId
()
{
return
getMinId
(
ApplicationTable
.
TABLE
,
ApplicationTable
.
COLUMN_APPLICATION_ID
);
}
@Override
public
void
save
(
Application
application
)
{
logger
.
debug
(
"save application register info, application getId: {}, application code: {}"
,
application
.
getId
(),
application
.
getApplicationCode
());
ElasticSearchClient
client
=
getClient
();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
ApplicationTable
.
COLUMN_APPLICATION_CODE
,
application
.
getApplicationCode
());
source
.
put
(
ApplicationTable
.
COLUMN_APPLICATION_ID
,
application
.
getApplicationId
());
source
.
put
(
ApplicationTable
.
COLUMN_ADDRESS_ID
,
application
.
getAddressId
());
source
.
put
(
ApplicationTable
.
COLUMN_IS_ADDRESS
,
application
.
getIsAddress
());
IndexResponse
response
=
client
.
prepareIndex
(
ApplicationTable
.
TABLE
,
application
.
getId
()).
setSource
(
source
).
setRefreshPolicy
(
WriteRequest
.
RefreshPolicy
.
IMMEDIATE
).
get
();
logger
.
debug
(
"save application register info, application getId: {}, application code: {}, status: {}"
,
application
.
getApplicationId
(),
application
.
getApplicationCode
(),
response
.
status
().
name
());
}
}
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceEsRegisterDAO.java
已删除
100644 → 0
浏览文件 @
d42eb019
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.es.dao.register
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.Instance
;
import
org.apache.skywalking.apm.collector.storage.table.register.InstanceTable
;
import
org.elasticsearch.action.index.IndexResponse
;
import
org.elasticsearch.action.support.WriteRequest
;
import
org.elasticsearch.action.update.UpdateRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
InstanceEsRegisterDAO
extends
EsDAO
implements
IInstanceRegisterDAO
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
InstanceEsRegisterDAO
.
class
);
public
InstanceEsRegisterDAO
(
ElasticSearchClient
client
)
{
super
(
client
);
}
@Override
public
int
getMaxInstanceId
()
{
return
getMaxId
(
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_INSTANCE_ID
);
}
@Override
public
int
getMinInstanceId
()
{
return
getMinId
(
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_INSTANCE_ID
);
}
@Override
public
void
save
(
Instance
instance
)
{
logger
.
debug
(
"save instance register info, application getId: {}, agentUUID: {}"
,
instance
.
getApplicationId
(),
instance
.
getAgentUUID
());
ElasticSearchClient
client
=
getClient
();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
InstanceTable
.
COLUMN_INSTANCE_ID
,
instance
.
getInstanceId
());
source
.
put
(
InstanceTable
.
COLUMN_APPLICATION_ID
,
instance
.
getApplicationId
());
source
.
put
(
InstanceTable
.
COLUMN_AGENT_UUID
,
instance
.
getAgentUUID
());
source
.
put
(
InstanceTable
.
COLUMN_REGISTER_TIME
,
instance
.
getRegisterTime
());
source
.
put
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
instance
.
getHeartBeatTime
());
source
.
put
(
InstanceTable
.
COLUMN_OS_INFO
,
instance
.
getOsInfo
());
source
.
put
(
InstanceTable
.
COLUMN_ADDRESS_ID
,
instance
.
getAddressId
());
source
.
put
(
InstanceTable
.
COLUMN_IS_ADDRESS
,
instance
.
getIsAddress
());
IndexResponse
response
=
client
.
prepareIndex
(
InstanceTable
.
TABLE
,
instance
.
getId
()).
setSource
(
source
).
setRefreshPolicy
(
WriteRequest
.
RefreshPolicy
.
IMMEDIATE
).
get
();
logger
.
debug
(
"save instance register info, application getId: {}, agentUUID: {}, status: {}"
,
instance
.
getApplicationId
(),
instance
.
getAgentUUID
(),
response
.
status
().
name
());
}
@Override
public
void
updateHeartbeatTime
(
int
instanceId
,
long
heartbeatTime
)
{
ElasticSearchClient
client
=
getClient
();
UpdateRequest
updateRequest
=
new
UpdateRequest
();
updateRequest
.
index
(
InstanceTable
.
TABLE
);
updateRequest
.
type
(
"type"
);
updateRequest
.
id
(
String
.
valueOf
(
instanceId
));
updateRequest
.
setRefreshPolicy
(
WriteRequest
.
RefreshPolicy
.
IMMEDIATE
);
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
heartbeatTime
);
updateRequest
.
doc
(
source
);
client
.
update
(
updateRequest
);
}
}
apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameEsRegisterDAO.java
已删除
100644 → 0
浏览文件 @
d42eb019
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.es.dao.register
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.ServiceName
;
import
org.apache.skywalking.apm.collector.storage.table.register.ServiceNameTable
;
import
org.elasticsearch.action.index.IndexResponse
;
import
org.elasticsearch.action.support.WriteRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
ServiceNameEsRegisterDAO
extends
EsDAO
implements
IServiceNameRegisterDAO
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceNameEsRegisterDAO
.
class
);
public
ServiceNameEsRegisterDAO
(
ElasticSearchClient
client
)
{
super
(
client
);
}
@Override
public
int
getMaxServiceId
()
{
return
getMaxId
(
ServiceNameTable
.
TABLE
,
ServiceNameTable
.
COLUMN_SERVICE_ID
);
}
@Override
public
int
getMinServiceId
()
{
return
getMinId
(
ServiceNameTable
.
TABLE
,
ServiceNameTable
.
COLUMN_SERVICE_ID
);
}
@Override
public
void
save
(
ServiceName
serviceName
)
{
logger
.
debug
(
"save service name register info, application getId: {}, service name: {}"
,
serviceName
.
getId
(),
serviceName
.
getServiceName
());
ElasticSearchClient
client
=
getClient
();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
ServiceNameTable
.
COLUMN_SERVICE_ID
,
serviceName
.
getServiceId
());
source
.
put
(
ServiceNameTable
.
COLUMN_APPLICATION_ID
,
serviceName
.
getApplicationId
());
source
.
put
(
ServiceNameTable
.
COLUMN_SERVICE_NAME
,
serviceName
.
getServiceName
());
IndexResponse
response
=
client
.
prepareIndex
(
ServiceNameTable
.
TABLE
,
serviceName
.
getId
()).
setSource
(
source
).
setRefreshPolicy
(
WriteRequest
.
RefreshPolicy
.
IMMEDIATE
).
get
();
logger
.
debug
(
"save service name register info, application getId: {}, service name: {}, status: {}"
,
serviceName
.
getId
(),
serviceName
.
getServiceName
(),
response
.
status
().
name
());
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java
浏览文件 @
ccd4c8ef
...
...
@@ -27,108 +27,60 @@ import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedExcepti
import
org.apache.skywalking.apm.collector.storage.StorageException
;
import
org.apache.skywalking.apm.collector.storage.StorageModule
;
import
org.apache.skywalking.apm.collector.storage.base.dao.IBatchDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IGlobalTracePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IGlobalTraceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceHeartBeatPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentCostPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentCostUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ISegmentUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IServiceNameCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cache.IServiceNameCacheDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.BatchH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2StorageInstaller
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationAlarmH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationAlarmListH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2MinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2CacheDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.ApplicationRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2MinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMinuteMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceAlarmH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceAlarmListH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMetricH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMinuteMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.CpuMetricH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.CpuSecondMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.GCMetricH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.GCSecondMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.GlobalTraceH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.GlobalTraceH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceAlarmH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceAlarmListH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceH2CacheDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.InstanceRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceHeartBeatH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMappingH2MinutePersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMetricH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMinuteMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceReferenceAlarmH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceReferenceAlarmListH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.InstanceReferenceMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.MemoryMetricH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.MemoryPoolMetricH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.MemoryPoolSecondMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.MemorySecondMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.NetworkAddressH2CacheDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.NetworkAddressRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.SegmentCostH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.SegmentCostH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.SegmentH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.SegmentH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceAlarmH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceAlarmListH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceMinuteMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceNameH2CacheDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.ServiceNameRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceAlarmH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceAlarmListH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceH2UIDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuDayMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuHourMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuMinuteMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuMonthMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuSecondMetricH2PersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.ApplicationRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.InstanceRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.NetworkAddressRegisterH2DAO
;
import
org.apache.skywalking.apm.collector.storage.h2.dao.register.ServiceNameRegisterH2DAO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -201,7 +153,12 @@ public class StorageModuleH2Provider extends ModuleProvider {
}
private
void
registerPersistenceDAO
()
throws
ServiceNotProvidedException
{
// this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricH2PersistenceDAO(h2Client));
this
.
registerServiceImplementation
(
ICpuSecondMetricPersistenceDAO
.
class
,
new
CpuSecondMetricH2PersistenceDAO
(
h2Client
));
this
.
registerServiceImplementation
(
ICpuMinuteMetricPersistenceDAO
.
class
,
new
CpuMinuteMetricH2PersistenceDAO
(
h2Client
));
this
.
registerServiceImplementation
(
ICpuHourMetricPersistenceDAO
.
class
,
new
CpuHourMetricH2PersistenceDAO
(
h2Client
));
this
.
registerServiceImplementation
(
ICpuDayMetricPersistenceDAO
.
class
,
new
CpuDayMetricH2PersistenceDAO
(
h2Client
));
this
.
registerServiceImplementation
(
ICpuMonthMetricPersistenceDAO
.
class
,
new
CpuMonthMetricH2PersistenceDAO
(
h2Client
));
// this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client));
// this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client));
// this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client));
...
...
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/
dao/InstanceH2Register
DAO.java
→
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/
base/dao/AbstractPersistenceH2
DAO.java
浏览文件 @
ccd4c8ef
...
...
@@ -16,72 +16,80 @@
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao
;
package
org.apache.skywalking.apm.collector.storage.h2.
base.
dao
;
import
java.util.HashMap
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.client.h2.H2ClientException
;
import
org.apache.skywalking.apm.collector.core.data.CommonTable
;
import
org.apache.skywalking.apm.collector.core.data.StreamData
;
import
org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.Instance
;
import
org.apache.skywalking.apm.collector.storage.table.register.InstanceTable
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
, clevertension
* @author peng-yongsheng
*/
public
class
InstanceH2RegisterDAO
extends
H2DAO
implements
IInstanceRegisterDAO
{
public
abstract
class
AbstractPersistenceH2DAO
<
STREAM_DATA
extends
StreamData
>
extends
H2DAO
implements
IPersistenceDAO
<
H2SqlEntity
,
H2SqlEntity
,
STREAM_DATA
>
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
InstanceH2Register
DAO
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AbstractPersistenceH2
DAO
.
class
);
public
InstanceH2Register
DAO
(
H2Client
client
)
{
public
AbstractPersistenceH2
DAO
(
H2Client
client
)
{
super
(
client
);
}
private
static
final
String
UPDATE_HEARTBEAT_TIME_SQL
=
"update {0} set {1} = ? where {2
} = ?"
;
private
static
final
String
GET_SQL
=
"select * from {0} where {1
} = ?"
;
@Override
public
int
getMaxInstanceId
()
{
return
getMaxId
(
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_INSTANCE_ID
);
}
protected
abstract
STREAM_DATA
h2DataToStreamData
(
ResultSet
resultSet
)
throws
SQLException
;
@Override
public
int
getMinInstanceId
()
{
return
getMinId
(
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_INSTANCE_ID
);
}
protected
abstract
String
tableName
();
@Override
public
void
save
(
Instance
instance
)
{
H2Client
client
=
getClient
();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
InstanceTable
.
COLUMN_ID
,
instance
.
getId
());
source
.
put
(
InstanceTable
.
COLUMN_INSTANCE_ID
,
instance
.
getInstanceId
());
source
.
put
(
InstanceTable
.
COLUMN_APPLICATION_ID
,
instance
.
getApplicationId
());
source
.
put
(
InstanceTable
.
COLUMN_AGENT_UUID
,
instance
.
getAgentUUID
());
source
.
put
(
InstanceTable
.
COLUMN_REGISTER_TIME
,
instance
.
getRegisterTime
());
source
.
put
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
instance
.
getHeartBeatTime
());
source
.
put
(
InstanceTable
.
COLUMN_OS_INFO
,
instance
.
getOsInfo
());
source
.
put
(
InstanceTable
.
COLUMN_ADDRESS_ID
,
instance
.
getAddressId
());
source
.
put
(
InstanceTable
.
COLUMN_IS_ADDRESS
,
instance
.
getIsAddress
());
String
sql
=
SqlBuilder
.
buildBatchInsertSql
(
InstanceTable
.
TABLE
,
source
.
keySet
());
Object
[]
params
=
source
.
values
().
toArray
(
new
Object
[
0
]);
try
{
client
.
execute
(
sql
,
params
);
}
catch
(
H2ClientException
e
)
{
@Override
public
final
STREAM_DATA
get
(
String
id
)
{
String
sql
=
SqlBuilder
.
buildSql
(
GET_SQL
,
tableName
(),
CommonTable
.
COLUMN_ID
);
Object
[]
params
=
new
Object
[]
{
id
};
try
(
ResultSet
resultSet
=
getClient
().
executeQuery
(
sql
,
params
))
{
if
(
resultSet
.
next
())
{
return
h2DataToStreamData
(
resultSet
);
}
}
catch
(
SQLException
|
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
@Override
public
void
updateHeartbeatTime
(
int
instanceId
,
long
heartbeatTime
)
{
H2Client
client
=
getClient
();
String
sql
=
SqlBuilder
.
buildSql
(
UPDATE_HEARTBEAT_TIME_SQL
,
InstanceTable
.
TABLE
,
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
InstanceTable
.
COLUMN_ID
);
Object
[]
params
=
new
Object
[]
{
heartbeatTime
,
instanceId
};
try
{
client
.
execute
(
sql
,
params
);
}
catch
(
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
protected
abstract
Map
<
String
,
Object
>
streamDataToH2Data
(
STREAM_DATA
streamData
);
@Override
public
final
H2SqlEntity
prepareBatchInsert
(
STREAM_DATA
streamData
)
{
Map
<
String
,
Object
>
source
=
streamDataToH2Data
(
streamData
);
source
.
put
(
CommonTable
.
COLUMN_ID
,
streamData
.
getId
());
H2SqlEntity
entity
=
new
H2SqlEntity
();
String
sql
=
SqlBuilder
.
buildBatchInsertSql
(
tableName
(),
source
.
keySet
());
entity
.
setSql
(
sql
);
entity
.
setParams
(
source
.
values
().
toArray
(
new
Object
[
0
]));
return
entity
;
}
@Override
public
final
H2SqlEntity
prepareBatchUpdate
(
STREAM_DATA
streamData
)
{
Map
<
String
,
Object
>
source
=
streamDataToH2Data
(
streamData
);
H2SqlEntity
entity
=
new
H2SqlEntity
();
String
sql
=
SqlBuilder
.
buildBatchUpdateSql
(
tableName
(),
source
.
keySet
(),
CommonTable
.
COLUMN_ID
);
entity
.
setSql
(
sql
);
List
<
Object
>
values
=
new
ArrayList
<>(
source
.
values
());
values
.
add
(
streamData
.
getId
());
entity
.
setParams
(
values
.
toArray
(
new
Object
[
0
]));
return
entity
;
}
@Override
public
final
void
deleteHistory
(
Long
startTimestamp
,
Long
endTimestamp
)
{
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java
已删除
100644 → 0
浏览文件 @
d42eb019
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.ServiceNameTable
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.client.h2.H2ClientException
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.ServiceName
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng, clevertension
*/
public
class
ServiceNameH2RegisterDAO
extends
H2DAO
implements
IServiceNameRegisterDAO
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceNameH2RegisterDAO
.
class
);
public
ServiceNameH2RegisterDAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
public
int
getMaxServiceId
()
{
return
getMaxId
(
ServiceNameTable
.
TABLE
,
ServiceNameTable
.
COLUMN_SERVICE_ID
);
}
@Override
public
int
getMinServiceId
()
{
return
getMinId
(
ServiceNameTable
.
TABLE
,
ServiceNameTable
.
COLUMN_SERVICE_ID
);
}
@Override
public
void
save
(
ServiceName
serviceName
)
{
logger
.
debug
(
"save service name register info, application getId: {}, service name: {}"
,
serviceName
.
getId
(),
serviceName
.
getServiceName
());
H2Client
client
=
getClient
();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
ServiceNameTable
.
COLUMN_ID
,
serviceName
.
getId
());
source
.
put
(
ServiceNameTable
.
COLUMN_SERVICE_ID
,
serviceName
.
getServiceId
());
source
.
put
(
ServiceNameTable
.
COLUMN_APPLICATION_ID
,
serviceName
.
getApplicationId
());
source
.
put
(
ServiceNameTable
.
COLUMN_SERVICE_NAME
,
serviceName
.
getServiceName
());
String
sql
=
SqlBuilder
.
buildBatchInsertSql
(
ServiceNameTable
.
TABLE
,
source
.
keySet
());
Object
[]
params
=
source
.
values
().
toArray
(
new
Object
[
0
]);
try
{
client
.
execute
(
sql
,
params
);
}
catch
(
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/
NetworkAddressRegisterH2
DAO.java
→
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/
cpump/AbstractCpuMetricH2Persistence
DAO.java
浏览文件 @
ccd4c8ef
...
...
@@ -16,56 +16,49 @@
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao
;
package
org.apache.skywalking.apm.collector.storage.h2.dao
.cpump
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.client.h2.H2ClientException
;
import
org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder
;
import
org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.NetworkAddress
;
import
org.apache.skywalking.apm.collector.storage.table.register.NetworkAddressTable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
, clevertension
* @author peng-yongsheng
*/
public
class
NetworkAddressRegisterH2DAO
extends
H2DAO
implements
INetworkAddressRegisterDAO
{
public
abstract
class
AbstractCpuMetricH2PersistenceDAO
extends
AbstractPersistenceH2DAO
<
CpuMetric
>
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
NetworkAddressRegisterH2DAO
.
class
);
public
NetworkAddressRegisterH2DAO
(
H2Client
client
)
{
public
AbstractCpuMetricH2PersistenceDAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
public
int
getMaxNetworkAddressId
()
{
return
getMaxId
(
NetworkAddressTable
.
TABLE
,
NetworkAddressTable
.
COLUMN_ADDRESS_ID
);
}
@Override
protected
final
CpuMetric
h2DataToStreamData
(
ResultSet
resultSet
)
throws
SQLException
{
CpuMetric
cpuMetric
=
new
CpuMetric
();
cpuMetric
.
setId
(
resultSet
.
getString
(
CpuMetricTable
.
COLUMN_ID
)
);
cpuMetric
.
setMetricId
(
resultSet
.
getString
(
CpuMetricTable
.
COLUMN_METRIC_ID
));
@Override
public
int
getMinNetworkAddressId
()
{
return
getMinId
(
NetworkAddressTable
.
TABLE
,
NetworkAddressTable
.
COLUMN_ADDRESS_ID
);
}
cpuMetric
.
setInstanceId
(
resultSet
.
getInt
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
));
@Override
public
void
save
(
NetworkAddress
networkAddress
)
{
H2Client
client
=
getClient
(
);
cpuMetric
.
setUsagePercent
(
resultSet
.
getDouble
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
));
cpuMetric
.
setTimes
(
resultSet
.
getLong
(
CpuMetricTable
.
COLUMN_TIMES
));
cpuMetric
.
setTimeBucket
(
resultSet
.
getLong
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
)
);
return
cpuMetric
;
}
@Override
protected
final
Map
<
String
,
Object
>
streamDataToH2Data
(
CpuMetric
streamData
)
{
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
NetworkAddressTable
.
COLUMN_ID
,
networkAddress
.
getId
());
source
.
put
(
NetworkAddressTable
.
COLUMN_NETWORK_ADDRESS
,
networkAddress
.
getNetworkAddress
());
source
.
put
(
NetworkAddressTable
.
COLUMN_ADDRESS_ID
,
networkAddress
.
getAddressId
());
source
.
put
(
CpuMetricTable
.
COLUMN_METRIC_ID
,
streamData
.
getMetricId
());
source
.
put
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
,
streamData
.
getInstanceId
());
source
.
put
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
,
streamData
.
getUsagePercent
());
source
.
put
(
CpuMetricTable
.
COLUMN_TIMES
,
streamData
.
getTimes
());
source
.
put
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
,
streamData
.
getTimeBucket
());
String
sql
=
SqlBuilder
.
buildBatchInsertSql
(
NetworkAddressTable
.
TABLE
,
source
.
keySet
());
Object
[]
params
=
source
.
values
().
toArray
(
new
Object
[
0
]);
try
{
client
.
execute
(
sql
,
params
);
}
catch
(
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
source
;
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/d
efine/InstanceH2TableDefine
.java
→
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/d
ao/cpump/CpuDayMetricH2PersistenceDAO
.java
浏览文件 @
ccd4c8ef
...
...
@@ -16,30 +16,26 @@
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.d
efine
;
package
org.apache.skywalking.apm.collector.storage.h2.d
ao.cpump
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine
;
import
org.apache.skywalking.apm.collector.storage.table.register.InstanceTable
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuDayMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
InstanceH2TableDefine
extends
H2TableDefine
{
public
class
CpuDayMetricH2PersistenceDAO
extends
AbstractCpuMetricH2PersistenceDAO
implements
ICpuDayMetricPersistenceDAO
<
H2SqlEntity
,
H2SqlEntity
,
CpuMetric
>
{
public
InstanceH2TableDefine
(
)
{
super
(
InstanceTable
.
TABLE
);
public
CpuDayMetricH2PersistenceDAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
public
void
initialize
()
{
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_APPLICATION_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_AGENT_UUID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_REGISTER_TIME
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_HEARTBEAT_TIME
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_OS_INFO
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_ADDRESS_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
InstanceTable
.
COLUMN_IS_ADDRESS
,
H2ColumnDefine
.
Type
.
Boolean
.
name
()));
@Override
protected
String
tableName
()
{
return
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Day
.
getName
();
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/
ApplicationH2Register
DAO.java
→
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/
cpump/CpuHourMetricH2Persistence
DAO.java
浏览文件 @
ccd4c8ef
...
...
@@ -16,57 +16,26 @@
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao
;
package
org.apache.skywalking.apm.collector.storage.h2.dao
.cpump
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.client.h2.H2ClientException
;
import
org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder
;
import
org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO
;
import
org.apache.skywalking.apm.collector.storage.table.register.Application
;
import
org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
, clevertension
* @author peng-yongsheng
*/
public
class
ApplicationH2RegisterDAO
extends
H2DAO
implements
IApplicationRegisterDAO
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationH2RegisterDAO
.
class
);
public
class
CpuHourMetricH2PersistenceDAO
extends
AbstractCpuMetricH2PersistenceDAO
implements
ICpuHourMetricPersistenceDAO
<
H2SqlEntity
,
H2SqlEntity
,
CpuMetric
>
{
public
ApplicationH2Register
DAO
(
H2Client
client
)
{
public
CpuHourMetricH2Persistence
DAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
public
int
getMaxApplicationId
()
{
return
getMaxId
(
ApplicationTable
.
TABLE
,
ApplicationTable
.
COLUMN_APPLICATION_ID
);
}
@Override
public
int
getMinApplicationId
()
{
return
getMinId
(
ApplicationTable
.
TABLE
,
ApplicationTable
.
COLUMN_APPLICATION_ID
);
}
@Override
public
void
save
(
Application
application
)
{
H2Client
client
=
getClient
();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
ApplicationTable
.
COLUMN_ID
,
application
.
getId
());
source
.
put
(
ApplicationTable
.
COLUMN_APPLICATION_CODE
,
application
.
getApplicationCode
());
source
.
put
(
ApplicationTable
.
COLUMN_APPLICATION_ID
,
application
.
getApplicationId
());
source
.
put
(
ApplicationTable
.
COLUMN_ADDRESS_ID
,
application
.
getAddressId
());
source
.
put
(
ApplicationTable
.
COLUMN_IS_ADDRESS
,
application
.
getIsAddress
());
String
sql
=
SqlBuilder
.
buildBatchInsertSql
(
ApplicationTable
.
TABLE
,
source
.
keySet
());
Object
[]
params
=
source
.
values
().
toArray
(
new
Object
[
0
]);
try
{
client
.
execute
(
sql
,
params
);
}
catch
(
H2ClientException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
@Override
protected
String
tableName
()
{
return
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Hour
.
getName
();
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao.cpump
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuMinuteMetricH2PersistenceDAO
extends
AbstractCpuMetricH2PersistenceDAO
implements
ICpuMinuteMetricPersistenceDAO
<
H2SqlEntity
,
H2SqlEntity
,
CpuMetric
>
{
public
CpuMinuteMetricH2PersistenceDAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
protected
String
tableName
()
{
return
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Minute
.
getName
();
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao.cpump
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuMonthMetricH2PersistenceDAO
extends
AbstractCpuMetricH2PersistenceDAO
implements
ICpuMonthMetricPersistenceDAO
<
H2SqlEntity
,
H2SqlEntity
,
CpuMetric
>
{
public
CpuMonthMetricH2PersistenceDAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
protected
String
tableName
()
{
return
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Month
.
getName
();
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.dao.cpump
;
import
org.apache.skywalking.apm.collector.client.h2.H2Client
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuSecondMetricH2PersistenceDAO
extends
AbstractCpuMetricH2PersistenceDAO
implements
ICpuSecondMetricPersistenceDAO
<
H2SqlEntity
,
H2SqlEntity
,
CpuMetric
>
{
public
CpuSecondMetricH2PersistenceDAO
(
H2Client
client
)
{
super
(
client
);
}
@Override
protected
String
tableName
()
{
return
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Second
.
getName
();
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/
Application
H2TableDefine.java
→
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/
cpu/AbstractCpuMetric
H2TableDefine.java
浏览文件 @
ccd4c8ef
...
...
@@ -16,26 +16,27 @@
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.define
;
package
org.apache.skywalking.apm.collector.storage.h2.define
.cpu
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine
;
import
org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine
;
import
org.apache.skywalking.apm.collector.storage.table.
register.Application
Table
;
import
org.apache.skywalking.apm.collector.storage.table.
jvm.CpuMetric
Table
;
/**
* @author peng-yongsheng
*/
public
class
Application
H2TableDefine
extends
H2TableDefine
{
public
abstract
class
AbstractCpuMetric
H2TableDefine
extends
H2TableDefine
{
public
ApplicationH2TableDefine
(
)
{
super
(
ApplicationTable
.
TABLE
);
AbstractCpuMetricH2TableDefine
(
String
name
)
{
super
(
name
);
}
@Override
public
void
initialize
()
{
addColumn
(
new
H2ColumnDefine
(
ApplicationTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
ApplicationTable
.
COLUMN_APPLICATION_CODE
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
ApplicationTable
.
COLUMN_APPLICATION_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
ApplicationTable
.
COLUMN_ADDRESS_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
ApplicationTable
.
COLUMN_IS_ADDRESS
,
H2ColumnDefine
.
Type
.
Boolean
.
name
()));
@Override
public
final
void
initialize
()
{
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_METRIC_ID
,
H2ColumnDefine
.
Type
.
Varchar
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_INSTANCE_ID
,
H2ColumnDefine
.
Type
.
Int
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_USAGE_PERCENT
,
H2ColumnDefine
.
Type
.
Double
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_TIMES
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
addColumn
(
new
H2ColumnDefine
(
CpuMetricTable
.
COLUMN_TIME_BUCKET
,
H2ColumnDefine
.
Type
.
Bigint
.
name
()));
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.define.cpu
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuDayMetricH2TableDefine
extends
AbstractCpuMetricH2TableDefine
{
public
CpuDayMetricH2TableDefine
()
{
super
(
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Day
.
getName
());
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.define.cpu
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuHourMetricH2TableDefine
extends
AbstractCpuMetricH2TableDefine
{
public
CpuHourMetricH2TableDefine
()
{
super
(
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Hour
.
getName
());
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.define.cpu
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuMinuteMetricH2TableDefine
extends
AbstractCpuMetricH2TableDefine
{
public
CpuMinuteMetricH2TableDefine
()
{
super
(
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Minute
.
getName
());
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.define.cpu
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuMonthMetricH2TableDefine
extends
AbstractCpuMetricH2TableDefine
{
public
CpuMonthMetricH2TableDefine
()
{
super
(
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Month
.
getName
());
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java
0 → 100644
浏览文件 @
ccd4c8ef
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.collector.storage.h2.define.cpu
;
import
org.apache.skywalking.apm.collector.core.storage.TimePyramid
;
import
org.apache.skywalking.apm.collector.core.util.Const
;
import
org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable
;
/**
* @author peng-yongsheng
*/
public
class
CpuSecondMetricH2TableDefine
extends
AbstractCpuMetricH2TableDefine
{
public
CpuSecondMetricH2TableDefine
()
{
super
(
CpuMetricTable
.
TABLE
+
Const
.
ID_SPLIT
+
TimePyramid
.
Second
.
getName
());
}
}
apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define
浏览文件 @
ccd4c8ef
...
...
@@ -3,3 +3,8 @@ org.apache.skywalking.apm.collector.storage.h2.define.register.ApplicationH2Tabl
org.apache.skywalking.apm.collector.storage.h2.define.register.InstanceH2TableDefine
org.apache.skywalking.apm.collector.storage.h2.define.register.ServiceNameH2TableDefine
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuSecondMetricH2TableDefine
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuMinuteMetricH2TableDefine
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuHourMetricH2TableDefine
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuDayMetricH2TableDefine
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuMonthMetricH2TableDefine
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录