From 4241f6f4b1980a42234ac2bd2cd00d0f69e52ee8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 5 Jan 2018 23:28:19 +0800 Subject: [PATCH 01/18] Fix ServiceNameCacheGuavaService split error --- .../cache/guava/service/ServiceNameCacheGuavaService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-collector/apm-collector-cache/collector-cache-guava-provider/src/main/java/org/apache/skywalking/apm/collector/cache/guava/service/ServiceNameCacheGuavaService.java b/apm-collector/apm-collector-cache/collector-cache-guava-provider/src/main/java/org/apache/skywalking/apm/collector/cache/guava/service/ServiceNameCacheGuavaService.java index 389ac4658..aef733248 100644 --- a/apm-collector/apm-collector-cache/collector-cache-guava-provider/src/main/java/org/apache/skywalking/apm/collector/cache/guava/service/ServiceNameCacheGuavaService.java +++ b/apm-collector/apm-collector-cache/collector-cache-guava-provider/src/main/java/org/apache/skywalking/apm/collector/cache/guava/service/ServiceNameCacheGuavaService.java @@ -74,7 +74,7 @@ public class ServiceNameCacheGuavaService implements ServiceNameCacheService { public String getSplitServiceName(String serviceName) { if (StringUtils.isNotEmpty(serviceName)) { - String[] serviceNames = serviceName.split(Const.ID_SPLIT); + String[] serviceNames = serviceName.split(Const.ID_SPLIT, 2); if (serviceNames.length == 2) { return serviceNames[1]; } else { From 8854921f9e23650e4dcc185eefe16da6136bf6f6 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Thu, 11 Jan 2018 09:48:42 +0800 Subject: [PATCH 02/18] fixes #735 Concurrency conflicts in Spring plugin --- .../mvc/commons/EnhanceRequireObjectCache.java | 18 ++++++++++-------- .../InvokeHandlerMethodInterceptor.java | 9 ++++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java index 914882eed..a17d8eea0 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java @@ -18,25 +18,26 @@ package org.apache.skywalking.apm.plugin.spring.mvc.commons; -import java.lang.reflect.Method; -import javax.servlet.http.HttpServletResponse; import org.springframework.web.context.request.NativeWebRequest; +import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; + public class EnhanceRequireObjectCache { private PathMappingCache pathMappingCache; - private NativeWebRequest nativeWebRequest; - private HttpServletResponse httpResponse; + private ThreadLocal nativeWebRequest = new ThreadLocal(); + private ThreadLocal httpResponse = new ThreadLocal(); public void setPathMappingCache(PathMappingCache pathMappingCache) { this.pathMappingCache = pathMappingCache; } public HttpServletResponse getHttpServletResponse() { - return httpResponse == null ? (HttpServletResponse)nativeWebRequest.getNativeResponse() : httpResponse; + return httpResponse.get() == null ? (HttpServletResponse) nativeWebRequest.get().getNativeResponse() : httpResponse.get(); } public void setNativeWebRequest(NativeWebRequest nativeWebRequest) { - this.nativeWebRequest = nativeWebRequest; + this.nativeWebRequest.set(nativeWebRequest); } public String findPathMapping(Method method) { @@ -52,10 +53,11 @@ public class EnhanceRequireObjectCache { } public void setHttpResponse(HttpServletResponse httpResponse) { - this.httpResponse = httpResponse; + this.httpResponse.set(httpResponse); } public HttpServletResponse getHttpResponse() { - return httpResponse; + return httpResponse.get(); } + } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java index 7a502d21f..061d505d4 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java @@ -18,13 +18,14 @@ package org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor; -import java.lang.reflect.Method; -import javax.servlet.http.HttpServletResponse; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache; +import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; + public class InvokeHandlerMethodInterceptor implements InstanceMethodsAroundInterceptor { @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, @@ -37,11 +38,13 @@ public class InvokeHandlerMethodInterceptor implements InstanceMethodsAroundInte @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { + if (allArguments[2] instanceof EnhancedInstance) { + ((EnhanceRequireObjectCache)((EnhancedInstance)allArguments[2]).getSkyWalkingDynamicField()).setHttpResponse(null); + } return ret; } @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Throwable t) { - } } From d42eb0199b583d0d00f1bad2a63e64cbc0d36c6e Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 10:55:30 +0800 Subject: [PATCH 03/18] Agent register test success by H2 storage. --- .../agent/jetty/provider/SegmentPost.java | 14 +- .../apm/collector/storage/StorageModule.java | 176 +++++++++--------- .../storage/es/StorageModuleEsProvider.java | 12 +- .../register/ApplicationRegisterEsDAO.java | 64 +++++++ .../dao/register/InstanceRegisterEsDAO.java | 84 +++++++++ .../register/ServiceNameRegisterEsDAO.java | 63 +++++++ .../storage/h2/StorageModuleH2Provider.java | 78 ++++---- .../register/ApplicationRegisterH2DAO.java | 73 ++++++++ .../dao/register/InstanceRegisterH2DAO.java | 87 +++++++++ .../register/NetworkAddressRegisterH2DAO.java | 71 +++++++ .../register/ServiceNameRegisterH2DAO.java | 73 ++++++++ .../register/ApplicationH2TableDefine.java | 41 ++++ .../register/InstanceH2TableDefine.java | 45 +++++ .../register/NetworkAddressH2TableDefine.java | 39 ++++ .../register/ServiceNameH2TableDefine.java | 41 ++++ .../resources/META-INF/defines/storage.define | 24 +-- ...g.apm.collector.core.module.ModuleProvider | 3 +- 17 files changed, 827 insertions(+), 161 deletions(-) create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationRegisterEsDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameRegisterEsDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ApplicationRegisterH2DAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/NetworkAddressRegisterH2DAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ServiceNameRegisterH2DAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/NetworkAddressH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ServiceNameH2TableDefine.java diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java index 6f6a108be..dc296cc64 100644 --- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java +++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java @@ -39,12 +39,12 @@ public class SegmentPost { serviceNameRegisterPost.send("json/servicename-register-consumer.json"); serviceNameRegisterPost.send("json/servicename-register-provider.json"); - JsonElement provider = JsonFileReader.INSTANCE.read("json/dubbox-provider.json"); - JsonElement consumer = JsonFileReader.INSTANCE.read("json/dubbox-consumer.json"); - - for (int i = 0; i < 1; i++) { - HttpClientTools.INSTANCE.post("http://localhost:12800/segments", provider.toString()); - HttpClientTools.INSTANCE.post("http://localhost:12800/segments", consumer.toString()); - } +// JsonElement provider = JsonFileReader.INSTANCE.read("json/dubbox-provider.json"); +// JsonElement consumer = JsonFileReader.INSTANCE.read("json/dubbox-consumer.json"); +// +// for (int i = 0; i < 1; i++) { +// HttpClientTools.INSTANCE.post("http://localhost:12800/segments", provider.toString()); +// HttpClientTools.INSTANCE.post("http://localhost:12800/segments", consumer.toString()); +// } } } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 5ad1ae98e..3da2c16ae 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -155,81 +155,81 @@ public class StorageModule extends Module { } private void addPersistenceDAO(List classes) { - 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); - classes.add(IGCHourMetricPersistenceDAO.class); - classes.add(IGCDayMetricPersistenceDAO.class); - classes.add(IGCMonthMetricPersistenceDAO.class); - - classes.add(IMemorySecondMetricPersistenceDAO.class); - classes.add(IMemoryMinuteMetricPersistenceDAO.class); - classes.add(IMemoryHourMetricPersistenceDAO.class); - classes.add(IMemoryDayMetricPersistenceDAO.class); - classes.add(IMemoryMonthMetricPersistenceDAO.class); - - classes.add(IMemoryPoolSecondMetricPersistenceDAO.class); - classes.add(IMemoryPoolMinuteMetricPersistenceDAO.class); - classes.add(IMemoryPoolHourMetricPersistenceDAO.class); - classes.add(IMemoryPoolDayMetricPersistenceDAO.class); - classes.add(IMemoryPoolMonthMetricPersistenceDAO.class); - - classes.add(IApplicationComponentMinutePersistenceDAO.class); - classes.add(IApplicationComponentHourPersistenceDAO.class); - classes.add(IApplicationComponentDayPersistenceDAO.class); - classes.add(IApplicationComponentMonthPersistenceDAO.class); - - classes.add(IApplicationMappingMinutePersistenceDAO.class); - classes.add(IApplicationMappingHourPersistenceDAO.class); - classes.add(IApplicationMappingDayPersistenceDAO.class); - classes.add(IApplicationMappingMonthPersistenceDAO.class); - - classes.add(IInstanceMappingMinutePersistenceDAO.class); - classes.add(IInstanceMappingHourPersistenceDAO.class); - classes.add(IInstanceMappingDayPersistenceDAO.class); - classes.add(IInstanceMappingMonthPersistenceDAO.class); - - classes.add(IGlobalTracePersistenceDAO.class); - - classes.add(IApplicationMinuteMetricPersistenceDAO.class); - classes.add(IApplicationHourMetricPersistenceDAO.class); - classes.add(IApplicationDayMetricPersistenceDAO.class); - classes.add(IApplicationMonthMetricPersistenceDAO.class); - - classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class); - classes.add(IApplicationReferenceHourMetricPersistenceDAO.class); - classes.add(IApplicationReferenceDayMetricPersistenceDAO.class); - classes.add(IApplicationReferenceMonthMetricPersistenceDAO.class); - - classes.add(ISegmentCostPersistenceDAO.class); - classes.add(ISegmentPersistenceDAO.class); - - classes.add(IServiceMinuteMetricPersistenceDAO.class); - classes.add(IServiceHourMetricPersistenceDAO.class); - classes.add(IServiceDayMetricPersistenceDAO.class); - classes.add(IServiceMonthMetricPersistenceDAO.class); - - classes.add(IServiceReferenceMinuteMetricPersistenceDAO.class); - classes.add(IServiceReferenceHourMetricPersistenceDAO.class); - classes.add(IServiceReferenceDayMetricPersistenceDAO.class); - classes.add(IServiceReferenceMonthMetricPersistenceDAO.class); - - classes.add(IInstanceMinuteMetricPersistenceDAO.class); - classes.add(IInstanceHourMetricPersistenceDAO.class); - classes.add(IInstanceDayMetricPersistenceDAO.class); - classes.add(IInstanceMonthMetricPersistenceDAO.class); - - classes.add(IInstanceReferenceMinuteMetricPersistenceDAO.class); - classes.add(IInstanceReferenceHourMetricPersistenceDAO.class); - classes.add(IInstanceReferenceDayMetricPersistenceDAO.class); - classes.add(IInstanceReferenceMonthMetricPersistenceDAO.class); - - classes.add(IInstanceHeartBeatPersistenceDAO.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); +// classes.add(IGCHourMetricPersistenceDAO.class); +// classes.add(IGCDayMetricPersistenceDAO.class); +// classes.add(IGCMonthMetricPersistenceDAO.class); +// +// classes.add(IMemorySecondMetricPersistenceDAO.class); +// classes.add(IMemoryMinuteMetricPersistenceDAO.class); +// classes.add(IMemoryHourMetricPersistenceDAO.class); +// classes.add(IMemoryDayMetricPersistenceDAO.class); +// classes.add(IMemoryMonthMetricPersistenceDAO.class); +// +// classes.add(IMemoryPoolSecondMetricPersistenceDAO.class); +// classes.add(IMemoryPoolMinuteMetricPersistenceDAO.class); +// classes.add(IMemoryPoolHourMetricPersistenceDAO.class); +// classes.add(IMemoryPoolDayMetricPersistenceDAO.class); +// classes.add(IMemoryPoolMonthMetricPersistenceDAO.class); +// +// classes.add(IApplicationComponentMinutePersistenceDAO.class); +// classes.add(IApplicationComponentHourPersistenceDAO.class); +// classes.add(IApplicationComponentDayPersistenceDAO.class); +// classes.add(IApplicationComponentMonthPersistenceDAO.class); +// +// classes.add(IApplicationMappingMinutePersistenceDAO.class); +// classes.add(IApplicationMappingHourPersistenceDAO.class); +// classes.add(IApplicationMappingDayPersistenceDAO.class); +// classes.add(IApplicationMappingMonthPersistenceDAO.class); +// +// classes.add(IInstanceMappingMinutePersistenceDAO.class); +// classes.add(IInstanceMappingHourPersistenceDAO.class); +// classes.add(IInstanceMappingDayPersistenceDAO.class); +// classes.add(IInstanceMappingMonthPersistenceDAO.class); +// +// classes.add(IGlobalTracePersistenceDAO.class); +// +// classes.add(IApplicationMinuteMetricPersistenceDAO.class); +// classes.add(IApplicationHourMetricPersistenceDAO.class); +// classes.add(IApplicationDayMetricPersistenceDAO.class); +// classes.add(IApplicationMonthMetricPersistenceDAO.class); +// +// classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class); +// classes.add(IApplicationReferenceHourMetricPersistenceDAO.class); +// classes.add(IApplicationReferenceDayMetricPersistenceDAO.class); +// classes.add(IApplicationReferenceMonthMetricPersistenceDAO.class); +// +// classes.add(ISegmentCostPersistenceDAO.class); +// classes.add(ISegmentPersistenceDAO.class); +// +// classes.add(IServiceMinuteMetricPersistenceDAO.class); +// classes.add(IServiceHourMetricPersistenceDAO.class); +// classes.add(IServiceDayMetricPersistenceDAO.class); +// classes.add(IServiceMonthMetricPersistenceDAO.class); +// +// classes.add(IServiceReferenceMinuteMetricPersistenceDAO.class); +// classes.add(IServiceReferenceHourMetricPersistenceDAO.class); +// classes.add(IServiceReferenceDayMetricPersistenceDAO.class); +// classes.add(IServiceReferenceMonthMetricPersistenceDAO.class); +// +// classes.add(IInstanceMinuteMetricPersistenceDAO.class); +// classes.add(IInstanceHourMetricPersistenceDAO.class); +// classes.add(IInstanceDayMetricPersistenceDAO.class); +// classes.add(IInstanceMonthMetricPersistenceDAO.class); +// +// classes.add(IInstanceReferenceMinuteMetricPersistenceDAO.class); +// classes.add(IInstanceReferenceHourMetricPersistenceDAO.class); +// classes.add(IInstanceReferenceDayMetricPersistenceDAO.class); +// classes.add(IInstanceReferenceMonthMetricPersistenceDAO.class); +// +// classes.add(IInstanceHeartBeatPersistenceDAO.class); } private void addUiDAO(List classes) { @@ -251,18 +251,18 @@ public class StorageModule extends Module { } private void addAlarmDAO(List classes) { - classes.add(IServiceReferenceAlarmPersistenceDAO.class); - classes.add(IServiceReferenceAlarmListPersistenceDAO.class); - classes.add(IInstanceReferenceAlarmPersistenceDAO.class); - classes.add(IInstanceReferenceAlarmListPersistenceDAO.class); - classes.add(IApplicationReferenceAlarmPersistenceDAO.class); - classes.add(IApplicationReferenceAlarmListPersistenceDAO.class); - - classes.add(IServiceAlarmPersistenceDAO.class); - classes.add(IServiceAlarmListPersistenceDAO.class); - classes.add(IInstanceAlarmPersistenceDAO.class); - classes.add(IInstanceAlarmListPersistenceDAO.class); - classes.add(IApplicationAlarmPersistenceDAO.class); - classes.add(IApplicationAlarmListPersistenceDAO.class); +// classes.add(IServiceReferenceAlarmPersistenceDAO.class); +// classes.add(IServiceReferenceAlarmListPersistenceDAO.class); +// classes.add(IInstanceReferenceAlarmPersistenceDAO.class); +// classes.add(IInstanceReferenceAlarmListPersistenceDAO.class); +// classes.add(IApplicationReferenceAlarmPersistenceDAO.class); +// classes.add(IApplicationReferenceAlarmListPersistenceDAO.class); +// +// classes.add(IServiceAlarmPersistenceDAO.class); +// classes.add(IServiceAlarmListPersistenceDAO.class); +// classes.add(IInstanceAlarmPersistenceDAO.class); +// classes.add(IInstanceAlarmListPersistenceDAO.class); +// classes.add(IApplicationAlarmPersistenceDAO.class); +// classes.add(IApplicationAlarmListPersistenceDAO.class); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java index 4ada2c763..ffe10f056 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java @@ -207,10 +207,10 @@ import org.apache.skywalking.apm.collector.storage.es.dao.mpoolmp.MemoryPoolHour import org.apache.skywalking.apm.collector.storage.es.dao.mpoolmp.MemoryPoolMinuteMetricEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.mpoolmp.MemoryPoolMonthMetricEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.mpoolmp.MemoryPoolSecondMetricEsPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.es.dao.register.ApplicationEsRegisterDAO; -import org.apache.skywalking.apm.collector.storage.es.dao.register.InstanceEsRegisterDAO; +import org.apache.skywalking.apm.collector.storage.es.dao.register.ApplicationRegisterEsDAO; +import org.apache.skywalking.apm.collector.storage.es.dao.register.InstanceRegisterEsDAO; import org.apache.skywalking.apm.collector.storage.es.dao.register.NetworkAddressRegisterEsDAO; -import org.apache.skywalking.apm.collector.storage.es.dao.register.ServiceNameEsRegisterDAO; +import org.apache.skywalking.apm.collector.storage.es.dao.register.ServiceNameRegisterEsDAO; import org.apache.skywalking.apm.collector.storage.es.dao.smp.ServiceDayMetricEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.smp.ServiceHourMetricEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.smp.ServiceMinuteMetricEsPersistenceDAO; @@ -303,9 +303,9 @@ public class StorageModuleEsProvider extends ModuleProvider { private void registerRegisterDAO() throws ServiceNotProvidedException { this.registerServiceImplementation(INetworkAddressRegisterDAO.class, new NetworkAddressRegisterEsDAO(elasticSearchClient)); - this.registerServiceImplementation(IApplicationRegisterDAO.class, new ApplicationEsRegisterDAO(elasticSearchClient)); - this.registerServiceImplementation(IInstanceRegisterDAO.class, new InstanceEsRegisterDAO(elasticSearchClient)); - this.registerServiceImplementation(IServiceNameRegisterDAO.class, new ServiceNameEsRegisterDAO(elasticSearchClient)); + this.registerServiceImplementation(IApplicationRegisterDAO.class, new ApplicationRegisterEsDAO(elasticSearchClient)); + this.registerServiceImplementation(IInstanceRegisterDAO.class, new InstanceRegisterEsDAO(elasticSearchClient)); + this.registerServiceImplementation(IServiceNameRegisterDAO.class, new ServiceNameRegisterEsDAO(elasticSearchClient)); } private void registerPersistenceDAO() throws ServiceNotProvidedException { diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationRegisterEsDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationRegisterEsDAO.java new file mode 100644 index 000000000..9c3b80dad --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationRegisterEsDAO.java @@ -0,0 +1,64 @@ +/* + * 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 ApplicationRegisterEsDAO extends EsDAO implements IApplicationRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterEsDAO.class); + + public ApplicationRegisterEsDAO(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 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java new file mode 100644 index 000000000..c9b54be66 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java @@ -0,0 +1,84 @@ +/* + * 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 InstanceRegisterEsDAO extends EsDAO implements IInstanceRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(InstanceRegisterEsDAO.class); + + public InstanceRegisterEsDAO(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 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(InstanceTable.TABLE_TYPE); + updateRequest.id(String.valueOf(instanceId)); + updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); + + Map source = new HashMap<>(); + source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, heartbeatTime); + + updateRequest.doc(source); + client.update(updateRequest); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameRegisterEsDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameRegisterEsDAO.java new file mode 100644 index 000000000..6be55e0a3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameRegisterEsDAO.java @@ -0,0 +1,63 @@ +/* + * 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 ServiceNameRegisterEsDAO extends EsDAO implements IServiceNameRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(ServiceNameRegisterEsDAO.class); + + public ServiceNameRegisterEsDAO(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 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 640071dbf..4dd7d1c07 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -84,7 +84,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationAlarmListH2 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.ApplicationH2RegisterDAO; +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; @@ -101,7 +101,7 @@ 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.InstanceH2RegisterDAO; +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; @@ -115,7 +115,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.MemoryPoolMetricH2UIDA 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.NetworkAddressRegisterH2DAO; +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; @@ -124,7 +124,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceAlarmH2Persiste 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.ServiceNameH2RegisterDAO; +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; @@ -195,31 +195,31 @@ public class StorageModuleH2Provider extends ModuleProvider { private void registerRegisterDAO() throws ServiceNotProvidedException { this.registerServiceImplementation(INetworkAddressRegisterDAO.class, new NetworkAddressRegisterH2DAO(h2Client)); - this.registerServiceImplementation(IApplicationRegisterDAO.class, new ApplicationH2RegisterDAO(h2Client)); - this.registerServiceImplementation(IInstanceRegisterDAO.class, new InstanceH2RegisterDAO(h2Client)); - this.registerServiceImplementation(IServiceNameRegisterDAO.class, new ServiceNameH2RegisterDAO(h2Client)); + this.registerServiceImplementation(IApplicationRegisterDAO.class, new ApplicationRegisterH2DAO(h2Client)); + this.registerServiceImplementation(IInstanceRegisterDAO.class, new InstanceRegisterH2DAO(h2Client)); + this.registerServiceImplementation(IServiceNameRegisterDAO.class, new ServiceNameRegisterH2DAO(h2Client)); } private void registerPersistenceDAO() throws ServiceNotProvidedException { - this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); - - this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentH2MinutePersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingH2MinutePersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IServiceMinuteMetricPersistenceDAO.class, new ServiceMinuteMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IServiceReferenceMinuteMetricPersistenceDAO.class, new ServiceReferenceMetricH2PersistenceDAO(h2Client)); - - this.registerServiceImplementation(IInstanceMinuteMetricPersistenceDAO.class, new InstanceMinuteMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceReferenceMinuteMetricPersistenceDAO.class, new InstanceReferenceMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceMappingMinutePersistenceDAO.class, new InstanceMappingH2MinutePersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceHeartBeatPersistenceDAO.class, new InstanceHeartBeatH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); +// +// this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentH2MinutePersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingH2MinutePersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IServiceMinuteMetricPersistenceDAO.class, new ServiceMinuteMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IServiceReferenceMinuteMetricPersistenceDAO.class, new ServiceReferenceMetricH2PersistenceDAO(h2Client)); +// +// this.registerServiceImplementation(IInstanceMinuteMetricPersistenceDAO.class, new InstanceMinuteMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceReferenceMinuteMetricPersistenceDAO.class, new InstanceReferenceMetricH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceMappingMinutePersistenceDAO.class, new InstanceMappingH2MinutePersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceHeartBeatPersistenceDAO.class, new InstanceHeartBeatH2PersistenceDAO(h2Client)); } private void registerUiDAO() throws ServiceNotProvidedException { @@ -241,18 +241,18 @@ public class StorageModuleH2Provider extends ModuleProvider { } private void registerAlarmDAO() throws ServiceNotProvidedException { - this.registerServiceImplementation(IServiceReferenceAlarmPersistenceDAO.class, new ServiceReferenceAlarmH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IServiceReferenceAlarmListPersistenceDAO.class, new ServiceReferenceAlarmListH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceReferenceAlarmPersistenceDAO.class, new InstanceReferenceAlarmH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceReferenceAlarmListPersistenceDAO.class, new InstanceReferenceAlarmListH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationReferenceAlarmPersistenceDAO.class, new ApplicationReferenceAlarmH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationReferenceAlarmListPersistenceDAO.class, new ApplicationReferenceAlarmListH2PersistenceDAO(h2Client)); - - this.registerServiceImplementation(IServiceAlarmPersistenceDAO.class, new ServiceAlarmH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IServiceAlarmListPersistenceDAO.class, new ServiceAlarmListH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceAlarmPersistenceDAO.class, new InstanceAlarmH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IInstanceAlarmListPersistenceDAO.class, new InstanceAlarmListH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationAlarmPersistenceDAO.class, new ApplicationAlarmH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationAlarmListPersistenceDAO.class, new ApplicationAlarmListH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IServiceReferenceAlarmPersistenceDAO.class, new ServiceReferenceAlarmH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IServiceReferenceAlarmListPersistenceDAO.class, new ServiceReferenceAlarmListH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceReferenceAlarmPersistenceDAO.class, new InstanceReferenceAlarmH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceReferenceAlarmListPersistenceDAO.class, new InstanceReferenceAlarmListH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationReferenceAlarmPersistenceDAO.class, new ApplicationReferenceAlarmH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationReferenceAlarmListPersistenceDAO.class, new ApplicationReferenceAlarmListH2PersistenceDAO(h2Client)); +// +// this.registerServiceImplementation(IServiceAlarmPersistenceDAO.class, new ServiceAlarmH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IServiceAlarmListPersistenceDAO.class, new ServiceAlarmListH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceAlarmPersistenceDAO.class, new InstanceAlarmH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IInstanceAlarmListPersistenceDAO.class, new InstanceAlarmListH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationAlarmPersistenceDAO.class, new ApplicationAlarmH2PersistenceDAO(h2Client)); +// this.registerServiceImplementation(IApplicationAlarmListPersistenceDAO.class, new ApplicationAlarmListH2PersistenceDAO(h2Client)); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ApplicationRegisterH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ApplicationRegisterH2DAO.java new file mode 100644 index 000000000..d1f3b54a9 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ApplicationRegisterH2DAO.java @@ -0,0 +1,73 @@ +/* + * 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.register; + +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; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationRegisterH2DAO extends H2DAO implements IApplicationRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterH2DAO.class); + + public ApplicationRegisterH2DAO(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 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); + } + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java new file mode 100644 index 000000000..45edf55a0 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java @@ -0,0 +1,87 @@ +/* + * 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.register; + +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.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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng, clevertension + */ +public class InstanceRegisterH2DAO extends H2DAO implements IInstanceRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(InstanceRegisterH2DAO.class); + + public InstanceRegisterH2DAO(H2Client client) { + super(client); + } + + private static final String UPDATE_HEARTBEAT_TIME_SQL = "update {0} set {1} = ? where {2} = ?"; + + @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) { + H2Client client = getClient(); + Map 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) { + logger.error(e.getMessage(), e); + } + } + + @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); + } + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/NetworkAddressRegisterH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/NetworkAddressRegisterH2DAO.java new file mode 100644 index 000000000..9ff6d0c8a --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/NetworkAddressRegisterH2DAO.java @@ -0,0 +1,71 @@ +/* + * 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.register; + +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; + +/** + * @author peng-yongsheng, clevertension + */ +public class NetworkAddressRegisterH2DAO extends H2DAO implements INetworkAddressRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterH2DAO.class); + + public NetworkAddressRegisterH2DAO(H2Client client) { + super(client); + } + + @Override + public int getMaxNetworkAddressId() { + return getMaxId(NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID); + } + + @Override + public int getMinNetworkAddressId() { + return getMinId(NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID); + } + + @Override + public void save(NetworkAddress networkAddress) { + H2Client client = getClient(); + + Map 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()); + + 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); + } + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ServiceNameRegisterH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ServiceNameRegisterH2DAO.java new file mode 100644 index 000000000..d2cb5b7ec --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/ServiceNameRegisterH2DAO.java @@ -0,0 +1,73 @@ +/* + * 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.register; + +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 ServiceNameRegisterH2DAO extends H2DAO implements IServiceNameRegisterDAO { + + private final Logger logger = LoggerFactory.getLogger(ServiceNameRegisterH2DAO.class); + + public ServiceNameRegisterH2DAO(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 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); + } + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java new file mode 100644 index 000000000..6936ed032 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java @@ -0,0 +1,41 @@ +/* + * 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.register; + +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.ApplicationTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationH2TableDefine extends H2TableDefine { + + public ApplicationH2TableDefine() { + super(ApplicationTable.TABLE); + } + + @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())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java new file mode 100644 index 000000000..38a49db3c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java @@ -0,0 +1,45 @@ +/* + * 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.register; + +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; + +/** + * @author peng-yongsheng + */ +public class InstanceH2TableDefine extends H2TableDefine { + + public InstanceH2TableDefine() { + super(InstanceTable.TABLE); + } + + @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())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/NetworkAddressH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/NetworkAddressH2TableDefine.java new file mode 100644 index 000000000..d90c13cb3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/NetworkAddressH2TableDefine.java @@ -0,0 +1,39 @@ +/* + * 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.register; + +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.NetworkAddressTable; + +/** + * @author peng-yongsheng + */ +public class NetworkAddressH2TableDefine extends H2TableDefine { + + public NetworkAddressH2TableDefine() { + super(NetworkAddressTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(NetworkAddressTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(NetworkAddressTable.COLUMN_NETWORK_ADDRESS, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(NetworkAddressTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ServiceNameH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ServiceNameH2TableDefine.java new file mode 100644 index 000000000..6d14e4ecc --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ServiceNameH2TableDefine.java @@ -0,0 +1,41 @@ +/* + * 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.register; + +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.ServiceNameTable; + +/** + * @author peng-yongsheng + */ +public class ServiceNameH2TableDefine extends H2TableDefine { + + public ServiceNameH2TableDefine() { + super(ServiceNameTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index 47bebfaaf..ca59ab12b 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -1,19 +1,5 @@ -org.apache.skywalking.apm.collector.storage.h2.define.NetworkAddressH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ApplicationH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.InstanceH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ServiceNameH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.CpuMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.GCMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.MemoryMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.MemoryPoolMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.GlobalTraceH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.InstanceMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.InstanceReferenceMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ApplicationComponentH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ApplicationMappingH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.InstanceMappingH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ApplicationReferenceMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.SegmentCostH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.SegmentH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ServiceMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.ServiceReferenceMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.register.NetworkAddressH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.register.ApplicationH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.register.InstanceH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.register.ServiceNameH2TableDefine + diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider index 6f47e23bd..09b7f89e3 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider @@ -16,5 +16,4 @@ # # - -org.apache.skywalking.apm.collector.storage.h2.StorageModuleH2Provider +org.apache.skywalking.apm.collector.storage.h2.StorageModuleH2Provider \ No newline at end of file From ccd4c8ef834b627382c562725b060ce1f25125db Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 13:36:06 +0800 Subject: [PATCH 04/18] CPU metric pyramid aggregate by h2 storage test successful. --- .../JVMMetricServiceHandlerTestCase.java | 6 +- .../apm/collector/storage/StorageModule.java | 77 +-------------- .../storage/base/sql/SqlBuilder.java | 4 +- .../register/ApplicationEsRegisterDAO.java | 64 ------------- .../dao/register/InstanceEsRegisterDAO.java | 84 ---------------- .../register/ServiceNameEsRegisterDAO.java | 63 ------------ .../storage/h2/StorageModuleH2Provider.java | 89 +++++------------ .../h2/base/dao/AbstractPersistenceH2DAO.java | 95 +++++++++++++++++++ .../h2/dao/ApplicationH2RegisterDAO.java | 72 -------------- .../storage/h2/dao/InstanceH2RegisterDAO.java | 87 ----------------- .../h2/dao/NetworkAddressRegisterH2DAO.java | 71 -------------- .../h2/dao/ServiceNameH2RegisterDAO.java | 73 -------------- .../AbstractCpuMetricH2PersistenceDAO.java | 64 +++++++++++++ .../cpump/CpuDayMetricH2PersistenceDAO.java | 41 ++++++++ .../cpump/CpuHourMetricH2PersistenceDAO.java | 41 ++++++++ .../CpuMinuteMetricH2PersistenceDAO.java | 41 ++++++++ .../cpump/CpuMonthMetricH2PersistenceDAO.java | 41 ++++++++ .../CpuSecondMetricH2PersistenceDAO.java | 41 ++++++++ .../h2/define/InstanceH2TableDefine.java | 45 --------- .../AbstractCpuMetricH2TableDefine.java} | 23 ++--- .../define/cpu/CpuDayMetricH2TableDefine.java | 33 +++++++ .../cpu/CpuHourMetricH2TableDefine.java | 33 +++++++ .../cpu/CpuMinuteMetricH2TableDefine.java | 33 +++++++ .../cpu/CpuMonthMetricH2TableDefine.java | 33 +++++++ .../cpu/CpuSecondMetricH2TableDefine.java | 33 +++++++ .../resources/META-INF/defines/storage.define | 5 + 26 files changed, 580 insertions(+), 712 deletions(-) delete mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationEsRegisterDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceEsRegisterDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameEsRegisterDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/base/dao/AbstractPersistenceH2DAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2RegisterDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2RegisterDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressRegisterH2DAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/AbstractCpuMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceH2TableDefine.java rename apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/{ApplicationH2TableDefine.java => cpu/AbstractCpuMetricH2TableDefine.java} (51%) create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java index 7862fcaaf..23961e76c 100644 --- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java +++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java @@ -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()); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 3da2c16ae..8ff175e6b 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -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 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); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/base/sql/SqlBuilder.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/base/sql/SqlBuilder.java index c4dbd6fbc..75e235ce5 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/base/sql/SqlBuilder.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/base/sql/SqlBuilder.java @@ -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); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationEsRegisterDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationEsRegisterDAO.java deleted file mode 100644 index ce962b73a..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ApplicationEsRegisterDAO.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 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()); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceEsRegisterDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceEsRegisterDAO.java deleted file mode 100644 index 1d5619f85..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceEsRegisterDAO.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 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 source = new HashMap<>(); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, heartbeatTime); - - updateRequest.doc(source); - client.update(updateRequest); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameEsRegisterDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameEsRegisterDAO.java deleted file mode 100644 index 1dc315f81..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/ServiceNameEsRegisterDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 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()); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 4dd7d1c07..2290a5ab4 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -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)); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/base/dao/AbstractPersistenceH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/base/dao/AbstractPersistenceH2DAO.java new file mode 100644 index 000000000..c6fac61d7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/base/dao/AbstractPersistenceH2DAO.java @@ -0,0 +1,95 @@ +/* + * 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.base.dao; + +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.h2.base.define.H2SqlEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractPersistenceH2DAO extends H2DAO implements IPersistenceDAO { + + private final Logger logger = LoggerFactory.getLogger(AbstractPersistenceH2DAO.class); + + public AbstractPersistenceH2DAO(H2Client client) { + super(client); + } + + private static final String GET_SQL = "select * from {0} where {1} = ?"; + + protected abstract STREAM_DATA h2DataToStreamData(ResultSet resultSet) throws SQLException; + + protected abstract String tableName(); + + @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; + } + + protected abstract Map streamDataToH2Data(STREAM_DATA streamData); + + @Override public final H2SqlEntity prepareBatchInsert(STREAM_DATA streamData) { + Map 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 source = streamDataToH2Data(streamData); + + H2SqlEntity entity = new H2SqlEntity(); + String sql = SqlBuilder.buildBatchUpdateSql(tableName(), source.keySet(), CommonTable.COLUMN_ID); + entity.setSql(sql); + List 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) { + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2RegisterDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2RegisterDAO.java deleted file mode 100644 index 266f53665..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2RegisterDAO.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.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; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationH2RegisterDAO extends H2DAO implements IApplicationRegisterDAO { - private final Logger logger = LoggerFactory.getLogger(ApplicationH2RegisterDAO.class); - - public ApplicationH2RegisterDAO(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 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); - } - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2RegisterDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2RegisterDAO.java deleted file mode 100644 index 1bb794b40..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2RegisterDAO.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.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.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.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceH2RegisterDAO extends H2DAO implements IInstanceRegisterDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceH2RegisterDAO.class); - - public InstanceH2RegisterDAO(H2Client client) { - super(client); - } - - private static final String UPDATE_HEARTBEAT_TIME_SQL = "update {0} set {1} = ? where {2} = ?"; - - @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) { - H2Client client = getClient(); - Map 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) { - logger.error(e.getMessage(), e); - } - } - - @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); - } - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressRegisterH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressRegisterH2DAO.java deleted file mode 100644 index 4068dd8d7..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressRegisterH2DAO.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.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; - -/** - * @author peng-yongsheng, clevertension - */ -public class NetworkAddressRegisterH2DAO extends H2DAO implements INetworkAddressRegisterDAO { - - private final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterH2DAO.class); - - public NetworkAddressRegisterH2DAO(H2Client client) { - super(client); - } - - @Override - public int getMaxNetworkAddressId() { - return getMaxId(NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID); - } - - @Override - public int getMinNetworkAddressId() { - return getMinId(NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID); - } - - @Override - public void save(NetworkAddress networkAddress) { - H2Client client = getClient(); - - Map 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()); - - 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); - } - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java deleted file mode 100644 index a271ca11f..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2RegisterDAO.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 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); - } - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/AbstractCpuMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/AbstractCpuMetricH2PersistenceDAO.java new file mode 100644 index 000000000..14644a3b8 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/AbstractCpuMetricH2PersistenceDAO.java @@ -0,0 +1,64 @@ +/* + * 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 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.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 + */ +public abstract class AbstractCpuMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractCpuMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @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)); + + cpuMetric.setInstanceId(resultSet.getInt(CpuMetricTable.COLUMN_INSTANCE_ID)); + + 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 streamDataToH2Data(CpuMetric streamData) { + Map source = new HashMap<>(); + 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()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..d62f6e2f1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.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 CpuDayMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuDayMetricPersistenceDAO { + + public CpuDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..f5325a081 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.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 + */ +public class CpuHourMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuHourMetricPersistenceDAO { + + public CpuHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..20d9d5cb7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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 { + + public CpuMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..99d008a66 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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 { + + public CpuMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java new file mode 100644 index 000000000..ce63d6c43 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cpump/CpuSecondMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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 { + + public CpuSecondMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceH2TableDefine.java deleted file mode 100644 index c9fbef734..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceH2TableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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; - -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; - -/** - * @author peng-yongsheng - */ -public class InstanceH2TableDefine extends H2TableDefine { - - public InstanceH2TableDefine() { - super(InstanceTable.TABLE); - } - - @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())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/AbstractCpuMetricH2TableDefine.java similarity index 51% rename from apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationH2TableDefine.java rename to apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/AbstractCpuMetricH2TableDefine.java index 4b1630d92..72d8b11dd 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/AbstractCpuMetricH2TableDefine.java @@ -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.ApplicationTable; +import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable; /** * @author peng-yongsheng */ -public class ApplicationH2TableDefine extends H2TableDefine { +public abstract class AbstractCpuMetricH2TableDefine 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())); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java new file mode 100644 index 000000000..fbdf74fe9 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java new file mode 100644 index 000000000..caf29f001 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..c925957a4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java new file mode 100644 index 000000000..6c8794107 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java new file mode 100644 index 000000000..5fc5d8d6d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/cpu/CpuSecondMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index ca59ab12b..e4192d5bc 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -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 From 01cd19a0ff0ecb1958e66f4f96bdbae25c324fc6 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 14:14:23 +0800 Subject: [PATCH 05/18] GC metric pyramid aggregate by h2 storage test successful. --- .../JVMMetricServiceHandlerTestCase.java | 2 +- .../apm/collector/storage/StorageModule.java | 19 ++++-- .../storage/h2/StorageModuleH2Provider.java | 17 ++++- .../AbstractGCMetricH2PersistenceDAO.java | 67 +++++++++++++++++++ .../gcmp/GCDayMetricH2PersistenceDAO.java} | 26 +++---- .../gcmp/GCHourMetricH2PersistenceDAO.java} | 26 +++---- .../gcmp/GCMinuteMetricH2PersistenceDAO.java | 41 ++++++++++++ .../gcmp/GCMonthMetricH2PersistenceDAO.java | 41 ++++++++++++ .../gcmp/GCSecondMetricH2PersistenceDAO.java | 41 ++++++++++++ .../gc/AbstractGCMetricH2TableDefine.java | 43 ++++++++++++ .../define/gc/GCDayMetricH2TableDefine.java | 33 +++++++++ .../define/gc/GCHourMetricH2TableDefine.java | 33 +++++++++ .../gc/GCMinuteMetricH2TableDefine.java | 33 +++++++++ .../define/gc/GCMonthMetricH2TableDefine.java | 33 +++++++++ .../gc/GCSecondMetricH2TableDefine.java | 33 +++++++++ .../resources/META-INF/defines/storage.define | 8 ++- 16 files changed, 460 insertions(+), 36 deletions(-) create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/AbstractGCMetricH2PersistenceDAO.java rename apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/{define/CpuMetricH2TableDefine.java => dao/gcmp/GCDayMetricH2PersistenceDAO.java} (51%) rename apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/{define/ServiceNameH2TableDefine.java => dao/gcmp/GCHourMetricH2PersistenceDAO.java} (51%) create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCSecondMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/AbstractGCMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCSecondMetricH2TableDefine.java diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java index 23961e76c..9eb567cf7 100644 --- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java +++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java @@ -46,7 +46,7 @@ public class JVMMetricServiceHandlerTestCase { metricBuilder.setTime(System.currentTimeMillis()); buildCPUMetric(metricBuilder); -// buildGCMetric(metricBuilder); + buildGCMetric(metricBuilder); // buildMemoryMetric(metricBuilder); // buildMemoryPoolMetric(metricBuilder); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 8ff175e6b..02de180ce 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -44,6 +44,11 @@ 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.register.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO; @@ -93,13 +98,13 @@ public class StorageModule extends Module { classes.add(ICpuHourMetricPersistenceDAO.class); classes.add(ICpuDayMetricPersistenceDAO.class); classes.add(ICpuMonthMetricPersistenceDAO.class); -// -// classes.add(IGCSecondMetricPersistenceDAO.class); -// classes.add(IGCMinuteMetricPersistenceDAO.class); -// classes.add(IGCHourMetricPersistenceDAO.class); -// classes.add(IGCDayMetricPersistenceDAO.class); -// classes.add(IGCMonthMetricPersistenceDAO.class); -// + + classes.add(IGCSecondMetricPersistenceDAO.class); + classes.add(IGCMinuteMetricPersistenceDAO.class); + classes.add(IGCHourMetricPersistenceDAO.class); + classes.add(IGCDayMetricPersistenceDAO.class); + classes.add(IGCMonthMetricPersistenceDAO.class); + // classes.add(IMemorySecondMetricPersistenceDAO.class); // classes.add(IMemoryMinuteMetricPersistenceDAO.class); // classes.add(IMemoryHourMetricPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 2290a5ab4..32389d10d 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -49,6 +49,11 @@ 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.register.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO; @@ -77,6 +82,11 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuHourMetricH2P 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.gcmp.GCDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMonthMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCSecondMetricH2PersistenceDAO; 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; @@ -159,7 +169,12 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(ICpuDayMetricPersistenceDAO.class, new CpuDayMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(ICpuMonthMetricPersistenceDAO.class, new CpuMonthMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGCMinuteMetricPersistenceDAO.class, new GCMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGCHourMetricPersistenceDAO.class, new GCHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGCDayMetricPersistenceDAO.class, new GCDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGCMonthMetricPersistenceDAO.class, new GCMonthMetricH2PersistenceDAO(h2Client)); + // this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); // diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/AbstractGCMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/AbstractGCMetricH2PersistenceDAO.java new file mode 100644 index 000000000..ad7a04165 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/AbstractGCMetricH2PersistenceDAO.java @@ -0,0 +1,67 @@ +/* + * 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.gcmp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractGCMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractGCMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final GCMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + GCMetric gcMetric = new GCMetric(); + gcMetric.setId(resultSet.getString(GCMetricTable.COLUMN_ID)); + gcMetric.setMetricId(resultSet.getString(GCMetricTable.COLUMN_METRIC_ID)); + + gcMetric.setInstanceId(resultSet.getInt(GCMetricTable.COLUMN_INSTANCE_ID)); + gcMetric.setPhrase(resultSet.getInt(GCMetricTable.COLUMN_PHRASE)); + + gcMetric.setCount(resultSet.getLong(GCMetricTable.COLUMN_COUNT)); + gcMetric.setTimes(resultSet.getLong(GCMetricTable.COLUMN_TIMES)); + + gcMetric.setTimeBucket(resultSet.getLong(GCMetricTable.COLUMN_TIME_BUCKET)); + + return gcMetric; + } + + @Override protected final Map streamDataToH2Data(GCMetric streamData) { + Map source = new HashMap<>(); + source.put(GCMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(GCMetricTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(GCMetricTable.COLUMN_PHRASE, streamData.getPhrase()); + source.put(GCMetricTable.COLUMN_COUNT, streamData.getCount()); + source.put(GCMetricTable.COLUMN_TIMES, streamData.getTimes()); + source.put(GCMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/CpuMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCDayMetricH2PersistenceDAO.java similarity index 51% rename from apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/CpuMetricH2TableDefine.java rename to apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCDayMetricH2PersistenceDAO.java index 8f78b0598..e3e48cd3d 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/CpuMetricH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCDayMetricH2PersistenceDAO.java @@ -16,26 +16,26 @@ * */ +package org.apache.skywalking.apm.collector.storage.h2.dao.gcmp; -package org.apache.skywalking.apm.collector.storage.h2.define; - -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.jvm.CpuMetricTable; +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.gcmp.IGCDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; /** * @author peng-yongsheng */ -public class CpuMetricH2TableDefine extends H2TableDefine { +public class GCDayMetricH2PersistenceDAO extends AbstractGCMetricH2PersistenceDAO implements IGCDayMetricPersistenceDAO { - public CpuMetricH2TableDefine() { - super(CpuMetricTable.TABLE); + public GCDayMetricH2PersistenceDAO(H2Client client) { + super(client); } - @Override public void initialize() { - addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_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_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceNameH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCHourMetricH2PersistenceDAO.java similarity index 51% rename from apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceNameH2TableDefine.java rename to apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCHourMetricH2PersistenceDAO.java index 2e3102d4e..df4e780aa 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceNameH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCHourMetricH2PersistenceDAO.java @@ -16,26 +16,26 @@ * */ +package org.apache.skywalking.apm.collector.storage.h2.dao.gcmp; -package org.apache.skywalking.apm.collector.storage.h2.define; - -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.ServiceNameTable; +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.gcmp.IGCHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; /** * @author peng-yongsheng */ -public class ServiceNameH2TableDefine extends H2TableDefine { +public class GCHourMetricH2PersistenceDAO extends AbstractGCMetricH2PersistenceDAO implements IGCHourMetricPersistenceDAO { - public ServiceNameH2TableDefine() { - super(ServiceNameTable.TABLE); + public GCHourMetricH2PersistenceDAO(H2Client client) { + super(client); } - @Override public void initialize() { - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..61774b661 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.gcmp; + +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.gcmp.IGCMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCMinuteMetricH2PersistenceDAO extends AbstractGCMetricH2PersistenceDAO implements IGCMinuteMetricPersistenceDAO { + + public GCMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..60edbd5d9 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.gcmp; + +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.gcmp.IGCMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCMonthMetricH2PersistenceDAO extends AbstractGCMetricH2PersistenceDAO implements IGCMonthMetricPersistenceDAO { + + public GCMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCSecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCSecondMetricH2PersistenceDAO.java new file mode 100644 index 000000000..ab13aaa3d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/gcmp/GCSecondMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.gcmp; + +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.gcmp.IGCSecondMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCSecondMetricH2PersistenceDAO extends AbstractGCMetricH2PersistenceDAO implements IGCSecondMetricPersistenceDAO { + + public GCSecondMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/AbstractGCMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/AbstractGCMetricH2TableDefine.java new file mode 100644 index 000000000..aa8a932aa --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/AbstractGCMetricH2TableDefine.java @@ -0,0 +1,43 @@ +/* + * 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.gc; + +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.jvm.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractGCMetricH2TableDefine extends H2TableDefine { + + public AbstractGCMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_PHRASE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_COUNT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_TIMES, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCDayMetricH2TableDefine.java new file mode 100644 index 000000000..f9789051a --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.gc; + +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.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCDayMetricH2TableDefine extends AbstractGCMetricH2TableDefine { + + public GCDayMetricH2TableDefine() { + super(GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCHourMetricH2TableDefine.java new file mode 100644 index 000000000..52d758809 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.gc; + +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.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCHourMetricH2TableDefine extends AbstractGCMetricH2TableDefine { + + public GCHourMetricH2TableDefine() { + super(GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..f53f6c12e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.gc; + +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.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCMinuteMetricH2TableDefine extends AbstractGCMetricH2TableDefine { + + public GCMinuteMetricH2TableDefine() { + super(GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMonthMetricH2TableDefine.java new file mode 100644 index 000000000..d8aad921e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.gc; + +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.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCMonthMetricH2TableDefine extends AbstractGCMetricH2TableDefine { + + public GCMonthMetricH2TableDefine() { + super(GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCSecondMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCSecondMetricH2TableDefine.java new file mode 100644 index 000000000..e7c60ca1f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/gc/GCSecondMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.gc; + +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.GCMetricTable; + +/** + * @author peng-yongsheng + */ +public class GCSecondMetricH2TableDefine extends AbstractGCMetricH2TableDefine { + + public GCSecondMetricH2TableDefine() { + super(GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index e4192d5bc..c4d6d204a 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -7,4 +7,10 @@ org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuSecondMetricH2Table 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 +org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.gc.GCSecondMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.gc.GCMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.gc.GCHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.gc.GCDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.gc.GCMonthMetricH2TableDefine \ No newline at end of file From 7d881e8ad110a06da7c0fe2f2905b1c09767e9e9 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 14:14:43 +0800 Subject: [PATCH 06/18] no message --- .../dao/CpuSecondMetricH2PersistenceDAO.java | 70 ------------------- .../dao/GCSecondMetricH2PersistenceDAO.java | 66 ----------------- .../h2/define/GCMetricH2TableDefine.java | 43 ------------ .../define/NetworkAddressH2TableDefine.java | 39 ----------- 4 files changed, 218 deletions(-) delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuSecondMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GCMetricH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/NetworkAddressH2TableDefine.java diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuSecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuSecondMetricH2PersistenceDAO.java deleted file mode 100644 index 47cacb3b7..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuSecondMetricH2PersistenceDAO.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric; -import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable; -import org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class CpuSecondMetricH2PersistenceDAO extends H2DAO implements ICpuSecondMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(CpuSecondMetricH2PersistenceDAO.class); - - public CpuSecondMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public CpuMetric get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(CpuMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(CpuMetricTable.COLUMN_ID, data.getId()); - source.put(CpuMetricTable.COLUMN_INSTANCE_ID, data.getInstanceId()); - source.put(CpuMetricTable.COLUMN_USAGE_PERCENT, data.getUsagePercent()); - source.put(CpuMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - logger.debug("prepare cpu metric batch insert, getId: {}", data.getId()); - String sql = SqlBuilder.buildBatchInsertSql(CpuMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(CpuMetric data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java deleted file mode 100644 index d6c9e3388..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.table.jvm.GCMetricTable; -import org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; - -/** - * @author peng-yongsheng, clevertension - */ -public class GCSecondMetricH2PersistenceDAO extends H2DAO implements IGCSecondMetricPersistenceDAO { - - public GCSecondMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public GCMetric get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(GCMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(GCMetricTable.COLUMN_ID, data.getId()); - source.put(GCMetricTable.COLUMN_INSTANCE_ID, data.getInstanceId()); - source.put(GCMetricTable.COLUMN_PHRASE, data.getPhrase()); - source.put(GCMetricTable.COLUMN_COUNT, data.getCount()); - source.put(GCMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchInsertSql(GCMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(GCMetric data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GCMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GCMetricH2TableDefine.java deleted file mode 100644 index c62e38944..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GCMetricH2TableDefine.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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; - -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; -import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; - -/** - * @author peng-yongsheng - */ -public class GCMetricH2TableDefine extends H2TableDefine { - - public GCMetricH2TableDefine() { - super(GCMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_PHRASE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_COUNT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_TIMES, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/NetworkAddressH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/NetworkAddressH2TableDefine.java deleted file mode 100644 index 4d2c3f9dd..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/NetworkAddressH2TableDefine.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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; - -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.NetworkAddressTable; - -/** - * @author peng-yongsheng - */ -public class NetworkAddressH2TableDefine extends H2TableDefine { - - public NetworkAddressH2TableDefine() { - super(NetworkAddressTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(NetworkAddressTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NetworkAddressTable.COLUMN_NETWORK_ADDRESS, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NetworkAddressTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); - } -} From 9c58e8768786112e6e9e245602558ba439560e96 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 14:34:06 +0800 Subject: [PATCH 07/18] Memory metric pyramid aggregate by h2 storage test successful. --- .../JVMMetricServiceHandlerTestCase.java | 2 +- .../apm/collector/storage/StorageModule.java | 17 +++-- .../AbstractMemoryMetricEsTableDefine.java | 1 - .../storage/h2/StorageModuleH2Provider.java | 19 ++++- .../AbstractMemoryMetricH2PersistenceDAO.java | 72 +++++++++++++++++++ .../MemoryDayMetricH2PersistenceDAO.java | 41 +++++++++++ .../MemoryHourMetricH2PersistenceDAO.java | 41 +++++++++++ .../MemoryMinuteMetricH2PersistenceDAO.java | 41 +++++++++++ .../MemoryMonthMetricH2PersistenceDAO.java | 41 +++++++++++ .../MemorySecondMetricH2PersistenceDAO.java | 41 +++++++++++ .../AbstractMemoryMetricH2TableDefine.java | 46 ++++++++++++ .../memory/MemoryDayMetricH2TableDefine.java | 33 +++++++++ .../memory/MemoryHourMetricH2TableDefine.java | 33 +++++++++ .../MemoryMinuteMetricH2TableDefine.java | 33 +++++++++ .../MemoryMonthMetricH2TableDefine.java | 33 +++++++++ .../MemorySecondMetricH2TableDefine.java | 33 +++++++++ .../resources/META-INF/defines/storage.define | 8 ++- 17 files changed, 524 insertions(+), 11 deletions(-) create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/AbstractMemoryMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemorySecondMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemorySecondMetricH2TableDefine.java diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java index 9eb567cf7..054ded286 100644 --- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java +++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java @@ -47,7 +47,7 @@ public class JVMMetricServiceHandlerTestCase { buildCPUMetric(metricBuilder); buildGCMetric(metricBuilder); -// buildMemoryMetric(metricBuilder); + buildMemoryMetric(metricBuilder); // buildMemoryPoolMetric(metricBuilder); builder.addMetrics(metricBuilder.build()); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 02de180ce..50beb3336 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -49,6 +49,11 @@ import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersist 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.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.register.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO; @@ -105,12 +110,12 @@ public class StorageModule extends Module { classes.add(IGCDayMetricPersistenceDAO.class); classes.add(IGCMonthMetricPersistenceDAO.class); -// classes.add(IMemorySecondMetricPersistenceDAO.class); -// classes.add(IMemoryMinuteMetricPersistenceDAO.class); -// classes.add(IMemoryHourMetricPersistenceDAO.class); -// classes.add(IMemoryDayMetricPersistenceDAO.class); -// classes.add(IMemoryMonthMetricPersistenceDAO.class); -// + classes.add(IMemorySecondMetricPersistenceDAO.class); + classes.add(IMemoryMinuteMetricPersistenceDAO.class); + classes.add(IMemoryHourMetricPersistenceDAO.class); + classes.add(IMemoryDayMetricPersistenceDAO.class); + classes.add(IMemoryMonthMetricPersistenceDAO.class); + // classes.add(IMemoryPoolSecondMetricPersistenceDAO.class); // classes.add(IMemoryPoolMinuteMetricPersistenceDAO.class); // classes.add(IMemoryPoolHourMetricPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/memory/AbstractMemoryMetricEsTableDefine.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/memory/AbstractMemoryMetricEsTableDefine.java index f7b4d1b1d..eaf6c0289 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/memory/AbstractMemoryMetricEsTableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/memory/AbstractMemoryMetricEsTableDefine.java @@ -35,7 +35,6 @@ public abstract class AbstractMemoryMetricEsTableDefine extends ElasticSearchTab addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_ID, ElasticSearchColumnDefine.Type.Keyword.name())); addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_METRIC_ID, ElasticSearchColumnDefine.Type.Keyword.name())); addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, ElasticSearchColumnDefine.Type.Boolean.name())); addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_INIT, ElasticSearchColumnDefine.Type.Long.name())); addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_MAX, ElasticSearchColumnDefine.Type.Long.name())); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 32389d10d..0eae4d542 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -54,6 +54,11 @@ import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersist 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.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.register.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO; @@ -87,6 +92,11 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCHourMetricH2Per import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMinuteMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCSecondMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryMonthMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemorySecondMetricH2PersistenceDAO; 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; @@ -175,8 +185,13 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IGCDayMetricPersistenceDAO.class, new GCDayMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IGCMonthMetricPersistenceDAO.class, new GCMonthMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryMinuteMetricPersistenceDAO.class, new MemoryMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryHourMetricPersistenceDAO.class, new MemoryHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryDayMetricPersistenceDAO.class, new MemoryDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryMonthMetricPersistenceDAO.class, new MemoryMonthMetricH2PersistenceDAO(h2Client)); + + // this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); // // this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentH2MinutePersistenceDAO(h2Client)); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/AbstractMemoryMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/AbstractMemoryMetricH2PersistenceDAO.java new file mode 100644 index 000000000..60ba719e4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/AbstractMemoryMetricH2PersistenceDAO.java @@ -0,0 +1,72 @@ +/* + * 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.memorymp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng, clevertension + */ +public abstract class AbstractMemoryMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractMemoryMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final MemoryMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + MemoryMetric memoryMetric = new MemoryMetric(); + memoryMetric.setId(resultSet.getString(MemoryMetricTable.COLUMN_ID)); + memoryMetric.setMetricId(resultSet.getString(MemoryMetricTable.COLUMN_METRIC_ID)); + + memoryMetric.setInstanceId(resultSet.getInt(MemoryMetricTable.COLUMN_INSTANCE_ID)); + memoryMetric.setIsHeap(resultSet.getBoolean(MemoryMetricTable.COLUMN_IS_HEAP)); + + memoryMetric.setInit(resultSet.getLong(MemoryMetricTable.COLUMN_INIT)); + memoryMetric.setMax(resultSet.getLong(MemoryMetricTable.COLUMN_MAX)); + memoryMetric.setUsed(resultSet.getLong(MemoryMetricTable.COLUMN_USED)); + memoryMetric.setCommitted(resultSet.getLong(MemoryMetricTable.COLUMN_COMMITTED)); + memoryMetric.setTimes(resultSet.getLong(MemoryMetricTable.COLUMN_TIMES)); + + memoryMetric.setTimeBucket(resultSet.getLong(MemoryMetricTable.COLUMN_TIME_BUCKET)); + return memoryMetric; + } + + @Override protected final Map streamDataToH2Data(MemoryMetric streamData) { + Map source = new HashMap<>(); + source.put(MemoryMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(MemoryMetricTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(MemoryMetricTable.COLUMN_IS_HEAP, streamData.getIsHeap()); + source.put(MemoryMetricTable.COLUMN_INIT, streamData.getInit()); + source.put(MemoryMetricTable.COLUMN_MAX, streamData.getMax()); + source.put(MemoryMetricTable.COLUMN_USED, streamData.getUsed()); + source.put(MemoryMetricTable.COLUMN_COMMITTED, streamData.getCommitted()); + source.put(MemoryMetricTable.COLUMN_TIMES, streamData.getTimes()); + source.put(MemoryMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..6acfb0953 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.memorymp; + +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.memorymp.IMemoryDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryDayMetricH2PersistenceDAO extends AbstractMemoryMetricH2PersistenceDAO implements IMemoryDayMetricPersistenceDAO { + + public MemoryDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..a95ab8897 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.memorymp; + +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.memorymp.IMemoryHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryHourMetricH2PersistenceDAO extends AbstractMemoryMetricH2PersistenceDAO implements IMemoryHourMetricPersistenceDAO { + + public MemoryHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..2fcea1093 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.memorymp; + +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.memorymp.IMemoryMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryMinuteMetricH2PersistenceDAO extends AbstractMemoryMetricH2PersistenceDAO implements IMemoryMinuteMetricPersistenceDAO { + + public MemoryMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..74f8b7d60 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemoryMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.memorymp; + +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.memorymp.IMemoryMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryMonthMetricH2PersistenceDAO extends AbstractMemoryMetricH2PersistenceDAO implements IMemoryMonthMetricPersistenceDAO { + + public MemoryMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemorySecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemorySecondMetricH2PersistenceDAO.java new file mode 100644 index 000000000..3b8ad18d9 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/memorymp/MemorySecondMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.memorymp; + +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.memorymp.IMemorySecondMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemorySecondMetricH2PersistenceDAO extends AbstractMemoryMetricH2PersistenceDAO implements IMemorySecondMetricPersistenceDAO { + + public MemorySecondMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java new file mode 100644 index 000000000..cecb25861 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java @@ -0,0 +1,46 @@ +/* + * 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.memory; + +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.jvm.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractMemoryMetricH2TableDefine extends H2TableDefine { + + AbstractMemoryMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, H2ColumnDefine.Type.Boolean.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_COMMITTED, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_TIMES, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryDayMetricH2TableDefine.java new file mode 100644 index 000000000..7c1e38f48 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.memory; + +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.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryDayMetricH2TableDefine extends AbstractMemoryMetricH2TableDefine { + + public MemoryDayMetricH2TableDefine() { + super(MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryHourMetricH2TableDefine.java new file mode 100644 index 000000000..132cd0408 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.memory; + +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.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryHourMetricH2TableDefine extends AbstractMemoryMetricH2TableDefine { + + public MemoryHourMetricH2TableDefine() { + super(MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..bfcd099e3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.memory; + +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.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryMinuteMetricH2TableDefine extends AbstractMemoryMetricH2TableDefine { + + public MemoryMinuteMetricH2TableDefine() { + super(MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMonthMetricH2TableDefine.java new file mode 100644 index 000000000..bf0523dbf --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemoryMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.memory; + +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.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryMonthMetricH2TableDefine extends AbstractMemoryMetricH2TableDefine { + + public MemoryMonthMetricH2TableDefine() { + super(MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemorySecondMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemorySecondMetricH2TableDefine.java new file mode 100644 index 000000000..4abba5a25 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/MemorySecondMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.memory; + +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.MemoryMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemorySecondMetricH2TableDefine extends AbstractMemoryMetricH2TableDefine { + + public MemorySecondMetricH2TableDefine() { + super(MemoryMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index c4d6d204a..268075a1b 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -13,4 +13,10 @@ org.apache.skywalking.apm.collector.storage.h2.define.gc.GCSecondMetricH2TableDe org.apache.skywalking.apm.collector.storage.h2.define.gc.GCMinuteMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.gc.GCHourMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.gc.GCDayMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.gc.GCMonthMetricH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.gc.GCMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.memory.MemorySecondMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryMonthMetricH2TableDefine \ No newline at end of file From 98d78f21c3cd30945b6a4e1c499bf569e1561d4d Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 15:06:12 +0800 Subject: [PATCH 08/18] Memory pool metric pyramid aggregate by h2 storage test successful. --- .../JVMMetricServiceHandlerTestCase.java | 2 +- .../apm/collector/storage/StorageModule.java | 17 +++-- .../storage/h2/StorageModuleH2Provider.java | 18 ++++- ...tractMemoryPoolMetricH2PersistenceDAO.java | 72 +++++++++++++++++++ .../MemoryPoolDayMetricH2PersistenceDAO.java | 41 +++++++++++ .../MemoryPoolHourMetricH2PersistenceDAO.java | 41 +++++++++++ ...emoryPoolMinuteMetricH2PersistenceDAO.java | 41 +++++++++++ ...MemoryPoolMonthMetricH2PersistenceDAO.java | 41 +++++++++++ ...emoryPoolSecondMetricH2PersistenceDAO.java | 41 +++++++++++ .../h2/define/MemoryMetricH2TableDefine.java | 45 ------------ ...AbstractMemoryPoolMetricH2TableDefine.java | 46 ++++++++++++ .../MemoryPoolDayMetricH2TableDefine.java | 33 +++++++++ .../MemoryPoolHourMetricH2TableDefine.java | 33 +++++++++ .../MemoryPoolMinuteMetricH2TableDefine.java | 33 +++++++++ .../MemoryPoolMonthMetricH2TableDefine.java | 33 +++++++++ .../MemoryPoolSecondMetricH2TableDefine.java | 33 +++++++++ .../resources/META-INF/defines/storage.define | 8 ++- 17 files changed, 523 insertions(+), 55 deletions(-) create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/AbstractMemoryPoolMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolSecondMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/AbstractMemoryPoolMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolSecondMetricH2TableDefine.java diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java index 054ded286..7862fcaaf 100644 --- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java +++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java @@ -48,7 +48,7 @@ public class JVMMetricServiceHandlerTestCase { buildCPUMetric(metricBuilder); buildGCMetric(metricBuilder); buildMemoryMetric(metricBuilder); -// buildMemoryPoolMetric(metricBuilder); + buildMemoryPoolMetric(metricBuilder); builder.addMetrics(metricBuilder.build()); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 50beb3336..2e0309388 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -54,6 +54,11 @@ import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetri 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; @@ -116,12 +121,12 @@ public class StorageModule extends Module { classes.add(IMemoryDayMetricPersistenceDAO.class); classes.add(IMemoryMonthMetricPersistenceDAO.class); -// classes.add(IMemoryPoolSecondMetricPersistenceDAO.class); -// classes.add(IMemoryPoolMinuteMetricPersistenceDAO.class); -// classes.add(IMemoryPoolHourMetricPersistenceDAO.class); -// classes.add(IMemoryPoolDayMetricPersistenceDAO.class); -// classes.add(IMemoryPoolMonthMetricPersistenceDAO.class); -// + classes.add(IMemoryPoolSecondMetricPersistenceDAO.class); + classes.add(IMemoryPoolMinuteMetricPersistenceDAO.class); + classes.add(IMemoryPoolHourMetricPersistenceDAO.class); + classes.add(IMemoryPoolDayMetricPersistenceDAO.class); + classes.add(IMemoryPoolMonthMetricPersistenceDAO.class); + // classes.add(IApplicationComponentMinutePersistenceDAO.class); // classes.add(IApplicationComponentHourPersistenceDAO.class); // classes.add(IApplicationComponentDayPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 0eae4d542..9ce796ce9 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -59,6 +59,11 @@ import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetri 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; @@ -97,6 +102,11 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryHourMet import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryMinuteMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemorySecondMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.mpoolmp.MemoryPoolDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.mpoolmp.MemoryPoolHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.mpoolmp.MemoryPoolMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.mpoolmp.MemoryPoolMonthMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.mpoolmp.MemoryPoolSecondMetricH2PersistenceDAO; 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; @@ -191,8 +201,12 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IMemoryDayMetricPersistenceDAO.class, new MemoryDayMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IMemoryMonthMetricPersistenceDAO.class, new MemoryMonthMetricH2PersistenceDAO(h2Client)); - // this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); -// + this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryPoolMinuteMetricPersistenceDAO.class, new MemoryPoolMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryPoolHourMetricPersistenceDAO.class, new MemoryPoolHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryPoolDayMetricPersistenceDAO.class, new MemoryPoolDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IMemoryPoolMonthMetricPersistenceDAO.class, new MemoryPoolMonthMetricH2PersistenceDAO(h2Client)); + // this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentH2MinutePersistenceDAO(h2Client)); // this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingH2MinutePersistenceDAO(h2Client)); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/AbstractMemoryPoolMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/AbstractMemoryPoolMetricH2PersistenceDAO.java new file mode 100644 index 000000000..e4150ded8 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/AbstractMemoryPoolMetricH2PersistenceDAO.java @@ -0,0 +1,72 @@ +/* + * 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.mpoolmp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractMemoryPoolMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractMemoryPoolMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final MemoryPoolMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + MemoryPoolMetric memoryPoolMetric = new MemoryPoolMetric(); + memoryPoolMetric.setId(resultSet.getString(MemoryPoolMetricTable.COLUMN_ID)); + memoryPoolMetric.setMetricId(resultSet.getString(MemoryPoolMetricTable.COLUMN_METRIC_ID)); + + memoryPoolMetric.setInstanceId(resultSet.getInt(MemoryPoolMetricTable.COLUMN_INSTANCE_ID)); + memoryPoolMetric.setPoolType(resultSet.getInt(MemoryPoolMetricTable.COLUMN_POOL_TYPE)); + + memoryPoolMetric.setInit(resultSet.getLong(MemoryPoolMetricTable.COLUMN_INIT)); + memoryPoolMetric.setMax(resultSet.getLong(MemoryPoolMetricTable.COLUMN_MAX)); + memoryPoolMetric.setUsed(resultSet.getLong(MemoryPoolMetricTable.COLUMN_USED)); + memoryPoolMetric.setCommitted(resultSet.getLong(MemoryPoolMetricTable.COLUMN_COMMITTED)); + memoryPoolMetric.setTimes(resultSet.getLong(MemoryPoolMetricTable.COLUMN_TIMES)); + + memoryPoolMetric.setTimeBucket(resultSet.getLong(MemoryPoolMetricTable.COLUMN_TIME_BUCKET)); + return memoryPoolMetric; + } + + @Override protected final Map streamDataToH2Data(MemoryPoolMetric streamData) { + Map source = new HashMap<>(); + source.put(MemoryPoolMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(MemoryPoolMetricTable.COLUMN_POOL_TYPE, streamData.getPoolType()); + source.put(MemoryPoolMetricTable.COLUMN_INIT, streamData.getInit()); + source.put(MemoryPoolMetricTable.COLUMN_MAX, streamData.getMax()); + source.put(MemoryPoolMetricTable.COLUMN_USED, streamData.getUsed()); + source.put(MemoryPoolMetricTable.COLUMN_COMMITTED, streamData.getCommitted()); + source.put(MemoryPoolMetricTable.COLUMN_TIMES, streamData.getTimes()); + source.put(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..5629d3862 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.mpoolmp; + +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.mpoolmp.IMemoryPoolDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolDayMetricH2PersistenceDAO extends AbstractMemoryPoolMetricH2PersistenceDAO implements IMemoryPoolDayMetricPersistenceDAO { + + public MemoryPoolDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..0ff168a0d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.mpoolmp; + +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.mpoolmp.IMemoryPoolHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolHourMetricH2PersistenceDAO extends AbstractMemoryPoolMetricH2PersistenceDAO implements IMemoryPoolHourMetricPersistenceDAO { + + public MemoryPoolHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..0a9924e33 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.mpoolmp; + +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.mpoolmp.IMemoryPoolMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolMinuteMetricH2PersistenceDAO extends AbstractMemoryPoolMetricH2PersistenceDAO implements IMemoryPoolMinuteMetricPersistenceDAO { + + public MemoryPoolMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..7de8bbea6 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.mpoolmp; + +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.mpoolmp.IMemoryPoolMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolMonthMetricH2PersistenceDAO extends AbstractMemoryPoolMetricH2PersistenceDAO implements IMemoryPoolMonthMetricPersistenceDAO { + + public MemoryPoolMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolSecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolSecondMetricH2PersistenceDAO.java new file mode 100644 index 000000000..c0f0d1424 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/mpoolmp/MemoryPoolSecondMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.mpoolmp; + +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.mpoolmp.IMemoryPoolSecondMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolSecondMetricH2PersistenceDAO extends AbstractMemoryPoolMetricH2PersistenceDAO implements IMemoryPoolSecondMetricPersistenceDAO { + + public MemoryPoolSecondMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryMetricH2TableDefine.java deleted file mode 100644 index 0e48ee8fd..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryMetricH2TableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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; - -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.jvm.MemoryMetricTable; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricH2TableDefine extends H2TableDefine { - - public MemoryMetricH2TableDefine() { - super(MemoryMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, H2ColumnDefine.Type.Boolean.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_COMMITTED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/AbstractMemoryPoolMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/AbstractMemoryPoolMetricH2TableDefine.java new file mode 100644 index 000000000..99e7fa508 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/AbstractMemoryPoolMetricH2TableDefine.java @@ -0,0 +1,46 @@ +/* + * 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.mpool; + +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.jvm.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractMemoryPoolMetricH2TableDefine extends H2TableDefine { + + public AbstractMemoryPoolMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_POOL_TYPE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_COMMITTED, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_TIMES, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolDayMetricH2TableDefine.java new file mode 100644 index 000000000..474a9119e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.mpool; + +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.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolDayMetricH2TableDefine extends AbstractMemoryPoolMetricH2TableDefine { + + public MemoryPoolDayMetricH2TableDefine() { + super(MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolHourMetricH2TableDefine.java new file mode 100644 index 000000000..3d5d9388a --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.mpool; + +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.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolHourMetricH2TableDefine extends AbstractMemoryPoolMetricH2TableDefine { + + public MemoryPoolHourMetricH2TableDefine() { + super(MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..5807c97f3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.mpool; + +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.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolMinuteMetricH2TableDefine extends AbstractMemoryPoolMetricH2TableDefine { + + public MemoryPoolMinuteMetricH2TableDefine() { + super(MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMonthMetricH2TableDefine.java new file mode 100644 index 000000000..52538e0aa --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.mpool; + +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.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolMonthMetricH2TableDefine extends AbstractMemoryPoolMetricH2TableDefine { + + public MemoryPoolMonthMetricH2TableDefine() { + super(MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolSecondMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolSecondMetricH2TableDefine.java new file mode 100644 index 000000000..e581ce904 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/mpool/MemoryPoolSecondMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.mpool; + +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.MemoryPoolMetricTable; + +/** + * @author peng-yongsheng + */ +public class MemoryPoolSecondMetricH2TableDefine extends AbstractMemoryPoolMetricH2TableDefine { + + public MemoryPoolSecondMetricH2TableDefine() { + super(MemoryPoolMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index 268075a1b..2d97a3887 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -19,4 +19,10 @@ org.apache.skywalking.apm.collector.storage.h2.define.memory.MemorySecondMetricH org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryMinuteMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryHourMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryDayMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryMonthMetricH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.memory.MemoryMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolSecondMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolMonthMetricH2TableDefine \ No newline at end of file From 647f4f00a7405be79d5a9594b4ae4a03c1a4a862 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 11 Jan 2018 16:22:37 +0800 Subject: [PATCH 09/18] =?UTF-8?q?fixes=20#735=20Concurrency=20conflicts=20?= =?UTF-8?q?in=20Spring=20plugin=20=EF=BC=9Aclear=20ThreadLocal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mvc/commons/EnhanceRequireObjectCache.java | 4 ---- .../interceptor/AbstractMethodInteceptor.java | 17 ++++++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java index a17d8eea0..7623582f2 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java @@ -56,8 +56,4 @@ public class EnhanceRequireObjectCache { this.httpResponse.set(httpResponse); } - public HttpServletResponse getHttpResponse() { - return httpResponse.get(); - } - } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java index ca7d97597..8941cd10b 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java @@ -19,23 +19,24 @@ package org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor; -import java.lang.reflect.Method; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import org.apache.skywalking.apm.agent.core.context.CarrierItem; import org.apache.skywalking.apm.agent.core.context.ContextCarrier; +import org.apache.skywalking.apm.agent.core.context.ContextManager; import org.apache.skywalking.apm.agent.core.context.tag.Tags; import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; -import org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache; -import org.apache.skywalking.apm.agent.core.context.CarrierItem; -import org.apache.skywalking.apm.agent.core.context.ContextManager; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; +import org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; + /** * the abstract method inteceptor */ @@ -80,6 +81,8 @@ public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundI Tags.STATUS_CODE.set(span, Integer.toString(response.getStatus())); } ContextManager.stopSpan(); + + ((EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField()).setNativeWebRequest(null); return ret; } From 3bd9e5b75d13bc3a28bb50a15dee28fdd2c05945 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 19:39:29 +0800 Subject: [PATCH 10/18] Application component pyramid aggregate by h2 storage test successful. --- .../agent/jetty/provider/SegmentPost.java | 14 +-- .../AnalysisMetricModuleProvider.java | 10 +- .../parser/provider/parser/SegmentParse.java | 2 +- .../apm/collector/core/data/AbstractData.java | 26 +---- .../apm/collector/core/data/Data.java | 6 -- .../apm/collector/core/data/StreamData.java | 4 +- .../apm/collector/core/util/BooleanUtils.java | 48 ++++++++++ .../service/GRPCRemoteDeserializeService.java | 3 - .../service/GRPCRemoteSerializeService.java | 6 -- .../apm/collector/storage/StorageModule.java | 14 ++- .../storage/table/alarm/ApplicationAlarm.java | 4 +- .../table/alarm/ApplicationAlarmList.java | 4 +- .../alarm/ApplicationReferenceAlarm.java | 4 +- .../alarm/ApplicationReferenceAlarmList.java | 4 +- .../storage/table/alarm/InstanceAlarm.java | 4 +- .../table/alarm/InstanceAlarmList.java | 4 +- .../table/alarm/InstanceReferenceAlarm.java | 4 +- .../alarm/InstanceReferenceAlarmList.java | 4 +- .../storage/table/alarm/ServiceAlarm.java | 4 +- .../storage/table/alarm/ServiceAlarmList.java | 4 +- .../table/alarm/ServiceReferenceAlarm.java | 4 +- .../alarm/ServiceReferenceAlarmList.java | 4 +- .../application/ApplicationComponent.java | 4 +- .../table/application/ApplicationMapping.java | 4 +- .../table/application/ApplicationMetric.java | 4 +- .../ApplicationReferenceMetric.java | 4 +- .../storage/table/global/GlobalTrace.java | 5 +- .../table/instance/InstanceMapping.java | 4 +- .../table/instance/InstanceMetric.java | 4 +- .../instance/InstanceReferenceMetric.java | 4 +- .../storage/table/jvm/CpuMetric.java | 3 +- .../collector/storage/table/jvm/GCMetric.java | 3 +- .../storage/table/jvm/MemoryMetric.java | 23 +++-- .../storage/table/jvm/MemoryPoolMetric.java | 4 +- .../storage/table/register/Application.java | 10 +- .../storage/table/register/Instance.java | 10 +- .../table/register/NetworkAddress.java | 4 +- .../storage/table/register/ServiceName.java | 5 +- .../storage/table/segment/Segment.java | 5 +- .../storage/table/segment/SegmentCost.java | 13 +-- .../storage/table/service/ServiceMetric.java | 4 +- .../table/service/ServiceReferenceMetric.java | 4 +- .../define/ElasticSearchColumnDefine.java | 3 +- .../es/dao/cache/ApplicationEsCacheDAO.java | 5 +- .../es/dao/cache/InstanceEsCacheDAO.java | 5 +- .../es/define/SegmentCostEsTableDefine.java | 2 +- .../AbstractMemoryMetricEsTableDefine.java | 2 +- .../register/ApplicationEsTableDefine.java | 2 +- .../register/InstanceEsTableDefine.java | 2 +- .../storage/h2/StorageModuleH2Provider.java | 23 ++++- .../h2/base/define/H2ColumnDefine.java | 3 +- ...emoryPoolSecondMetricH2PersistenceDAO.java | 69 -------------- .../MemorySecondMetricH2PersistenceDAO.java | 69 -------------- ...tApplicationComponentH2PersistenceDAO.java | 60 ++++++++++++ ...plicationComponentDayH2PersistenceDAO.java | 41 ++++++++ ...licationComponentHourH2PersistenceDAO.java | 41 ++++++++ ...cationComponentMinuteH2PersistenceDAO.java | 41 ++++++++ ...icationComponentMonthH2PersistenceDAO.java | 41 ++++++++ .../h2/dao/cache/ApplicationH2CacheDAO.java | 94 +++++++++++++++++++ .../h2/dao/cache/InstanceH2CacheDAO.java | 93 ++++++++++++++++++ .../dao/cache/NetworkAddressH2CacheDAO.java | 77 +++++++++++++++ .../h2/dao/cache/ServiceNameH2CacheDAO.java | 79 ++++++++++++++++ .../define/MemoryPoolMetricH2TableDefine.java | 45 --------- .../h2/define/SegmentCostH2TableDefine.java | 5 +- ...ractApplicationComponentH2TableDefine.java | 41 ++++++++ .../ApplicationComponentDayH2TableDefine.java | 33 +++++++ ...ApplicationComponentHourH2TableDefine.java | 33 +++++++ ...plicationComponentMinuteH2TableDefine.java | 33 +++++++ ...pplicationComponentMonthH2TableDefine.java | 33 +++++++ .../AbstractMemoryMetricH2TableDefine.java | 2 +- .../register/ApplicationH2TableDefine.java | 2 +- .../register/InstanceH2TableDefine.java | 2 +- .../resources/META-INF/defines/storage.define | 7 +- 73 files changed, 914 insertions(+), 376 deletions(-) create mode 100644 apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/BooleanUtils.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryPoolSecondMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemorySecondMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/AbstractApplicationComponentH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentDayH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentHourH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMinuteH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMonthH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ApplicationH2CacheDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/InstanceH2CacheDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/NetworkAddressH2CacheDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ServiceNameH2CacheDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryPoolMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/AbstractApplicationComponentH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentDayH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentHourH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMinuteH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMonthH2TableDefine.java diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java index dc296cc64..6f6a108be 100644 --- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java +++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/agent/jetty/provider/SegmentPost.java @@ -39,12 +39,12 @@ public class SegmentPost { serviceNameRegisterPost.send("json/servicename-register-consumer.json"); serviceNameRegisterPost.send("json/servicename-register-provider.json"); -// JsonElement provider = JsonFileReader.INSTANCE.read("json/dubbox-provider.json"); -// JsonElement consumer = JsonFileReader.INSTANCE.read("json/dubbox-consumer.json"); -// -// for (int i = 0; i < 1; i++) { -// HttpClientTools.INSTANCE.post("http://localhost:12800/segments", provider.toString()); -// HttpClientTools.INSTANCE.post("http://localhost:12800/segments", consumer.toString()); -// } + JsonElement provider = JsonFileReader.INSTANCE.read("json/dubbox-provider.json"); + JsonElement consumer = JsonFileReader.INSTANCE.read("json/dubbox-consumer.json"); + + for (int i = 0; i < 1; i++) { + HttpClientTools.INSTANCE.post("http://localhost:12800/segments", provider.toString()); + HttpClientTools.INSTANCE.post("http://localhost:12800/segments", consumer.toString()); + } } } diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java index be6c3d3ee..4fb61d2d5 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java @@ -88,12 +88,12 @@ public class AnalysisMetricModuleProvider extends ModuleProvider { private void segmentParserListenerRegister() { ISegmentParserListenerRegister segmentParserListenerRegister = getManager().find(AnalysisSegmentParserModule.NAME).getService(ISegmentParserListenerRegister.class); - segmentParserListenerRegister.register(new ServiceReferenceMetricSpanListener.Factory()); +// segmentParserListenerRegister.register(new ServiceReferenceMetricSpanListener.Factory()); segmentParserListenerRegister.register(new ApplicationComponentSpanListener.Factory()); - segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); - segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); - segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory()); - segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory()); +// segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); +// segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); +// segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory()); +// segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory()); } private void graphCreate(WorkerCreateListener workerCreateListener) { diff --git a/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java b/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java index 060bb88a4..a48c5024b 100644 --- a/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java +++ b/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java @@ -167,7 +167,7 @@ public class SegmentParse { segment.setDataBinary(dataBinary); segment.setTimeBucket(timeBucket); Graph graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.SEGMENT_PERSISTENCE_GRAPH_ID, Segment.class); - graph.start(segment); +// graph.start(segment); } private void writeToBufferFile(String id, UpstreamSegment upstreamSegment) { diff --git a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/AbstractData.java b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/AbstractData.java index 51f2a3f08..6524dc9ed 100644 --- a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/AbstractData.java +++ b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/AbstractData.java @@ -26,28 +26,24 @@ public abstract class AbstractData { private Long[] dataLongs; private Double[] dataDoubles; private Integer[] dataIntegers; - private Boolean[] dataBooleans; private byte[][] dataBytes; private final Column[] stringColumns; private final Column[] longColumns; private final Column[] doubleColumns; private final Column[] integerColumns; - private final Column[] booleanColumns; private final Column[] byteColumns; public AbstractData(Column[] stringColumns, Column[] longColumns, Column[] doubleColumns, - Column[] integerColumns, Column[] booleanColumns, Column[] byteColumns) { + Column[] integerColumns, Column[] byteColumns) { this.dataStrings = new String[stringColumns.length]; this.dataLongs = new Long[longColumns.length]; this.dataDoubles = new Double[doubleColumns.length]; this.dataIntegers = new Integer[integerColumns.length]; - this.dataBooleans = new Boolean[booleanColumns.length]; this.dataBytes = new byte[byteColumns.length][]; this.stringColumns = stringColumns; this.longColumns = longColumns; this.doubleColumns = doubleColumns; this.integerColumns = integerColumns; - this.booleanColumns = booleanColumns; this.byteColumns = byteColumns; } @@ -67,10 +63,6 @@ public abstract class AbstractData { return dataIntegers.length; } - public final int getDataBooleansCount() { - return dataBooleans.length; - } - public final int getDataBytesCount() { return dataBytes.length; } @@ -91,10 +83,6 @@ public abstract class AbstractData { dataIntegers[position] = value; } - public final void setDataBoolean(int position, Boolean value) { - dataBooleans[position] = value; - } - public final void setDataBytes(int position, byte[] dataBytes) { this.dataBytes[position] = dataBytes; } @@ -133,10 +121,6 @@ public abstract class AbstractData { } } - public final Boolean getDataBoolean(int position) { - return dataBooleans[position]; - } - public final byte[] getDataBytes(int position) { return dataBytes[position]; } @@ -158,10 +142,6 @@ public abstract class AbstractData { Integer integerData = integerColumns[i].getOperation().operate(newData.getDataInteger(i), this.getDataInteger(i)); this.dataIntegers[i] = integerData; } - for (int i = 0; i < booleanColumns.length; i++) { - Boolean booleanData = booleanColumns[i].getOperation().operate(newData.getDataBoolean(i), this.getDataBoolean(i)); - this.dataBooleans[i] = booleanData; - } for (int i = 0; i < byteColumns.length; i++) { byte[] byteData = byteColumns[i].getOperation().operate(newData.getDataBytes(i), this.getDataBytes(i)); this.dataBytes[i] = byteData; @@ -186,10 +166,6 @@ public abstract class AbstractData { for (Integer dataInteger : dataIntegers) { dataStr.append(dataInteger).append(","); } - dataStr.append("], boolean: ["); - for (Boolean dataBoolean : dataBooleans) { - dataStr.append(dataBoolean).append(","); - } dataStr.append("]"); return dataStr.toString(); } diff --git a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/Data.java b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/Data.java index f93b68f07..862615433 100644 --- a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/Data.java +++ b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/Data.java @@ -30,8 +30,6 @@ public interface Data { int getDataIntegersCount(); - int getDataBooleansCount(); - int getDataBytesCount(); void setDataString(int position, String value); @@ -42,8 +40,6 @@ public interface Data { void setDataInteger(int position, Integer value); - void setDataBoolean(int position, Boolean value); - void setDataBytes(int position, byte[] dataBytes); String getDataString(int position); @@ -54,7 +50,5 @@ public interface Data { Integer getDataInteger(int position); - Boolean getDataBoolean(int position); - byte[] getDataBytes(int position); } diff --git a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/StreamData.java b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/StreamData.java index f5fb8eade..faf127eb5 100644 --- a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/StreamData.java +++ b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/data/StreamData.java @@ -36,8 +36,8 @@ public abstract class StreamData extends AbstractData implements RemoteData, Que } public StreamData(Column[] stringColumns, Column[] longColumns, Column[] doubleColumns, - Column[] integerColumns, Column[] booleanColumns, Column[] byteColumns) { - super(stringColumns, longColumns, doubleColumns, integerColumns, booleanColumns, byteColumns); + Column[] integerColumns, Column[] byteColumns) { + super(stringColumns, longColumns, doubleColumns, integerColumns, byteColumns); } @Override public final String selectKey() { diff --git a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/BooleanUtils.java b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/BooleanUtils.java new file mode 100644 index 000000000..24341aea0 --- /dev/null +++ b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/BooleanUtils.java @@ -0,0 +1,48 @@ +/* + * 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.core.util; + +import org.apache.skywalking.apm.collector.core.UnexpectedException; + +/** + * @author peng-yongsheng + */ +public class BooleanUtils { + + public static final Integer TRUE = 1; + public static final Integer FALSE = 0; + + public static boolean valueToBoolean(Integer value) { + if (TRUE.equals(value)) { + return true; + } else if (FALSE.equals(value)) { + return false; + } else { + throw new UnexpectedException("Boolean value error, must be 0 or 1"); + } + } + + public static Integer booleanToValue(Boolean booleanValue) { + if (booleanValue) { + return TRUE; + } else { + return FALSE; + } + } +} diff --git a/apm-collector/apm-collector-remote/collector-remote-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/remote/grpc/service/GRPCRemoteDeserializeService.java b/apm-collector/apm-collector-remote/collector-remote-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/remote/grpc/service/GRPCRemoteDeserializeService.java index 4ef7e5eed..47aecad03 100644 --- a/apm-collector/apm-collector-remote/collector-remote-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/remote/grpc/service/GRPCRemoteDeserializeService.java +++ b/apm-collector/apm-collector-remote/collector-remote-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/remote/grpc/service/GRPCRemoteDeserializeService.java @@ -37,9 +37,6 @@ public class GRPCRemoteDeserializeService implements RemoteDeserializeService { - - public MemoryPoolSecondMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public MemoryPoolMetric get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(MemoryPoolMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(MemoryPoolMetricTable.COLUMN_ID, data.getId()); - source.put(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, data.getInstanceId()); - source.put(MemoryPoolMetricTable.COLUMN_POOL_TYPE, data.getPoolType()); - source.put(MemoryPoolMetricTable.COLUMN_INIT, data.getInit()); - source.put(MemoryPoolMetricTable.COLUMN_MAX, data.getMax()); - source.put(MemoryPoolMetricTable.COLUMN_USED, data.getUsed()); - source.put(MemoryPoolMetricTable.COLUMN_COMMITTED, data.getCommitted()); - source.put(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchInsertSql(MemoryPoolMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(MemoryPoolMetric data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemorySecondMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemorySecondMetricH2PersistenceDAO.java deleted file mode 100644 index b5115d43a..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemorySecondMetricH2PersistenceDAO.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; -import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; - -/** - * @author peng-yongsheng, clevertension - */ -public class MemorySecondMetricH2PersistenceDAO extends H2DAO implements IMemorySecondMetricPersistenceDAO { - - public MemorySecondMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public MemoryMetric get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(MemoryMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(MemoryMetricTable.COLUMN_ID, data.getId()); - source.put(MemoryMetricTable.COLUMN_INSTANCE_ID, data.getInstanceId()); - source.put(MemoryMetricTable.COLUMN_IS_HEAP, data.getIsHeap()); - source.put(MemoryMetricTable.COLUMN_INIT, data.getInit()); - source.put(MemoryMetricTable.COLUMN_MAX, data.getMax()); - source.put(MemoryMetricTable.COLUMN_USED, data.getUsed()); - source.put(MemoryMetricTable.COLUMN_COMMITTED, data.getCommitted()); - source.put(MemoryMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchInsertSql(MemoryMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(MemoryMetric data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/AbstractApplicationComponentH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/AbstractApplicationComponentH2PersistenceDAO.java new file mode 100644 index 000000000..c08156682 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/AbstractApplicationComponentH2PersistenceDAO.java @@ -0,0 +1,60 @@ +/* + * 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.acp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationComponentH2PersistenceDAO extends AbstractPersistenceH2DAO { + + AbstractApplicationComponentH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final ApplicationComponent h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationComponent applicationComponent = new ApplicationComponent(); + applicationComponent.setId(resultSet.getString(ApplicationComponentTable.COLUMN_ID)); + applicationComponent.setMetricId(resultSet.getString(ApplicationComponentTable.COLUMN_METRIC_ID)); + + applicationComponent.setComponentId(resultSet.getInt(ApplicationComponentTable.COLUMN_COMPONENT_ID)); + applicationComponent.setPeerId(resultSet.getInt(ApplicationComponentTable.COLUMN_PEER_ID)); + applicationComponent.setTimeBucket(resultSet.getLong(ApplicationComponentTable.COLUMN_TIME_BUCKET)); + return applicationComponent; + } + + @Override protected final Map streamDataToH2Data(ApplicationComponent streamData) { + Map source = new HashMap<>(); + source.put(ApplicationComponentTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ApplicationComponentTable.COLUMN_COMPONENT_ID, streamData.getComponentId()); + source.put(ApplicationComponentTable.COLUMN_PEER_ID, streamData.getPeerId()); + source.put(ApplicationComponentTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentDayH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentDayH2PersistenceDAO.java new file mode 100644 index 000000000..292af6c73 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentDayH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.acp; + +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.acp.IApplicationComponentDayPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationComponentDayH2PersistenceDAO extends AbstractApplicationComponentH2PersistenceDAO implements IApplicationComponentDayPersistenceDAO { + + public ApplicationComponentDayH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentHourH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentHourH2PersistenceDAO.java new file mode 100644 index 000000000..f83827ccd --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentHourH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.acp; + +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.acp.IApplicationComponentHourPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationComponentHourH2PersistenceDAO extends AbstractApplicationComponentH2PersistenceDAO implements IApplicationComponentHourPersistenceDAO { + + public ApplicationComponentHourH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMinuteH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMinuteH2PersistenceDAO.java new file mode 100644 index 000000000..592ae3431 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMinuteH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.acp; + +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.acp.IApplicationComponentMinutePersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationComponentMinuteH2PersistenceDAO extends AbstractApplicationComponentH2PersistenceDAO implements IApplicationComponentMinutePersistenceDAO { + + public ApplicationComponentMinuteH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMonthH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMonthH2PersistenceDAO.java new file mode 100644 index 000000000..11aa6707f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/acp/ApplicationComponentMonthH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.acp; + +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.acp.IApplicationComponentMonthPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationComponentMonthH2PersistenceDAO extends AbstractApplicationComponentH2PersistenceDAO implements IApplicationComponentMonthPersistenceDAO { + + public ApplicationComponentMonthH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ApplicationH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ApplicationH2CacheDAO.java new file mode 100644 index 000000000..051eb91ff --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ApplicationH2CacheDAO.java @@ -0,0 +1,94 @@ +/* + * 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.cache; + +import java.sql.ResultSet; +import java.sql.SQLException; +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.util.Const; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; +import org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationH2CacheDAO extends H2DAO implements IApplicationCacheDAO { + + private final Logger logger = LoggerFactory.getLogger(ApplicationH2CacheDAO.class); + + private static final String GET_APPLICATION_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ?"; + private static final String GET_APPLICATION_CODE_SQL = "select {0} from {1} where {2} = ?"; + + public ApplicationH2CacheDAO(H2Client client) { + super(client); + } + + @Override + public int getApplicationIdByCode(String applicationCode) { + logger.info("get the application id with application code = {}", applicationCode); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, ApplicationTable.COLUMN_APPLICATION_ID, ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_CODE, ApplicationTable.COLUMN_IS_ADDRESS); + + Object[] params = new Object[] {applicationCode, false}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(1); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } + + @Override public String getApplicationCode(int applicationId) { + logger.debug("get application code, applicationId: {}", applicationId); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_APPLICATION_CODE_SQL, ApplicationTable.COLUMN_APPLICATION_CODE, ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); + Object[] params = new Object[] {applicationId}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getString(1); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return Const.EMPTY_STRING; + } + + @Override public int getApplicationIdByAddressId(int addressId) { + logger.info("get the application id with address id = {}", addressId); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, ApplicationTable.COLUMN_APPLICATION_ID, ApplicationTable.TABLE, ApplicationTable.COLUMN_ADDRESS_ID, ApplicationTable.COLUMN_IS_ADDRESS); + + Object[] params = new Object[] {addressId, true}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(1); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/InstanceH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/InstanceH2CacheDAO.java new file mode 100644 index 000000000..2a0411f77 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/InstanceH2CacheDAO.java @@ -0,0 +1,93 @@ +/* + * 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.cache; + +import java.sql.ResultSet; +import java.sql.SQLException; +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.util.BooleanUtils; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; +import org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng + */ +public class InstanceH2CacheDAO extends H2DAO implements IInstanceCacheDAO { + + private final Logger logger = LoggerFactory.getLogger(InstanceH2CacheDAO.class); + + private static final String GET_APPLICATION_ID_SQL = "select {0} from {1} where {2} = ?"; + private static final String GET_INSTANCE_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ? and {4} = ?"; + + public InstanceH2CacheDAO(H2Client client) { + super(client); + } + + @Override public int getApplicationId(int instanceId) { + logger.info("get the application id by instance id = {}", instanceId); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, InstanceTable.COLUMN_APPLICATION_ID, InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); + Object[] params = new Object[] {instanceId}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(InstanceTable.COLUMN_APPLICATION_ID); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } + + @Override public int getInstanceIdByAgentUUID(int applicationId, String agentUUID) { + logger.info("get the instance id by application id = {}, agentUUID = {}", applicationId, agentUUID); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_INSTANCE_ID_SQL, InstanceTable.COLUMN_INSTANCE_ID, InstanceTable.TABLE, InstanceTable.COLUMN_APPLICATION_ID, + InstanceTable.COLUMN_AGENT_UUID, InstanceTable.COLUMN_IS_ADDRESS); + Object[] params = new Object[] {applicationId, agentUUID, BooleanUtils.FALSE}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(InstanceTable.COLUMN_INSTANCE_ID); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } + + @Override public int getInstanceIdByAddressId(int applicationId, int addressId) { + logger.info("get the instance id by application id = {}, address id = {}", applicationId, addressId); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_INSTANCE_ID_SQL, InstanceTable.COLUMN_INSTANCE_ID, InstanceTable.TABLE, InstanceTable.COLUMN_APPLICATION_ID, + InstanceTable.COLUMN_ADDRESS_ID, InstanceTable.COLUMN_IS_ADDRESS); + Object[] params = new Object[] {applicationId, addressId, BooleanUtils.TRUE}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(InstanceTable.COLUMN_INSTANCE_ID); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/NetworkAddressH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/NetworkAddressH2CacheDAO.java new file mode 100644 index 000000000..d9aca53a0 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/NetworkAddressH2CacheDAO.java @@ -0,0 +1,77 @@ +/* + * 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.cache; + +import java.sql.ResultSet; +import java.sql.SQLException; +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.util.Const; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; +import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.table.register.NetworkAddressTable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng, clevertension + */ +public class NetworkAddressH2CacheDAO extends H2DAO implements INetworkAddressCacheDAO { + + private final Logger logger = LoggerFactory.getLogger(NetworkAddressH2CacheDAO.class); + + private static final String GET_ADDRESS_ID_OR_CODE_SQL = "select {0} from {1} where {2} = ?"; + + public NetworkAddressH2CacheDAO(H2Client client) { + super(client); + } + + @Override + public int getAddressId(String networkAddress) { + logger.info("get the address id with network address = {}", networkAddress); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_ADDRESS_ID_OR_CODE_SQL, NetworkAddressTable.COLUMN_ADDRESS_ID, NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_NETWORK_ADDRESS); + + Object[] params = new Object[] {networkAddress}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(1); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } + + @Override public String getAddress(int addressId) { + logger.debug("get network address, address id: {}", addressId); + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_ADDRESS_ID_OR_CODE_SQL, NetworkAddressTable.COLUMN_NETWORK_ADDRESS, NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID); + Object[] params = new Object[] {addressId}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getString(1); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return Const.EMPTY_STRING; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ServiceNameH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ServiceNameH2CacheDAO.java new file mode 100644 index 000000000..dd5de4ab7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/cache/ServiceNameH2CacheDAO.java @@ -0,0 +1,79 @@ +/* + * 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.cache; + +import java.sql.ResultSet; +import java.sql.SQLException; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; +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.dao.cache.IServiceNameCacheDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.table.register.ServiceNameTable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng, clevertension + */ +public class ServiceNameH2CacheDAO extends H2DAO implements IServiceNameCacheDAO { + + private final Logger logger = LoggerFactory.getLogger(ServiceNameH2CacheDAO.class); + + private static final String GET_SERVICE_NAME_SQL = "select {0},{1} from {2} where {3} = ?"; + private static final String GET_SERVICE_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ? limit 1"; + + public ServiceNameH2CacheDAO(H2Client client) { + super(client); + } + + @Override public String getServiceName(int serviceId) { + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_SERVICE_NAME_SQL, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME, + ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); + Object[] params = new Object[] {serviceId}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + String serviceName = rs.getString(ServiceNameTable.COLUMN_SERVICE_NAME); + int applicationId = rs.getInt(ServiceNameTable.COLUMN_APPLICATION_ID); + return applicationId + Const.ID_SPLIT + serviceName; + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return Const.EMPTY_STRING; + } + + @Override public int getServiceId(int applicationId, String serviceName) { + H2Client client = getClient(); + String sql = SqlBuilder.buildSql(GET_SERVICE_ID_SQL, ServiceNameTable.COLUMN_SERVICE_ID, + ServiceNameTable.TABLE, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME); + Object[] params = new Object[] {applicationId, serviceName}; + try (ResultSet rs = client.executeQuery(sql, params)) { + if (rs.next()) { + return rs.getInt(ServiceNameTable.COLUMN_SERVICE_ID); + } + } catch (SQLException | H2ClientException e) { + logger.error(e.getMessage(), e); + } + return 0; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryPoolMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryPoolMetricH2TableDefine.java deleted file mode 100644 index f15f17b5f..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/MemoryPoolMetricH2TableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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; - -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricH2TableDefine extends H2TableDefine { - - public MemoryPoolMetricH2TableDefine() { - super(MemoryPoolMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_POOL_TYPE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_COMMITTED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentCostH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentCostH2TableDefine.java index c0724d563..bc51a2d56 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentCostH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentCostH2TableDefine.java @@ -16,11 +16,10 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.define; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; 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.segment.SegmentCostTable; /** @@ -40,7 +39,7 @@ public class SegmentCostH2TableDefine extends H2TableDefine { addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_COST, H2ColumnDefine.Type.Bigint.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_START_TIME, H2ColumnDefine.Type.Bigint.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_END_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_IS_ERROR, H2ColumnDefine.Type.Boolean.name())); + addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_IS_ERROR, H2ColumnDefine.Type.Int.name())); addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/AbstractApplicationComponentH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/AbstractApplicationComponentH2TableDefine.java new file mode 100644 index 000000000..570dcc7f7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/AbstractApplicationComponentH2TableDefine.java @@ -0,0 +1,41 @@ +/* + * 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.appcomp; + +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.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationComponentH2TableDefine extends H2TableDefine { + + AbstractApplicationComponentH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_COMPONENT_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_PEER_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentDayH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentDayH2TableDefine.java new file mode 100644 index 000000000..3701b831e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentDayH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appcomp; + +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.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentDayH2TableDefine extends AbstractApplicationComponentH2TableDefine { + + public ApplicationComponentDayH2TableDefine() { + super(ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentHourH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentHourH2TableDefine.java new file mode 100644 index 000000000..a28292f5e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentHourH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appcomp; + +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.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentHourH2TableDefine extends AbstractApplicationComponentH2TableDefine { + + public ApplicationComponentHourH2TableDefine() { + super(ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMinuteH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMinuteH2TableDefine.java new file mode 100644 index 000000000..62412d3eb --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMinuteH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appcomp; + +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.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMinuteH2TableDefine extends AbstractApplicationComponentH2TableDefine { + + public ApplicationComponentMinuteH2TableDefine() { + super(ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMonthH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMonthH2TableDefine.java new file mode 100644 index 000000000..e4c7f2c7b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appcomp/ApplicationComponentMonthH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appcomp; + +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.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMonthH2TableDefine extends AbstractApplicationComponentH2TableDefine { + + public ApplicationComponentMonthH2TableDefine() { + super(ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java index cecb25861..d836756ba 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/memory/AbstractMemoryMetricH2TableDefine.java @@ -35,7 +35,7 @@ public abstract class AbstractMemoryMetricH2TableDefine extends H2TableDefine { addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, H2ColumnDefine.Type.Boolean.name())); + addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, H2ColumnDefine.Type.Int.name())); addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java index 6936ed032..62ef7fd27 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/ApplicationH2TableDefine.java @@ -36,6 +36,6 @@ public class ApplicationH2TableDefine extends H2TableDefine { 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())); + addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_IS_ADDRESS, H2ColumnDefine.Type.Int.name())); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java index 38a49db3c..2b763d17f 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/register/InstanceH2TableDefine.java @@ -40,6 +40,6 @@ public class InstanceH2TableDefine extends H2TableDefine { 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())); + addColumn(new H2ColumnDefine(InstanceTable.COLUMN_IS_ADDRESS, H2ColumnDefine.Type.Int.name())); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index 2d97a3887..ae74743e6 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -25,4 +25,9 @@ org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolSecondMetr org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolMinuteMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolHourMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolDayMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolMonthMetricH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentMinuteH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentHourH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentDayH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentMonthH2TableDefine \ No newline at end of file From 25fb26920588877581565f30c5d066693f33ff88 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 20:15:37 +0800 Subject: [PATCH 11/18] Instance mapping pyramid aggregate by h2 storage test successful. --- .../AnalysisMetricModuleProvider.java | 7 +- .../apm/collector/storage/StorageModule.java | 28 +++-- .../storage/h2/StorageModuleH2Provider.java | 28 ++++- ...cationComponentH2MinutePersistenceDAO.java | 101 ----------------- .../storage/h2/dao/ApplicationH2CacheDAO.java | 94 ---------------- ...licationMappingH2MinutePersistenceDAO.java | 99 ----------------- .../storage/h2/dao/InstanceH2CacheDAO.java | 92 ---------------- ...InstanceMappingH2MinutePersistenceDAO.java | 102 ------------------ .../h2/dao/NetworkAddressH2CacheDAO.java | 77 ------------- .../storage/h2/dao/ServiceNameH2CacheDAO.java | 79 -------------- ...actApplicationMappingH2PersistenceDAO.java | 60 +++++++++++ ...ApplicationMappingDayH2PersistenceDAO.java | 41 +++++++ ...pplicationMappingHourH2PersistenceDAO.java | 41 +++++++ ...licationMappingMinuteH2PersistenceDAO.java | 41 +++++++ ...plicationMappingMonthH2PersistenceDAO.java | 41 +++++++ ...stractInstanceMappingH2PersistenceDAO.java | 62 +++++++++++ .../InstanceMappingDayH2PersistenceDAO.java | 41 +++++++ .../InstanceMappingHourH2PersistenceDAO.java | 41 +++++++ ...InstanceMappingMinuteH2PersistenceDAO.java | 41 +++++++ .../InstanceMappingMonthH2PersistenceDAO.java | 41 +++++++ ...stractApplicationMappingH2TableDefine.java | 41 +++++++ .../ApplicationMappingDayH2TableDefine.java | 33 ++++++ .../ApplicationMappingHourH2TableDefine.java | 33 ++++++ ...ApplicationMappingMinuteH2TableDefine.java | 33 ++++++ .../ApplicationMappingMonthH2TableDefine.java | 33 ++++++ .../AbstractInstanceMappingH2TableDefine.java | 42 ++++++++ .../InstanceMappingDayH2TableDefine.java | 33 ++++++ .../InstanceMappingHourH2TableDefine.java | 33 ++++++ .../InstanceMappingMinuteH2TableDefine.java | 33 ++++++ .../InstanceMappingMonthH2TableDefine.java | 33 ++++++ .../resources/META-INF/defines/storage.define | 12 ++- 31 files changed, 854 insertions(+), 662 deletions(-) delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2CacheDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMappingH2MinutePersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2CacheDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMappingH2MinutePersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressH2CacheDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2CacheDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/AbstractApplicationMappingH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingDayH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingHourH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMinuteH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMonthH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/AbstractInstanceMappingH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingDayH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingHourH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMinuteH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMonthH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/AbstractApplicationMappingH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingDayH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingHourH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMinuteH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMonthH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/AbstractInstanceMappingH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingDayH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingHourH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMinuteH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMonthH2TableDefine.java diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java index 4fb61d2d5..d5dc49bdc 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java @@ -29,17 +29,14 @@ import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.appli import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric.ApplicationMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric.ApplicationReferenceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceGraph; -import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.heartbeat.InstanceHeartBeatPersistenceGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping.InstanceMappingGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping.InstanceMappingSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.metric.InstanceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.refmetric.InstanceReferenceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment.SegmentCostGraph; -import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment.SegmentCostSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.metric.ServiceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric.ServiceReferenceMetricGraph; -import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric.ServiceReferenceMetricSpanListener; import org.apache.skywalking.apm.collector.analysis.segment.parser.define.AnalysisSegmentParserModule; import org.apache.skywalking.apm.collector.analysis.segment.parser.define.service.ISegmentParserListenerRegister; import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener; @@ -90,8 +87,8 @@ public class AnalysisMetricModuleProvider extends ModuleProvider { ISegmentParserListenerRegister segmentParserListenerRegister = getManager().find(AnalysisSegmentParserModule.NAME).getService(ISegmentParserListenerRegister.class); // segmentParserListenerRegister.register(new ServiceReferenceMetricSpanListener.Factory()); segmentParserListenerRegister.register(new ApplicationComponentSpanListener.Factory()); -// segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); -// segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); + segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); + segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); // segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory()); // segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory()); } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index acc38cdf3..6085d62a1 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -39,6 +39,10 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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.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.cache.IApplicationCacheDAO; import org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO; import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO; @@ -53,6 +57,10 @@ import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersist 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.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.memorymp.IMemoryDayMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMinuteMetricPersistenceDAO; @@ -136,16 +144,16 @@ public class StorageModule extends Module { classes.add(IApplicationComponentDayPersistenceDAO.class); classes.add(IApplicationComponentMonthPersistenceDAO.class); -// classes.add(IApplicationMappingMinutePersistenceDAO.class); -// classes.add(IApplicationMappingHourPersistenceDAO.class); -// classes.add(IApplicationMappingDayPersistenceDAO.class); -// classes.add(IApplicationMappingMonthPersistenceDAO.class); -// -// classes.add(IInstanceMappingMinutePersistenceDAO.class); -// classes.add(IInstanceMappingHourPersistenceDAO.class); -// classes.add(IInstanceMappingDayPersistenceDAO.class); -// classes.add(IInstanceMappingMonthPersistenceDAO.class); -// + classes.add(IApplicationMappingMinutePersistenceDAO.class); + classes.add(IApplicationMappingHourPersistenceDAO.class); + classes.add(IApplicationMappingDayPersistenceDAO.class); + classes.add(IApplicationMappingMonthPersistenceDAO.class); + + classes.add(IInstanceMappingMinutePersistenceDAO.class); + classes.add(IInstanceMappingHourPersistenceDAO.class); + classes.add(IInstanceMappingDayPersistenceDAO.class); + classes.add(IInstanceMappingMonthPersistenceDAO.class); + // classes.add(IGlobalTracePersistenceDAO.class); // // classes.add(IApplicationMinuteMetricPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index f6812b3ff..2c382faab 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -44,6 +44,10 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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.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.cache.IApplicationCacheDAO; import org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO; import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO; @@ -58,6 +62,10 @@ import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersist 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.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.memorymp.IMemoryDayMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMinuteMetricPersistenceDAO; @@ -91,6 +99,10 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationCompone import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentHourH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMinuteH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMonthH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingDayH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingHourH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingMinuteH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingMonthH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.cache.ApplicationH2CacheDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.cache.InstanceH2CacheDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.cache.NetworkAddressH2CacheDAO; @@ -105,6 +117,10 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCHourMetricH2Per import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMinuteMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCSecondMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingDayH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingHourH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingMinuteH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingMonthH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryDayMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryHourMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryMinuteMetricH2PersistenceDAO; @@ -222,7 +238,16 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IApplicationComponentDayPersistenceDAO.class, new ApplicationComponentDayH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentMonthPersistenceDAO.class, new ApplicationComponentMonthH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingH2MinutePersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingMinuteH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationMappingHourPersistenceDAO.class, new ApplicationMappingHourH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationMappingDayPersistenceDAO.class, new ApplicationMappingDayH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationMappingMonthPersistenceDAO.class, new ApplicationMappingMonthH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IInstanceMappingMinutePersistenceDAO.class, new InstanceMappingMinuteH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceMappingHourPersistenceDAO.class, new InstanceMappingHourH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceMappingDayPersistenceDAO.class, new InstanceMappingDayH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceMappingMonthPersistenceDAO.class, new InstanceMappingMonthH2PersistenceDAO(h2Client)); + // this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client)); @@ -232,7 +257,6 @@ public class StorageModuleH2Provider extends ModuleProvider { // // this.registerServiceImplementation(IInstanceMinuteMetricPersistenceDAO.class, new InstanceMinuteMetricH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IInstanceReferenceMinuteMetricPersistenceDAO.class, new InstanceReferenceMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceMappingMinutePersistenceDAO.class, new InstanceMappingH2MinutePersistenceDAO(h2Client)); // this.registerServiceImplementation(IInstanceHeartBeatPersistenceDAO.class, new InstanceHeartBeatH2PersistenceDAO(h2Client)); } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java deleted file mode 100644 index a2dfc1c4d..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationComponentH2MinutePersistenceDAO extends H2DAO implements IApplicationComponentMinutePersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(ApplicationComponentH2MinutePersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public ApplicationComponentH2MinutePersistenceDAO(H2Client client) { - super(client); - } - - @Override - public ApplicationComponent get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ApplicationComponentTable.TABLE, ApplicationComponentTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - ApplicationComponent applicationComponent = new ApplicationComponent(); - applicationComponent.setId(id); - applicationComponent.setComponentId(rs.getInt(ApplicationComponentTable.COLUMN_COMPONENT_ID)); - applicationComponent.setPeerId(rs.getInt(ApplicationComponentTable.COLUMN_PEER_ID)); - applicationComponent.setTimeBucket(rs.getLong(ApplicationComponentTable.COLUMN_TIME_BUCKET)); - return applicationComponent; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public H2SqlEntity prepareBatchInsert(ApplicationComponent data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationComponentTable.COLUMN_ID, data.getId()); - source.put(ApplicationComponentTable.COLUMN_COMPONENT_ID, data.getComponentId()); - source.put(ApplicationComponentTable.COLUMN_PEER_ID, data.getPeerId()); - source.put(ApplicationComponentTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchInsertSql(ApplicationComponentTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override - public H2SqlEntity prepareBatchUpdate(ApplicationComponent data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationComponentTable.COLUMN_COMPONENT_ID, data.getComponentId()); - source.put(ApplicationComponentTable.COLUMN_PEER_ID, data.getPeerId()); - source.put(ApplicationComponentTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(ApplicationComponentTable.TABLE, source.keySet(), ApplicationComponentTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2CacheDAO.java deleted file mode 100644 index c94863ee8..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationH2CacheDAO.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -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.util.Const; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationH2CacheDAO extends H2DAO implements IApplicationCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationH2CacheDAO.class); - - private static final String GET_APPLICATION_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ?"; - private static final String GET_APPLICATION_CODE_SQL = "select {0} from {1} where {2} = ?"; - - public ApplicationH2CacheDAO(H2Client client) { - super(client); - } - - @Override - public int getApplicationIdByCode(String applicationCode) { - logger.info("get the application id with application code = {}", applicationCode); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, ApplicationTable.COLUMN_APPLICATION_ID, ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_CODE, ApplicationTable.COLUMN_IS_ADDRESS); - - Object[] params = new Object[] {applicationCode, false}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public String getApplicationCode(int applicationId) { - logger.debug("get application code, applicationId: {}", applicationId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_CODE_SQL, ApplicationTable.COLUMN_APPLICATION_CODE, ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); - Object[] params = new Object[] {applicationId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getString(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return Const.EMPTY_STRING; - } - - @Override public int getApplicationIdByAddressId(int addressId) { - logger.info("get the application id with address id = {}", addressId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, ApplicationTable.COLUMN_APPLICATION_ID, ApplicationTable.TABLE, ApplicationTable.COLUMN_ADDRESS_ID, ApplicationTable.COLUMN_IS_ADDRESS); - - Object[] params = new Object[] {addressId, true}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMappingH2MinutePersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMappingH2MinutePersistenceDAO.java deleted file mode 100644 index ec35a05a9..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMappingH2MinutePersistenceDAO.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationMappingH2MinutePersistenceDAO extends H2DAO implements IApplicationMappingMinutePersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationMappingH2MinutePersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public ApplicationMappingH2MinutePersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationMapping get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ApplicationMappingTable.TABLE, ApplicationMappingTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - ApplicationMapping applicationMapping = new ApplicationMapping(); - applicationMapping.setId(id); - applicationMapping.setApplicationId(rs.getInt(ApplicationMappingTable.COLUMN_APPLICATION_ID)); - applicationMapping.setAddressId(rs.getInt(ApplicationMappingTable.COLUMN_ADDRESS_ID)); - applicationMapping.setTimeBucket(rs.getLong(ApplicationMappingTable.COLUMN_TIME_BUCKET)); - return applicationMapping; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationMapping applicationMapping) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationMappingTable.COLUMN_ID, applicationMapping.getId()); - source.put(ApplicationMappingTable.COLUMN_APPLICATION_ID, applicationMapping.getApplicationId()); - source.put(ApplicationMappingTable.COLUMN_ADDRESS_ID, applicationMapping.getAddressId()); - source.put(ApplicationMappingTable.COLUMN_TIME_BUCKET, applicationMapping.getTimeBucket()); - String sql = SqlBuilder.buildBatchInsertSql(ApplicationMappingTable.TABLE, source.keySet()); - entity.setSql(sql); - - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationMapping applicationMapping) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationMappingTable.COLUMN_APPLICATION_ID, applicationMapping.getApplicationId()); - source.put(ApplicationMappingTable.COLUMN_ADDRESS_ID, applicationMapping.getAddressId()); - source.put(ApplicationMappingTable.COLUMN_TIME_BUCKET, applicationMapping.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(ApplicationMappingTable.TABLE, source.keySet(), ApplicationMappingTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(applicationMapping.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2CacheDAO.java deleted file mode 100644 index e02b4f738..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2CacheDAO.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -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.cache.IInstanceCacheDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceH2CacheDAO extends H2DAO implements IInstanceCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceH2CacheDAO.class); - - private static final String GET_APPLICATION_ID_SQL = "select {0} from {1} where {2} = ?"; - private static final String GET_INSTANCE_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ? and {4} = ?"; - - public InstanceH2CacheDAO(H2Client client) { - super(client); - } - - @Override public int getApplicationId(int instanceId) { - logger.info("get the application id by instance id = {}", instanceId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, InstanceTable.COLUMN_APPLICATION_ID, InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - Object[] params = new Object[] {instanceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(InstanceTable.COLUMN_APPLICATION_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public int getInstanceIdByAgentUUID(int applicationId, String agentUUID) { - logger.info("get the instance id by application id = {}, agentUUID = {}", applicationId, agentUUID); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_INSTANCE_ID_SQL, InstanceTable.COLUMN_INSTANCE_ID, InstanceTable.TABLE, InstanceTable.COLUMN_APPLICATION_ID, - InstanceTable.COLUMN_AGENT_UUID, InstanceTable.COLUMN_IS_ADDRESS); - Object[] params = new Object[] {applicationId, agentUUID, false}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(InstanceTable.COLUMN_INSTANCE_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public int getInstanceIdByAddressId(int applicationId, int addressId) { - logger.info("get the instance id by application id = {}, address id = {}", applicationId, addressId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_INSTANCE_ID_SQL, InstanceTable.COLUMN_INSTANCE_ID, InstanceTable.TABLE, InstanceTable.COLUMN_APPLICATION_ID, - InstanceTable.COLUMN_AGENT_UUID, InstanceTable.COLUMN_IS_ADDRESS); - Object[] params = new Object[] {applicationId, addressId, true}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(InstanceTable.COLUMN_INSTANCE_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMappingH2MinutePersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMappingH2MinutePersistenceDAO.java deleted file mode 100644 index d5e0a57f3..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMappingH2MinutePersistenceDAO.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMinutePersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping; -import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappingTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceMappingH2MinutePersistenceDAO extends H2DAO implements IInstanceMappingMinutePersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceMappingH2MinutePersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public InstanceMappingH2MinutePersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceMapping get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, InstanceMappingTable.TABLE, InstanceMappingTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - InstanceMapping instanceMapping = new InstanceMapping(); - instanceMapping.setId(id); - instanceMapping.setApplicationId(rs.getInt(InstanceMappingTable.COLUMN_APPLICATION_ID)); - instanceMapping.setInstanceId(rs.getInt(InstanceMappingTable.COLUMN_INSTANCE_ID)); - instanceMapping.setAddressId(rs.getInt(InstanceMappingTable.COLUMN_ADDRESS_ID)); - instanceMapping.setTimeBucket(rs.getLong(InstanceMappingTable.COLUMN_TIME_BUCKET)); - return instanceMapping; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceMapping instanceMapping) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstanceMappingTable.COLUMN_ID, instanceMapping.getId()); - source.put(InstanceMappingTable.COLUMN_APPLICATION_ID, instanceMapping.getApplicationId()); - source.put(InstanceMappingTable.COLUMN_INSTANCE_ID, instanceMapping.getInstanceId()); - source.put(InstanceMappingTable.COLUMN_ADDRESS_ID, instanceMapping.getAddressId()); - source.put(InstanceMappingTable.COLUMN_TIME_BUCKET, instanceMapping.getTimeBucket()); - String sql = SqlBuilder.buildBatchInsertSql(InstanceMappingTable.TABLE, source.keySet()); - entity.setSql(sql); - - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceMapping instanceMapping) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstanceMappingTable.COLUMN_APPLICATION_ID, instanceMapping.getApplicationId()); - source.put(InstanceMappingTable.COLUMN_INSTANCE_ID, instanceMapping.getInstanceId()); - source.put(InstanceMappingTable.COLUMN_ADDRESS_ID, instanceMapping.getAddressId()); - source.put(InstanceMappingTable.COLUMN_TIME_BUCKET, instanceMapping.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(InstanceMappingTable.TABLE, source.keySet(), InstanceMappingTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(instanceMapping.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressH2CacheDAO.java deleted file mode 100644 index 336e191cd..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/NetworkAddressH2CacheDAO.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -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.util.Const; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.table.register.NetworkAddressTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class NetworkAddressH2CacheDAO extends H2DAO implements INetworkAddressCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(NetworkAddressH2CacheDAO.class); - - private static final String GET_ADDRESS_ID_OR_CODE_SQL = "select {0} from {1} where {2} = ?"; - - public NetworkAddressH2CacheDAO(H2Client client) { - super(client); - } - - @Override - public int getAddressId(String networkAddress) { - logger.info("get the address id with network address = {}", networkAddress); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_ADDRESS_ID_OR_CODE_SQL, NetworkAddressTable.COLUMN_ADDRESS_ID, NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_NETWORK_ADDRESS); - - Object[] params = new Object[] {networkAddress}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public String getAddress(int addressId) { - logger.debug("get network address, address id: {}", addressId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_ADDRESS_ID_OR_CODE_SQL, NetworkAddressTable.COLUMN_NETWORK_ADDRESS, NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID); - Object[] params = new Object[] {addressId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getString(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return Const.EMPTY_STRING; - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2CacheDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2CacheDAO.java deleted file mode 100644 index 2db433d1e..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceNameH2CacheDAO.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -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.dao.cache.IServiceNameCacheDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.table.register.ServiceNameTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceNameH2CacheDAO extends H2DAO implements IServiceNameCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameH2CacheDAO.class); - - private static final String GET_SERVICE_NAME_SQL = "select {0},{1} from {2} where {3} = ?"; - private static final String GET_SERVICE_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ? limit 1"; - - public ServiceNameH2CacheDAO(H2Client client) { - super(client); - } - - @Override public String getServiceName(int serviceId) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SERVICE_NAME_SQL, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME, - ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); - Object[] params = new Object[] {serviceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - String serviceName = rs.getString(ServiceNameTable.COLUMN_SERVICE_NAME); - int applicationId = rs.getInt(ServiceNameTable.COLUMN_APPLICATION_ID); - return applicationId + Const.ID_SPLIT + serviceName; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return Const.EMPTY_STRING; - } - - @Override public int getServiceId(int applicationId, String serviceName) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SERVICE_ID_SQL, ServiceNameTable.COLUMN_SERVICE_ID, - ServiceNameTable.TABLE, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME); - Object[] params = new Object[] {applicationId, serviceName}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(ServiceNameTable.COLUMN_SERVICE_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/AbstractApplicationMappingH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/AbstractApplicationMappingH2PersistenceDAO.java new file mode 100644 index 000000000..a2d00ef39 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/AbstractApplicationMappingH2PersistenceDAO.java @@ -0,0 +1,60 @@ +/* + * 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.ampp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationMappingH2PersistenceDAO extends AbstractPersistenceH2DAO { + + AbstractApplicationMappingH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final ApplicationMapping h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationMapping applicationMapping = new ApplicationMapping(); + applicationMapping.setId(resultSet.getString(ApplicationMappingTable.COLUMN_ID)); + applicationMapping.setMetricId(resultSet.getString(ApplicationMappingTable.COLUMN_METRIC_ID)); + + applicationMapping.setApplicationId(resultSet.getInt(ApplicationMappingTable.COLUMN_APPLICATION_ID)); + applicationMapping.setAddressId(resultSet.getInt(ApplicationMappingTable.COLUMN_ADDRESS_ID)); + applicationMapping.setTimeBucket(resultSet.getLong(ApplicationMappingTable.COLUMN_TIME_BUCKET)); + return applicationMapping; + } + + @Override protected final Map streamDataToH2Data(ApplicationMapping streamData) { + Map source = new HashMap<>(); + source.put(ApplicationMappingTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ApplicationMappingTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(ApplicationMappingTable.COLUMN_ADDRESS_ID, streamData.getAddressId()); + source.put(ApplicationMappingTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingDayH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingDayH2PersistenceDAO.java new file mode 100644 index 000000000..3a433a68d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingDayH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.ampp; + +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.ampp.IApplicationMappingDayPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingDayH2PersistenceDAO extends AbstractApplicationMappingH2PersistenceDAO implements IApplicationMappingDayPersistenceDAO { + + public ApplicationMappingDayH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingHourH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingHourH2PersistenceDAO.java new file mode 100644 index 000000000..ca761d24f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingHourH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.ampp; + +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.ampp.IApplicationMappingHourPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingHourH2PersistenceDAO extends AbstractApplicationMappingH2PersistenceDAO implements IApplicationMappingHourPersistenceDAO { + + public ApplicationMappingHourH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMinuteH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMinuteH2PersistenceDAO.java new file mode 100644 index 000000000..d4c1e96e0 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMinuteH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.ampp; + +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.ampp.IApplicationMappingMinutePersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingMinuteH2PersistenceDAO extends AbstractApplicationMappingH2PersistenceDAO implements IApplicationMappingMinutePersistenceDAO { + + public ApplicationMappingMinuteH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMonthH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMonthH2PersistenceDAO.java new file mode 100644 index 000000000..83cc8e12f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ampp/ApplicationMappingMonthH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.ampp; + +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.ampp.IApplicationMappingMonthPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingMonthH2PersistenceDAO extends AbstractApplicationMappingH2PersistenceDAO implements IApplicationMappingMonthPersistenceDAO { + + public ApplicationMappingMonthH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/AbstractInstanceMappingH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/AbstractInstanceMappingH2PersistenceDAO.java new file mode 100644 index 000000000..ef5056713 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/AbstractInstanceMappingH2PersistenceDAO.java @@ -0,0 +1,62 @@ +/* + * 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.impp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractInstanceMappingH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractInstanceMappingH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final InstanceMapping h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceMapping instanceMapping = new InstanceMapping(); + instanceMapping.setId(resultSet.getString(InstanceMappingTable.COLUMN_ID)); + instanceMapping.setMetricId(resultSet.getString(InstanceMappingTable.COLUMN_METRIC_ID)); + + instanceMapping.setApplicationId(resultSet.getInt(InstanceMappingTable.COLUMN_APPLICATION_ID)); + instanceMapping.setInstanceId(resultSet.getInt(InstanceMappingTable.COLUMN_INSTANCE_ID)); + instanceMapping.setAddressId(resultSet.getInt(InstanceMappingTable.COLUMN_ADDRESS_ID)); + instanceMapping.setTimeBucket(resultSet.getLong(InstanceMappingTable.COLUMN_TIME_BUCKET)); + return instanceMapping; + } + + @Override protected final Map streamDataToH2Data(InstanceMapping streamData) { + Map source = new HashMap<>(); + source.put(InstanceMappingTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(InstanceMappingTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(InstanceMappingTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(InstanceMappingTable.COLUMN_ADDRESS_ID, streamData.getAddressId()); + source.put(InstanceMappingTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingDayH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingDayH2PersistenceDAO.java new file mode 100644 index 000000000..4bdcaa297 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingDayH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.impp; + +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.impp.IInstanceMappingDayPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingDayH2PersistenceDAO extends AbstractInstanceMappingH2PersistenceDAO implements IInstanceMappingDayPersistenceDAO { + + public InstanceMappingDayH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingHourH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingHourH2PersistenceDAO.java new file mode 100644 index 000000000..216d41356 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingHourH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.impp; + +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.impp.IInstanceMappingHourPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingHourH2PersistenceDAO extends AbstractInstanceMappingH2PersistenceDAO implements IInstanceMappingHourPersistenceDAO { + + public InstanceMappingHourH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMinuteH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMinuteH2PersistenceDAO.java new file mode 100644 index 000000000..7b0447211 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMinuteH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.impp; + +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.impp.IInstanceMappingMinutePersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingMinuteH2PersistenceDAO extends AbstractInstanceMappingH2PersistenceDAO implements IInstanceMappingMinutePersistenceDAO { + + public InstanceMappingMinuteH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMonthH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMonthH2PersistenceDAO.java new file mode 100644 index 000000000..6718a8625 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/impp/InstanceMappingMonthH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.impp; + +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.impp.IInstanceMappingMonthPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingMonthH2PersistenceDAO extends AbstractInstanceMappingH2PersistenceDAO implements IInstanceMappingMonthPersistenceDAO { + + public InstanceMappingMonthH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/AbstractApplicationMappingH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/AbstractApplicationMappingH2TableDefine.java new file mode 100644 index 000000000..ee5239fb7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/AbstractApplicationMappingH2TableDefine.java @@ -0,0 +1,41 @@ +/* + * 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.appmapping; + +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.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationMappingH2TableDefine extends H2TableDefine { + + public AbstractApplicationMappingH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingDayH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingDayH2TableDefine.java new file mode 100644 index 000000000..102bd949c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingDayH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appmapping; + +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.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingDayH2TableDefine extends AbstractApplicationMappingH2TableDefine { + + public ApplicationMappingDayH2TableDefine() { + super(ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingHourH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingHourH2TableDefine.java new file mode 100644 index 000000000..57e024e04 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingHourH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appmapping; + +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.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingHourH2TableDefine extends AbstractApplicationMappingH2TableDefine { + + public ApplicationMappingHourH2TableDefine() { + super(ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMinuteH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMinuteH2TableDefine.java new file mode 100644 index 000000000..7f7e4a33a --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMinuteH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appmapping; + +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.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingMinuteH2TableDefine extends AbstractApplicationMappingH2TableDefine { + + public ApplicationMappingMinuteH2TableDefine() { + super(ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMonthH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMonthH2TableDefine.java new file mode 100644 index 000000000..41ab8295a --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/appmapping/ApplicationMappingMonthH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.appmapping; + +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.application.ApplicationMappingTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMappingMonthH2TableDefine extends AbstractApplicationMappingH2TableDefine { + + public ApplicationMappingMonthH2TableDefine() { + super(ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/AbstractInstanceMappingH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/AbstractInstanceMappingH2TableDefine.java new file mode 100644 index 000000000..238e0553f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/AbstractInstanceMappingH2TableDefine.java @@ -0,0 +1,42 @@ +/* + * 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.instmapping; + +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.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractInstanceMappingH2TableDefine extends H2TableDefine { + + AbstractInstanceMappingH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingDayH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingDayH2TableDefine.java new file mode 100644 index 000000000..2cdc722da --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingDayH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.instmapping; + +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.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingDayH2TableDefine extends AbstractInstanceMappingH2TableDefine { + + public InstanceMappingDayH2TableDefine() { + super(InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingHourH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingHourH2TableDefine.java new file mode 100644 index 000000000..149e08b69 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingHourH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.instmapping; + +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.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingHourH2TableDefine extends AbstractInstanceMappingH2TableDefine { + + public InstanceMappingHourH2TableDefine() { + super(InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMinuteH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMinuteH2TableDefine.java new file mode 100644 index 000000000..6e1e7a778 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMinuteH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.instmapping; + +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.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingMinuteH2TableDefine extends AbstractInstanceMappingH2TableDefine { + + public InstanceMappingMinuteH2TableDefine() { + super(InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMonthH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMonthH2TableDefine.java new file mode 100644 index 000000000..1405707e3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/instmapping/InstanceMappingMonthH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.instmapping; + +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.instance.InstanceMappingTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMappingMonthH2TableDefine extends AbstractInstanceMappingH2TableDefine { + + public InstanceMappingMonthH2TableDefine() { + super(InstanceMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index ae74743e6..c3000afba 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -30,4 +30,14 @@ org.apache.skywalking.apm.collector.storage.h2.define.mpool.MemoryPoolMonthMetri org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentMinuteH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentHourH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentDayH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentMonthH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.appcomp.ApplicationComponentMonthH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.appmapping.ApplicationMappingMinuteH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.appmapping.ApplicationMappingHourH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.appmapping.ApplicationMappingDayH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.appmapping.ApplicationMappingMonthH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingMinuteH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingHourH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingDayH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingMonthH2TableDefine \ No newline at end of file From a9cf2b4b12eb6eed3589a8d7594c2cc6fcd6786d Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 20:22:13 +0800 Subject: [PATCH 12/18] Global trace test successful. --- .../AnalysisMetricModuleProvider.java | 3 +- .../apm/collector/storage/StorageModule.java | 5 ++- .../storage/h2/StorageModuleH2Provider.java | 4 +- .../h2/dao/GlobalTraceH2PersistenceDAO.java | 5 +-- .../ApplicationComponentH2TableDefine.java | 41 ------------------- .../ApplicationMappingH2TableDefine.java | 41 ------------------- .../h2/define/GlobalTraceH2TableDefine.java | 3 +- .../define/InstanceMappingH2TableDefine.java | 41 ------------------- .../resources/META-INF/defines/storage.define | 4 +- 9 files changed, 14 insertions(+), 133 deletions(-) delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationComponentH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationMappingH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMappingH2TableDefine.java diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java index d5dc49bdc..2221b0568 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java @@ -29,6 +29,7 @@ import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.appli import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric.ApplicationMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric.ApplicationReferenceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceGraph; +import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.heartbeat.InstanceHeartBeatPersistenceGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping.InstanceMappingGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping.InstanceMappingSpanListener; @@ -89,7 +90,7 @@ public class AnalysisMetricModuleProvider extends ModuleProvider { segmentParserListenerRegister.register(new ApplicationComponentSpanListener.Factory()); segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); -// segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory()); + segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory()); // segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory()); } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 6085d62a1..a33c50ad3 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -27,6 +27,7 @@ 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.IInstanceMetricUIDAO; import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO; @@ -154,8 +155,8 @@ public class StorageModule extends Module { classes.add(IInstanceMappingDayPersistenceDAO.class); classes.add(IInstanceMappingMonthPersistenceDAO.class); -// classes.add(IGlobalTracePersistenceDAO.class); -// + classes.add(IGlobalTracePersistenceDAO.class); + // classes.add(IApplicationMinuteMetricPersistenceDAO.class); // classes.add(IApplicationHourMetricPersistenceDAO.class); // classes.add(IApplicationDayMetricPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 2c382faab..99b70aba2 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -32,6 +32,7 @@ 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.IInstanceMetricUIDAO; import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO; @@ -87,6 +88,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2UI import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMetricH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.CpuMetricH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.GCMetricH2UIDAO; +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.InstanceH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMetricH2UIDAO; @@ -231,7 +233,7 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IMemoryPoolDayMetricPersistenceDAO.class, new MemoryPoolDayMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IMemoryPoolMonthMetricPersistenceDAO.class, new MemoryPoolMonthMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentMinuteH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentHourPersistenceDAO.class, new ApplicationComponentHourH2PersistenceDAO(h2Client)); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GlobalTraceH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GlobalTraceH2PersistenceDAO.java index ff4fb51ab..1d8b0f6b3 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GlobalTraceH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GlobalTraceH2PersistenceDAO.java @@ -16,17 +16,16 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.dao; import java.util.HashMap; import java.util.Map; +import org.apache.skywalking.apm.collector.client.h2.H2Client; import org.apache.skywalking.apm.collector.core.UnexpectedException; import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.client.h2.H2Client; import org.apache.skywalking.apm.collector.storage.dao.IGlobalTracePersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.global.GlobalTrace; import org.apache.skywalking.apm.collector.storage.table.global.GlobalTraceTable; import org.slf4j.Logger; diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationComponentH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationComponentH2TableDefine.java deleted file mode 100644 index 4cbfcac04..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationComponentH2TableDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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; - -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; - -/** - * @author peng-yongsheng - */ -public class ApplicationComponentH2TableDefine extends H2TableDefine { - - public ApplicationComponentH2TableDefine() { - super(ApplicationComponentTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_COMPONENT_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_PEER_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationMappingH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationMappingH2TableDefine.java deleted file mode 100644 index bf53064f8..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationMappingH2TableDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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; - -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; - -/** - * @author peng-yongsheng - */ -public class ApplicationMappingH2TableDefine extends H2TableDefine { - - public ApplicationMappingH2TableDefine() { - super(ApplicationMappingTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ApplicationMappingTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GlobalTraceH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GlobalTraceH2TableDefine.java index fa2f271a9..db18ee65b 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GlobalTraceH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/GlobalTraceH2TableDefine.java @@ -16,11 +16,10 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.define; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; 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.global.GlobalTraceTable; /** diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMappingH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMappingH2TableDefine.java deleted file mode 100644 index 422acf77f..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMappingH2TableDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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; - -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.instance.InstanceMappingTable; - -/** - * @author peng-yongsheng - */ -public class InstanceMappingH2TableDefine extends H2TableDefine { - - public InstanceMappingH2TableDefine() { - super(InstanceMappingTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceMappingTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index c3000afba..724300a77 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -40,4 +40,6 @@ org.apache.skywalking.apm.collector.storage.h2.define.appmapping.ApplicationMapp org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingMinuteH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingHourH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingDayH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingMonthH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingMonthH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.GlobalTraceH2TableDefine \ No newline at end of file From 10435c2d00db7646b07b80ffb3470f9b7a3e0385 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Thu, 11 Jan 2018 20:36:36 +0800 Subject: [PATCH 13/18] Segment aggregate by h2 storage test successful. --- .../metric/provider/AnalysisMetricModuleProvider.java | 4 +++- .../segment/parser/provider/parser/SegmentParse.java | 2 +- .../skywalking/apm/collector/storage/StorageModule.java | 9 +++++---- .../collector/storage/h2/StorageModuleH2Provider.java | 8 ++++++-- .../storage/h2/define/SegmentH2TableDefine.java | 1 - .../src/main/resources/META-INF/defines/storage.define | 4 +++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java index 2221b0568..263526bfa 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java @@ -36,8 +36,10 @@ import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.insta import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.metric.InstanceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.refmetric.InstanceReferenceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment.SegmentCostGraph; +import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment.SegmentCostSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.metric.ServiceMetricGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric.ServiceReferenceMetricGraph; +import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric.ServiceReferenceMetricSpanListener; import org.apache.skywalking.apm.collector.analysis.segment.parser.define.AnalysisSegmentParserModule; import org.apache.skywalking.apm.collector.analysis.segment.parser.define.service.ISegmentParserListenerRegister; import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener; @@ -91,7 +93,7 @@ public class AnalysisMetricModuleProvider extends ModuleProvider { segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory()); -// segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory()); + segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory()); } private void graphCreate(WorkerCreateListener workerCreateListener) { diff --git a/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java b/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java index a48c5024b..060bb88a4 100644 --- a/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java +++ b/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/parser/SegmentParse.java @@ -167,7 +167,7 @@ public class SegmentParse { segment.setDataBinary(dataBinary); segment.setTimeBucket(timeBucket); Graph graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.SEGMENT_PERSISTENCE_GRAPH_ID, Segment.class); -// graph.start(segment); + graph.start(segment); } private void writeToBufferFile(String id, UpstreamSegment upstreamSegment) { diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index a33c50ad3..9c6524f45 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -33,7 +33,9 @@ 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; @@ -156,6 +158,8 @@ public class StorageModule extends Module { classes.add(IInstanceMappingMonthPersistenceDAO.class); classes.add(IGlobalTracePersistenceDAO.class); + classes.add(ISegmentCostPersistenceDAO.class); + classes.add(ISegmentPersistenceDAO.class); // classes.add(IApplicationMinuteMetricPersistenceDAO.class); // classes.add(IApplicationHourMetricPersistenceDAO.class); @@ -166,10 +170,7 @@ public class StorageModule extends Module { // classes.add(IApplicationReferenceHourMetricPersistenceDAO.class); // classes.add(IApplicationReferenceDayMetricPersistenceDAO.class); // classes.add(IApplicationReferenceMonthMetricPersistenceDAO.class); -// -// classes.add(ISegmentCostPersistenceDAO.class); -// classes.add(ISegmentPersistenceDAO.class); -// + // classes.add(IServiceMinuteMetricPersistenceDAO.class); // classes.add(IServiceHourMetricPersistenceDAO.class); // classes.add(IServiceDayMetricPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 99b70aba2..5c34814dd 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -38,7 +38,9 @@ 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; @@ -94,7 +96,9 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMetricH2UIDAO; 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.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.ServiceReferenceH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentDayH2PersistenceDAO; @@ -234,6 +238,8 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IMemoryPoolMonthMetricPersistenceDAO.class, new MemoryPoolMonthMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentMinuteH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentHourPersistenceDAO.class, new ApplicationComponentHourH2PersistenceDAO(h2Client)); @@ -252,8 +258,6 @@ public class StorageModuleH2Provider extends ModuleProvider { // this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IServiceMinuteMetricPersistenceDAO.class, new ServiceMinuteMetricH2PersistenceDAO(h2Client)); // this.registerServiceImplementation(IServiceReferenceMinuteMetricPersistenceDAO.class, new ServiceReferenceMetricH2PersistenceDAO(h2Client)); // diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentH2TableDefine.java index b44098279..52f8b5892 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentH2TableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/SegmentH2TableDefine.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.define; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index 724300a77..1c8275096 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -42,4 +42,6 @@ org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappin org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingDayH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappingMonthH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.GlobalTraceH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.GlobalTraceH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.SegmentCostH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.SegmentH2TableDefine \ No newline at end of file From 44a5526c78770578bc9ced9911ba32c95e923f70 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 11 Jan 2018 20:51:19 +0800 Subject: [PATCH 14/18] fixes #735 Concurrency conflicts in Spring plugin * EnhanceRequireObjectCache add clearRequestAndResponse method * invoke EnhanceRequireObjectCache clearRequestAndResponse At AbstractMethodInterceptor --- .../commons/EnhanceRequireObjectCache.java | 5 +++++ ...or.java => AbstractMethodInterceptor.java} | 22 ++++++++++--------- .../InvokeHandlerMethodInterceptor.java | 3 --- .../RequestMappingMethodInterceptor.java | 5 +++-- .../RestMappingMethodInterceptor.java | 9 +++----- 5 files changed, 23 insertions(+), 21 deletions(-) rename apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/{AbstractMethodInteceptor.java => AbstractMethodInterceptor.java} (85%) diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java index 7623582f2..cbadbfdab 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java @@ -56,4 +56,9 @@ public class EnhanceRequireObjectCache { this.httpResponse.set(httpResponse); } + public void clearRequestAndResponse() { + setNativeWebRequest(null); + setHttpResponse(null); + } + } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInterceptor.java similarity index 85% rename from apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java rename to apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInterceptor.java index 8941cd10b..798a2216e 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInterceptor.java @@ -40,7 +40,7 @@ import java.lang.reflect.Method; /** * the abstract method inteceptor */ -public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundInterceptor { +public abstract class AbstractMethodInterceptor implements InstanceMethodsAroundInterceptor { public abstract String getRequestURL(Method method); @Override @@ -73,17 +73,19 @@ public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundI @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { - HttpServletResponse response = ((EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField()).getHttpServletResponse(); + try { + HttpServletResponse response = ((EnhanceRequireObjectCache) objInst.getSkyWalkingDynamicField()).getHttpServletResponse(); - AbstractSpan span = ContextManager.activeSpan(); - if (response.getStatus() >= 400) { - span.errorOccurred(); - Tags.STATUS_CODE.set(span, Integer.toString(response.getStatus())); + AbstractSpan span = ContextManager.activeSpan(); + if (response.getStatus() >= 400) { + span.errorOccurred(); + Tags.STATUS_CODE.set(span, Integer.toString(response.getStatus())); + } + ContextManager.stopSpan(); + return ret; + } finally { + ((EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField()).clearRequestAndResponse(); } - ContextManager.stopSpan(); - - ((EnhanceRequireObjectCache)objInst.getSkyWalkingDynamicField()).setNativeWebRequest(null); - return ret; } @Override diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java index 061d505d4..c2d555608 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java @@ -38,9 +38,6 @@ public class InvokeHandlerMethodInterceptor implements InstanceMethodsAroundInte @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, Object ret) throws Throwable { - if (allArguments[2] instanceof EnhancedInstance) { - ((EnhanceRequireObjectCache)((EnhancedInstance)allArguments[2]).getSkyWalkingDynamicField()).setHttpResponse(null); - } return ret; } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java index 58c4bcf05..1dd6b7748 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java @@ -19,16 +19,17 @@ package org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor; -import java.lang.reflect.Method; import org.springframework.web.bind.annotation.RequestMapping; +import java.lang.reflect.Method; + /** * The RequestMappingMethodInterceptor only use the first mapping value. * it will inteceptor with @RequestMapping * * @author clevertension */ -public class RequestMappingMethodInterceptor extends AbstractMethodInteceptor { +public class RequestMappingMethodInterceptor extends AbstractMethodInterceptor { @Override public String getRequestURL(Method method) { String requestURL = ""; diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java index faee5b4cb..5cea58d0d 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java @@ -19,12 +19,9 @@ package org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor; +import org.springframework.web.bind.annotation.*; + import java.lang.reflect.Method; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; /** * The RestMappingMethodInterceptor only use the first mapping value. @@ -34,7 +31,7 @@ import org.springframework.web.bind.annotation.PutMapping; * * @author clevertension */ -public class RestMappingMethodInterceptor extends AbstractMethodInteceptor { +public class RestMappingMethodInterceptor extends AbstractMethodInterceptor { @Override public String getRequestURL(Method method) { String requestURL = ""; From 41082be5ea604a3ad3c86c64e4bdfe86a4ddc98f Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Fri, 12 Jan 2018 17:00:47 +0800 Subject: [PATCH 15/18] Application reference metric, Application metric, Instance reference metric, Instance metric, Service reference metric, Service metric pyramid aggregate by h2 storage test successful. --- .../provider/AnalysisAlarmModuleProvider.java | 44 ++--- .../AnalysisMetricModuleProvider.java | 2 +- .../apm/collector/storage/StorageModule.java | 84 ++++++---- ...tInstanceReferenceMetricEsTableDefine.java | 2 + .../AbstractServiceMetricEsTableDefine.java | 2 + ...ctServiceReferenceMetricEsTableDefine.java | 4 + .../storage/h2/StorageModuleH2Provider.java | 88 +++++++++- ...stanceReferenceMetricH2PersistenceDAO.java | 146 ----------------- ...erviceReferenceMetricH2PersistenceDAO.java | 153 ------------------ ...ractApplicationMetricH2PersistenceDAO.java | 99 ++++++++++++ .../ApplicationDayMetricH2PersistenceDAO.java | 42 +++++ ...ApplicationHourMetricH2PersistenceDAO.java | 41 +++++ ...plicationMinuteMetricH2PersistenceDAO.java | 41 +++++ ...pplicationMonthMetricH2PersistenceDAO.java | 41 +++++ ...cationReferenceMetricH2PersistenceDAO.java | 102 ++++++++++++ ...ionReferenceDayMetricH2PersistenceDAO.java | 42 +++++ ...onReferenceHourMetricH2PersistenceDAO.java | 42 +++++ ...ReferenceMinuteMetricH2PersistenceDAO.java | 41 +++++ ...nReferenceMonthMetricH2PersistenceDAO.java | 42 +++++ ...bstractInstanceMetricH2PersistenceDAO.java | 96 +++++++++++ .../InstanceDayMetricH2PersistenceDAO.java | 41 +++++ .../InstanceHourMetricH2PersistenceDAO.java | 41 +++++ .../InstanceMinuteMetricH2PersistenceDAO.java | 41 +++++ .../InstanceMonthMetricH2PersistenceDAO.java | 41 +++++ ...stanceReferenceMetricH2PersistenceDAO.java | 98 +++++++++++ ...nceReferenceDayMetricH2PersistenceDAO.java | 41 +++++ ...ceReferenceHourMetricH2PersistenceDAO.java | 41 +++++ ...ReferenceMinuteMetricH2PersistenceDAO.java | 41 +++++ ...eReferenceMonthMetricH2PersistenceDAO.java | 41 +++++ ...AbstractServiceMetricH2PersistenceDAO.java | 96 +++++++++++ .../smp/ServiceDayMetricH2PersistenceDAO.java | 41 +++++ .../ServiceHourMetricH2PersistenceDAO.java | 42 +++++ .../ServiceMinuteMetricH2PersistenceDAO.java | 41 +++++ .../ServiceMonthMetricH2PersistenceDAO.java | 41 +++++ ...erviceReferenceMetricH2PersistenceDAO.java | 102 ++++++++++++ ...iceReferenceDayMetricH2PersistenceDAO.java | 41 +++++ ...ceReferenceHourMetricH2PersistenceDAO.java | 41 +++++ ...ReferenceMinuteMetricH2PersistenceDAO.java | 41 +++++ ...eReferenceMonthMetricH2PersistenceDAO.java | 41 +++++ ...bstractApplicationMetricH2TableDefine.java | 61 +++++++ .../ApplicationDayMetricH2TableDefine.java | 33 ++++ .../ApplicationHourMetricH2TableDefine.java | 33 ++++ .../ApplicationMinuteMetricH2TableDefine.java | 33 ++++ .../ApplicationMonthMetricH2TableDefine.java | 33 ++++ ...plicationReferenceMetricH2TableDefine.java | 61 +++++++ ...cationReferenceDayMetricH2TableDefine.java | 33 ++++ ...ationReferenceHourMetricH2TableDefine.java | 33 ++++ ...ionReferenceMinuteMetricH2TableDefine.java | 33 ++++ ...tionReferenceMonthMetricH2TableDefine.java | 33 ++++ .../AbstractInstanceMetricH2TableDefine.java | 58 +++++++ .../imp/InstanceDayMetricH2TableDefine.java | 33 ++++ .../imp/InstanceHourMetricH2TableDefine.java | 33 ++++ .../InstanceMinuteMetricH2TableDefine.java | 33 ++++ .../imp/InstanceMonthMetricH2TableDefine.java | 33 ++++ ...tInstanceReferenceMetricH2TableDefine.java | 60 +++++++ ...stanceReferenceDayMetricH2TableDefine.java | 34 ++++ ...tanceReferenceHourMetricH2TableDefine.java | 34 ++++ ...nceReferenceMinuteMetricH2TableDefine.java | 34 ++++ ...anceReferenceMonthMetricH2TableDefine.java | 34 ++++ .../AbstractServiceMetricH2TableDefine.java | 59 +++++++ .../smp/ServiceDayMetricH2TableDefine.java | 33 ++++ .../smp/ServiceHourMetricH2TableDefine.java | 33 ++++ .../smp/ServiceMinuteMetricH2TableDefine.java | 33 ++++ .../smp/ServiceMonthMetricH2TableDefine.java | 33 ++++ ...ctServiceReferenceMetricH2TableDefine.java | 63 ++++++++ ...erviceReferenceDayMetricH2TableDefine.java | 33 ++++ ...rviceReferenceHourMetricH2TableDefine.java | 33 ++++ ...iceReferenceMinuteMetricH2TableDefine.java | 33 ++++ ...viceReferenceMonthMetricH2TableDefine.java | 33 ++++ .../resources/META-INF/defines/storage.define | 32 +++- 70 files changed, 2936 insertions(+), 361 deletions(-) delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/AbstractApplicationMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/AbstractApplicationReferenceMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/AbstractInstanceMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/AbstractInstanceReferenceMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/AbstractServiceMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/AbstractServiceReferenceMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceDayMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceHourMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMinuteMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMonthMetricH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/AbstractApplicationMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/AbstractApplicationReferenceMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/AbstractInstanceMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/AbstractInstanceReferenceMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/AbstractServiceMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMonthMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/AbstractServiceReferenceMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceDayMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceHourMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMinuteMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMonthMetricH2TableDefine.java diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java index 9c560ff4a..7a547edcc 100644 --- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java @@ -54,28 +54,28 @@ public class AnalysisAlarmModuleProvider extends ModuleProvider { } @Override public void start(Properties config) throws ServiceNotProvidedException { - WorkerCreateListener workerCreateListener = new WorkerCreateListener(); - - ServiceMetricAlarmGraph serviceMetricAlarmGraph = new ServiceMetricAlarmGraph(getManager(), workerCreateListener); - serviceMetricAlarmGraph.create(); - - InstanceMetricAlarmGraph instanceMetricAlarmGraph = new InstanceMetricAlarmGraph(getManager(), workerCreateListener); - instanceMetricAlarmGraph.create(); - - ApplicationMetricAlarmGraph applicationMetricAlarmGraph = new ApplicationMetricAlarmGraph(getManager(), workerCreateListener); - applicationMetricAlarmGraph.create(); - - ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener); - serviceReferenceMetricAlarmGraph.create(); - - InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener); - instanceReferenceMetricAlarmGraph.create(); - - ApplicationReferenceMetricAlarmGraph applicationReferenceMetricAlarmGraph = new ApplicationReferenceMetricAlarmGraph(getManager(), workerCreateListener); - applicationReferenceMetricAlarmGraph.create(); - - PersistenceTimer persistenceTimer = new PersistenceTimer(AnalysisAlarmModule.NAME); - persistenceTimer.start(getManager(), workerCreateListener.getPersistenceWorkers()); +// WorkerCreateListener workerCreateListener = new WorkerCreateListener(); +// +// ServiceMetricAlarmGraph serviceMetricAlarmGraph = new ServiceMetricAlarmGraph(getManager(), workerCreateListener); +// serviceMetricAlarmGraph.create(); +// +// InstanceMetricAlarmGraph instanceMetricAlarmGraph = new InstanceMetricAlarmGraph(getManager(), workerCreateListener); +// instanceMetricAlarmGraph.create(); +// +// ApplicationMetricAlarmGraph applicationMetricAlarmGraph = new ApplicationMetricAlarmGraph(getManager(), workerCreateListener); +// applicationMetricAlarmGraph.create(); +// +// ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener); +// serviceReferenceMetricAlarmGraph.create(); +// +// InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener); +// instanceReferenceMetricAlarmGraph.create(); +// +// ApplicationReferenceMetricAlarmGraph applicationReferenceMetricAlarmGraph = new ApplicationReferenceMetricAlarmGraph(getManager(), workerCreateListener); +// applicationReferenceMetricAlarmGraph.create(); +// +// PersistenceTimer persistenceTimer = new PersistenceTimer(AnalysisAlarmModule.NAME); +// persistenceTimer.start(getManager(), workerCreateListener.getPersistenceWorkers()); } @Override public void notifyAfterCompleted() throws ServiceNotProvidedException { diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java index 263526bfa..be6c3d3ee 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java @@ -88,7 +88,7 @@ public class AnalysisMetricModuleProvider extends ModuleProvider { private void segmentParserListenerRegister() { ISegmentParserListenerRegister segmentParserListenerRegister = getManager().find(AnalysisSegmentParserModule.NAME).getService(ISegmentParserListenerRegister.class); -// segmentParserListenerRegister.register(new ServiceReferenceMetricSpanListener.Factory()); + segmentParserListenerRegister.register(new ServiceReferenceMetricSpanListener.Factory()); segmentParserListenerRegister.register(new ApplicationComponentSpanListener.Factory()); segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory()); segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory()); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 9c6524f45..2f01ffa65 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -29,6 +29,7 @@ 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; @@ -42,10 +43,18 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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.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; @@ -60,10 +69,18 @@ import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersist 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; @@ -78,6 +95,14 @@ import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegi 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 @@ -160,38 +185,37 @@ public class StorageModule extends Module { classes.add(IGlobalTracePersistenceDAO.class); classes.add(ISegmentCostPersistenceDAO.class); classes.add(ISegmentPersistenceDAO.class); + classes.add(IInstanceHeartBeatPersistenceDAO.class); -// classes.add(IApplicationMinuteMetricPersistenceDAO.class); -// classes.add(IApplicationHourMetricPersistenceDAO.class); -// classes.add(IApplicationDayMetricPersistenceDAO.class); -// classes.add(IApplicationMonthMetricPersistenceDAO.class); -// -// classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class); -// classes.add(IApplicationReferenceHourMetricPersistenceDAO.class); -// classes.add(IApplicationReferenceDayMetricPersistenceDAO.class); -// classes.add(IApplicationReferenceMonthMetricPersistenceDAO.class); + classes.add(IApplicationMinuteMetricPersistenceDAO.class); + classes.add(IApplicationHourMetricPersistenceDAO.class); + classes.add(IApplicationDayMetricPersistenceDAO.class); + classes.add(IApplicationMonthMetricPersistenceDAO.class); -// classes.add(IServiceMinuteMetricPersistenceDAO.class); -// classes.add(IServiceHourMetricPersistenceDAO.class); -// classes.add(IServiceDayMetricPersistenceDAO.class); -// classes.add(IServiceMonthMetricPersistenceDAO.class); -// -// classes.add(IServiceReferenceMinuteMetricPersistenceDAO.class); -// classes.add(IServiceReferenceHourMetricPersistenceDAO.class); -// classes.add(IServiceReferenceDayMetricPersistenceDAO.class); -// classes.add(IServiceReferenceMonthMetricPersistenceDAO.class); -// -// classes.add(IInstanceMinuteMetricPersistenceDAO.class); -// classes.add(IInstanceHourMetricPersistenceDAO.class); -// classes.add(IInstanceDayMetricPersistenceDAO.class); -// classes.add(IInstanceMonthMetricPersistenceDAO.class); -// -// classes.add(IInstanceReferenceMinuteMetricPersistenceDAO.class); -// classes.add(IInstanceReferenceHourMetricPersistenceDAO.class); -// classes.add(IInstanceReferenceDayMetricPersistenceDAO.class); -// classes.add(IInstanceReferenceMonthMetricPersistenceDAO.class); -// -// classes.add(IInstanceHeartBeatPersistenceDAO.class); + classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class); + classes.add(IApplicationReferenceHourMetricPersistenceDAO.class); + classes.add(IApplicationReferenceDayMetricPersistenceDAO.class); + classes.add(IApplicationReferenceMonthMetricPersistenceDAO.class); + + classes.add(IServiceMinuteMetricPersistenceDAO.class); + classes.add(IServiceHourMetricPersistenceDAO.class); + classes.add(IServiceDayMetricPersistenceDAO.class); + classes.add(IServiceMonthMetricPersistenceDAO.class); + + classes.add(IServiceReferenceMinuteMetricPersistenceDAO.class); + classes.add(IServiceReferenceHourMetricPersistenceDAO.class); + classes.add(IServiceReferenceDayMetricPersistenceDAO.class); + classes.add(IServiceReferenceMonthMetricPersistenceDAO.class); + + classes.add(IInstanceMinuteMetricPersistenceDAO.class); + classes.add(IInstanceHourMetricPersistenceDAO.class); + classes.add(IInstanceDayMetricPersistenceDAO.class); + classes.add(IInstanceMonthMetricPersistenceDAO.class); + + classes.add(IInstanceReferenceMinuteMetricPersistenceDAO.class); + classes.add(IInstanceReferenceHourMetricPersistenceDAO.class); + classes.add(IInstanceReferenceDayMetricPersistenceDAO.class); + classes.add(IInstanceReferenceMonthMetricPersistenceDAO.class); } private void addUiDAO(List classes) { diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/irmp/AbstractInstanceReferenceMetricEsTableDefine.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/irmp/AbstractInstanceReferenceMetricEsTableDefine.java index b3ed11cf7..904e61584 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/irmp/AbstractInstanceReferenceMetricEsTableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/irmp/AbstractInstanceReferenceMetricEsTableDefine.java @@ -34,7 +34,9 @@ public abstract class AbstractInstanceReferenceMetricEsTableDefine extends Elast @Override public final void initialize() { addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_ID, ElasticSearchColumnDefine.Type.Keyword.name())); addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_METRIC_ID, ElasticSearchColumnDefine.Type.Keyword.name())); + addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); + addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(InstanceReferenceMetricTable.COLUMN_SOURCE_VALUE, ElasticSearchColumnDefine.Type.Integer.name())); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/smp/AbstractServiceMetricEsTableDefine.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/smp/AbstractServiceMetricEsTableDefine.java index 7d4aa5418..e72209291 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/smp/AbstractServiceMetricEsTableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/smp/AbstractServiceMetricEsTableDefine.java @@ -34,6 +34,8 @@ public abstract class AbstractServiceMetricEsTableDefine extends ElasticSearchTa @Override public final void initialize() { addColumn(new ElasticSearchColumnDefine(ServiceMetricTable.COLUMN_ID, ElasticSearchColumnDefine.Type.Keyword.name())); addColumn(new ElasticSearchColumnDefine(ServiceMetricTable.COLUMN_METRIC_ID, ElasticSearchColumnDefine.Type.Keyword.name())); + addColumn(new ElasticSearchColumnDefine(ServiceMetricTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); + addColumn(new ElasticSearchColumnDefine(ServiceMetricTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(ServiceMetricTable.COLUMN_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(ServiceMetricTable.COLUMN_SOURCE_VALUE, ElasticSearchColumnDefine.Type.Integer.name())); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/srmp/AbstractServiceReferenceMetricEsTableDefine.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/srmp/AbstractServiceReferenceMetricEsTableDefine.java index c4c791a5c..dc93b4409 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/srmp/AbstractServiceReferenceMetricEsTableDefine.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/define/srmp/AbstractServiceReferenceMetricEsTableDefine.java @@ -34,7 +34,11 @@ public abstract class AbstractServiceReferenceMetricEsTableDefine extends Elasti @Override public final void initialize() { addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_METRIC_ID, ElasticSearchColumnDefine.Type.Keyword.name())); + addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); + addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); + addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); + addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, ElasticSearchColumnDefine.Type.Integer.name())); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index 5c34814dd..e362238b9 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -34,6 +34,7 @@ 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; @@ -47,10 +48,18 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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.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; @@ -65,10 +74,18 @@ import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersist 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; @@ -83,6 +100,14 @@ import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegi 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; 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.ApplicationComponentH2UIDAO; @@ -93,6 +118,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.GCMetricH2UIDAO; 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.InstanceH2UIDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceHeartBeatH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMetricH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.MemoryMetricH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.MemoryPoolMetricH2UIDAO; @@ -105,10 +131,18 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationCompone import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentHourH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMinuteH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMonthH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingDayH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingHourH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingMinuteH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ampp.ApplicationMappingMonthH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.armp.ApplicationReferenceDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.armp.ApplicationReferenceHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.armp.ApplicationReferenceMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.armp.ApplicationReferenceMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.cache.ApplicationH2CacheDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.cache.InstanceH2CacheDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.cache.NetworkAddressH2CacheDAO; @@ -123,10 +157,18 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCHourMetricH2Per import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMinuteMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.gcmp.GCSecondMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.imp.InstanceDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.imp.InstanceHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.imp.InstanceMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.imp.InstanceMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingDayH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingHourH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingMinuteH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.impp.InstanceMappingMonthH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.irmp.InstanceReferenceDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.irmp.InstanceReferenceHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.irmp.InstanceReferenceMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.irmp.InstanceReferenceMonthMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryDayMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryHourMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.memorymp.MemoryMinuteMetricH2PersistenceDAO; @@ -141,6 +183,14 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.register.ApplicationRe 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.apache.skywalking.apm.collector.storage.h2.dao.smp.ServiceDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.smp.ServiceHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.smp.ServiceMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.smp.ServiceMonthMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceDayMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceHourMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceMinuteMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceMonthMetricH2PersistenceDAO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -240,6 +290,7 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client)); this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceHeartBeatPersistenceDAO.class, new InstanceHeartBeatH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentMinuteH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationComponentHourPersistenceDAO.class, new ApplicationComponentHourH2PersistenceDAO(h2Client)); @@ -256,14 +307,35 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IInstanceMappingDayPersistenceDAO.class, new InstanceMappingDayH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IInstanceMappingMonthPersistenceDAO.class, new InstanceMappingMonthH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IServiceMinuteMetricPersistenceDAO.class, new ServiceMinuteMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IServiceReferenceMinuteMetricPersistenceDAO.class, new ServiceReferenceMetricH2PersistenceDAO(h2Client)); -// -// this.registerServiceImplementation(IInstanceMinuteMetricPersistenceDAO.class, new InstanceMinuteMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceReferenceMinuteMetricPersistenceDAO.class, new InstanceReferenceMetricH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceHeartBeatPersistenceDAO.class, new InstanceHeartBeatH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationHourMetricPersistenceDAO.class, new ApplicationHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationDayMetricPersistenceDAO.class, new ApplicationDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationMonthMetricPersistenceDAO.class, new ApplicationMonthMetricH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationReferenceHourMetricPersistenceDAO.class, new ApplicationReferenceHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationReferenceDayMetricPersistenceDAO.class, new ApplicationReferenceDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationReferenceMonthMetricPersistenceDAO.class, new ApplicationReferenceMonthMetricH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IInstanceMinuteMetricPersistenceDAO.class, new InstanceMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceHourMetricPersistenceDAO.class, new InstanceHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceDayMetricPersistenceDAO.class, new InstanceDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceMonthMetricPersistenceDAO.class, new InstanceMonthMetricH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IInstanceReferenceMinuteMetricPersistenceDAO.class, new InstanceReferenceMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceReferenceHourMetricPersistenceDAO.class, new InstanceReferenceHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceReferenceDayMetricPersistenceDAO.class, new InstanceReferenceDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceReferenceMonthMetricPersistenceDAO.class, new InstanceReferenceMonthMetricH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IServiceMinuteMetricPersistenceDAO.class, new ServiceMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceHourMetricPersistenceDAO.class, new ServiceHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceDayMetricPersistenceDAO.class, new ServiceDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceMonthMetricPersistenceDAO.class, new ServiceMonthMetricH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IServiceReferenceMinuteMetricPersistenceDAO.class, new ServiceReferenceMinuteMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceReferenceHourMetricPersistenceDAO.class, new ServiceReferenceHourMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceReferenceDayMetricPersistenceDAO.class, new ServiceReferenceDayMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceReferenceMonthMetricPersistenceDAO.class, new ServiceReferenceMonthMetricH2PersistenceDAO(h2Client)); } private void registerUiDAO() throws ServiceNotProvidedException { diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceMetricH2PersistenceDAO.java deleted file mode 100644 index 1c4cf1156..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceMetricH2PersistenceDAO.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMinuteMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; -import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetricTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceReferenceMetricH2PersistenceDAO extends H2DAO implements IInstanceReferenceMinuteMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceReferenceMetricH2PersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public InstanceReferenceMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceReferenceMetric get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, InstanceReferenceMetricTable.TABLE, InstanceReferenceMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - InstanceReferenceMetric instanceReferenceMetric = new InstanceReferenceMetric(); - instanceReferenceMetric.setId(id); - instanceReferenceMetric.setFrontInstanceId(rs.getInt(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID)); - instanceReferenceMetric.setBehindInstanceId(rs.getInt(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID)); - - instanceReferenceMetric.setTransactionCalls(rs.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS)); - instanceReferenceMetric.setTransactionErrorCalls(rs.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); - instanceReferenceMetric.setTransactionDurationSum(rs.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); - instanceReferenceMetric.setTransactionErrorDurationSum(rs.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); - - instanceReferenceMetric.setBusinessTransactionCalls(rs.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); - instanceReferenceMetric.setBusinessTransactionErrorCalls(rs.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); - instanceReferenceMetric.setBusinessTransactionDurationSum(rs.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); - instanceReferenceMetric.setBusinessTransactionErrorDurationSum(rs.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); - - instanceReferenceMetric.setMqTransactionCalls(rs.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); - instanceReferenceMetric.setMqTransactionErrorCalls(rs.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); - instanceReferenceMetric.setMqTransactionDurationSum(rs.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); - instanceReferenceMetric.setMqTransactionErrorDurationSum(rs.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); - - instanceReferenceMetric.setTimeBucket(rs.getLong(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET)); - return instanceReferenceMetric; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceReferenceMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstanceReferenceMetricTable.COLUMN_ID, data.getId()); - source.put(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, data.getFrontInstanceId()); - source.put(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, data.getBehindInstanceId()); - - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchInsertSql(InstanceReferenceMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceReferenceMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, data.getFrontInstanceId()); - source.put(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, data.getBehindInstanceId()); - - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(InstanceReferenceMetricTable.TABLE, source.keySet(), InstanceReferenceMetricTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceMetricH2PersistenceDAO.java deleted file mode 100644 index a1cb5cfd5..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceMetricH2PersistenceDAO.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; -import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceReferenceMetricH2PersistenceDAO extends H2DAO implements IServiceReferenceMinuteMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceMetricH2PersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public ServiceReferenceMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override - public ServiceReferenceMetric get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ServiceReferenceMetricTable.TABLE, ServiceReferenceMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - ServiceReferenceMetric serviceReferenceMetric = new ServiceReferenceMetric(); - serviceReferenceMetric.setId(id); - serviceReferenceMetric.setFrontServiceId(rs.getInt(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID)); - serviceReferenceMetric.setBehindServiceId(rs.getInt(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID)); - serviceReferenceMetric.setSourceValue(rs.getInt(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE)); - - serviceReferenceMetric.setTransactionCalls(rs.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS)); - serviceReferenceMetric.setTransactionErrorCalls(rs.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); - serviceReferenceMetric.setTransactionDurationSum(rs.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); - serviceReferenceMetric.setTransactionErrorDurationSum(rs.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); - - serviceReferenceMetric.setBusinessTransactionCalls(rs.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); - serviceReferenceMetric.setBusinessTransactionErrorCalls(rs.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); - serviceReferenceMetric.setBusinessTransactionDurationSum(rs.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); - serviceReferenceMetric.setBusinessTransactionErrorDurationSum(rs.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); - - serviceReferenceMetric.setMqTransactionCalls(rs.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); - serviceReferenceMetric.setMqTransactionErrorCalls(rs.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); - serviceReferenceMetric.setMqTransactionDurationSum(rs.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); - serviceReferenceMetric.setMqTransactionErrorDurationSum(rs.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); - - serviceReferenceMetric.setTimeBucket(rs.getLong(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET)); - return serviceReferenceMetric; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public H2SqlEntity prepareBatchInsert(ServiceReferenceMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceReferenceMetricTable.COLUMN_ID, data.getId()); - source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, data.getFrontServiceId()); - source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, data.getBehindServiceId()); - source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue()); - - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchInsertSql(ServiceReferenceMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override - public H2SqlEntity prepareBatchUpdate(ServiceReferenceMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, data.getFrontServiceId()); - source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, data.getBehindServiceId()); - source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue()); - - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - source.put(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchUpdateSql(ServiceReferenceMetricTable.TABLE, source.keySet(), ServiceReferenceMetricTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/AbstractApplicationMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/AbstractApplicationMetricH2PersistenceDAO.java new file mode 100644 index 000000000..676ae60da --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/AbstractApplicationMetricH2PersistenceDAO.java @@ -0,0 +1,99 @@ +/* + * 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.amp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractApplicationMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final ApplicationMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationMetric applicationMetric = new ApplicationMetric(); + applicationMetric.setId(resultSet.getString(ApplicationMetricTable.COLUMN_ID)); + applicationMetric.setMetricId(resultSet.getString(ApplicationMetricTable.COLUMN_METRIC_ID)); + + applicationMetric.setApplicationId(resultSet.getInt(ApplicationMetricTable.COLUMN_APPLICATION_ID)); + applicationMetric.setSourceValue(resultSet.getInt(ApplicationMetricTable.COLUMN_SOURCE_VALUE)); + + applicationMetric.setTransactionCalls(resultSet.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS)); + applicationMetric.setTransactionErrorCalls(resultSet.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); + applicationMetric.setTransactionDurationSum(resultSet.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); + applicationMetric.setTransactionErrorDurationSum(resultSet.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); + + applicationMetric.setBusinessTransactionCalls(resultSet.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); + applicationMetric.setBusinessTransactionErrorCalls(resultSet.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); + applicationMetric.setBusinessTransactionDurationSum(resultSet.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); + applicationMetric.setBusinessTransactionErrorDurationSum(resultSet.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); + + applicationMetric.setMqTransactionCalls(resultSet.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); + applicationMetric.setMqTransactionErrorCalls(resultSet.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); + applicationMetric.setMqTransactionDurationSum(resultSet.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); + applicationMetric.setMqTransactionErrorDurationSum(resultSet.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); + + applicationMetric.setSatisfiedCount(resultSet.getLong(ApplicationMetricTable.COLUMN_SATISFIED_COUNT)); + applicationMetric.setToleratingCount(resultSet.getLong(ApplicationMetricTable.COLUMN_TOLERATING_COUNT)); + applicationMetric.setFrustratedCount(resultSet.getLong(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT)); + applicationMetric.setTimeBucket(resultSet.getLong(ApplicationMetricTable.COLUMN_TIME_BUCKET)); + + return applicationMetric; + } + + @Override protected final Map streamDataToH2Data(ApplicationMetric streamData) { + Map source = new HashMap<>(); + source.put(ApplicationMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ApplicationMetricTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(ApplicationMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls()); + source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls()); + source.put(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum()); + source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum()); + + source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls()); + source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls()); + source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum()); + source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum()); + + source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls()); + source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls()); + source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum()); + source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum()); + + source.put(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, streamData.getSatisfiedCount()); + source.put(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, streamData.getToleratingCount()); + source.put(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, streamData.getFrustratedCount()); + source.put(ApplicationMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..5e81c7f3e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java @@ -0,0 +1,42 @@ +/* + * 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.amp; + +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.amp.IApplicationDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationDayMetricH2PersistenceDAO extends AbstractApplicationMetricH2PersistenceDAO implements IApplicationDayMetricPersistenceDAO { + + public ApplicationDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..b4d52c769 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.amp; + +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.amp.IApplicationHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationHourMetricH2PersistenceDAO extends AbstractApplicationMetricH2PersistenceDAO implements IApplicationHourMetricPersistenceDAO { + + public ApplicationHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..5ade074b2 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.amp; + +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.amp.IApplicationMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationMinuteMetricH2PersistenceDAO extends AbstractApplicationMetricH2PersistenceDAO implements IApplicationMinuteMetricPersistenceDAO { + + public ApplicationMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..fb2c51e53 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.amp; + +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.amp.IApplicationMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng, clevertension + */ +public class ApplicationMonthMetricH2PersistenceDAO extends AbstractApplicationMetricH2PersistenceDAO implements IApplicationMonthMetricPersistenceDAO { + + public ApplicationMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/AbstractApplicationReferenceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/AbstractApplicationReferenceMetricH2PersistenceDAO.java new file mode 100644 index 000000000..8e7f15008 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/AbstractApplicationReferenceMetricH2PersistenceDAO.java @@ -0,0 +1,102 @@ +/* + * 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.armp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationReferenceMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractApplicationReferenceMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final ApplicationReferenceMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationReferenceMetric applicationReferenceMetric = new ApplicationReferenceMetric(); + applicationReferenceMetric.setId(resultSet.getString(ApplicationReferenceMetricTable.COLUMN_ID)); + applicationReferenceMetric.setMetricId(resultSet.getString(ApplicationReferenceMetricTable.COLUMN_METRIC_ID)); + + applicationReferenceMetric.setFrontApplicationId(resultSet.getInt(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID)); + applicationReferenceMetric.setBehindApplicationId(resultSet.getInt(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID)); + applicationReferenceMetric.setSourceValue(resultSet.getInt(ApplicationReferenceMetricTable.COLUMN_SOURCE_VALUE)); + + applicationReferenceMetric.setTransactionCalls(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS)); + applicationReferenceMetric.setTransactionErrorCalls(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); + applicationReferenceMetric.setTransactionDurationSum(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); + applicationReferenceMetric.setTransactionErrorDurationSum(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); + + applicationReferenceMetric.setBusinessTransactionCalls(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); + applicationReferenceMetric.setBusinessTransactionErrorCalls(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); + applicationReferenceMetric.setBusinessTransactionDurationSum(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); + applicationReferenceMetric.setBusinessTransactionErrorDurationSum(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); + + applicationReferenceMetric.setMqTransactionCalls(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); + applicationReferenceMetric.setMqTransactionErrorCalls(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); + applicationReferenceMetric.setMqTransactionDurationSum(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); + applicationReferenceMetric.setMqTransactionErrorDurationSum(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); + + applicationReferenceMetric.setSatisfiedCount(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT)); + applicationReferenceMetric.setToleratingCount(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT)); + applicationReferenceMetric.setFrustratedCount(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT)); + + applicationReferenceMetric.setTimeBucket(resultSet.getLong(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET)); + return applicationReferenceMetric; + } + + @Override protected final Map streamDataToH2Data(ApplicationReferenceMetric streamData) { + Map source = new HashMap<>(); + source.put(ApplicationReferenceMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(ApplicationReferenceMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls()); + source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls()); + source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum()); + source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum()); + + source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls()); + source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls()); + source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum()); + source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum()); + + source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls()); + source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls()); + source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum()); + source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum()); + + source.put(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT, streamData.getSatisfiedCount()); + source.put(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT, streamData.getToleratingCount()); + source.put(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT, streamData.getFrustratedCount()); + + source.put(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..73c3e2205 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java @@ -0,0 +1,42 @@ +/* + * 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.armp; + +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.armp.IApplicationReferenceDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceDayMetricH2PersistenceDAO extends AbstractApplicationReferenceMetricH2PersistenceDAO implements IApplicationReferenceDayMetricPersistenceDAO { + + public ApplicationReferenceDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..92bea1e7f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java @@ -0,0 +1,42 @@ +/* + * 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.armp; + +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.armp.IApplicationReferenceHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceHourMetricH2PersistenceDAO extends AbstractApplicationReferenceMetricH2PersistenceDAO implements IApplicationReferenceHourMetricPersistenceDAO { + + public ApplicationReferenceHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..d30ffc56e --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.armp; + +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.armp.IApplicationReferenceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceMinuteMetricH2PersistenceDAO extends AbstractApplicationReferenceMetricH2PersistenceDAO implements IApplicationReferenceMinuteMetricPersistenceDAO { + + public ApplicationReferenceMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..2a2723ee8 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java @@ -0,0 +1,42 @@ +/* + * 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.armp; + +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.armp.IApplicationReferenceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceMonthMetricH2PersistenceDAO extends AbstractApplicationReferenceMetricH2PersistenceDAO implements IApplicationReferenceMonthMetricPersistenceDAO { + + public ApplicationReferenceMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/AbstractInstanceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/AbstractInstanceMetricH2PersistenceDAO.java new file mode 100644 index 000000000..2df5397e6 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/AbstractInstanceMetricH2PersistenceDAO.java @@ -0,0 +1,96 @@ +/* + * 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.imp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractInstanceMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractInstanceMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final InstanceMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceMetric instanceMetric = new InstanceMetric(); + + instanceMetric.setId(resultSet.getString(InstanceMetricTable.COLUMN_ID)); + instanceMetric.setMetricId(resultSet.getString(InstanceMetricTable.COLUMN_METRIC_ID)); + instanceMetric.setApplicationId(resultSet.getInt(InstanceMetricTable.COLUMN_APPLICATION_ID)); + instanceMetric.setInstanceId(resultSet.getInt(InstanceMetricTable.COLUMN_INSTANCE_ID)); + instanceMetric.setSourceValue(resultSet.getInt(InstanceMetricTable.COLUMN_SOURCE_VALUE)); + + instanceMetric.setTransactionCalls(resultSet.getLong(InstanceMetricTable.COLUMN_TRANSACTION_CALLS)); + instanceMetric.setTransactionErrorCalls(resultSet.getLong(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); + instanceMetric.setTransactionDurationSum(resultSet.getLong(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); + instanceMetric.setTransactionErrorDurationSum(resultSet.getLong(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); + + instanceMetric.setBusinessTransactionCalls(resultSet.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); + instanceMetric.setBusinessTransactionErrorCalls(resultSet.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); + instanceMetric.setBusinessTransactionDurationSum(resultSet.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); + instanceMetric.setBusinessTransactionErrorDurationSum(resultSet.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); + + instanceMetric.setMqTransactionCalls(resultSet.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); + instanceMetric.setMqTransactionErrorCalls(resultSet.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); + instanceMetric.setMqTransactionDurationSum(resultSet.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); + instanceMetric.setMqTransactionErrorDurationSum(resultSet.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); + + instanceMetric.setTimeBucket(resultSet.getLong(InstanceMetricTable.COLUMN_TIME_BUCKET)); + return instanceMetric; + } + + @Override protected final Map streamDataToH2Data(InstanceMetric streamData) { + Map source = new HashMap<>(); + source.put(InstanceMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(InstanceMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(InstanceMetricTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(InstanceMetricTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(InstanceMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(InstanceMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls()); + source.put(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls()); + source.put(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum()); + source.put(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum()); + + source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls()); + source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls()); + source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum()); + source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum()); + + source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls()); + source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls()); + source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum()); + source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum()); + + source.put(InstanceMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..a0c675d5b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.imp; + +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.imp.IInstanceDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceDayMetricH2PersistenceDAO extends AbstractInstanceMetricH2PersistenceDAO implements IInstanceDayMetricPersistenceDAO { + + public InstanceDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..47155ea3c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.imp; + +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.imp.IInstanceHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceHourMetricH2PersistenceDAO extends AbstractInstanceMetricH2PersistenceDAO implements IInstanceHourMetricPersistenceDAO { + + public InstanceHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..1345bf9f4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.imp; + +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.imp.IInstanceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMinuteMetricH2PersistenceDAO extends AbstractInstanceMetricH2PersistenceDAO implements IInstanceMinuteMetricPersistenceDAO { + + public InstanceMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..2e9a5b246 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/imp/InstanceMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.imp; + +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.imp.IInstanceMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMonthMetricH2PersistenceDAO extends AbstractInstanceMetricH2PersistenceDAO implements IInstanceMonthMetricPersistenceDAO { + + public InstanceMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/AbstractInstanceReferenceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/AbstractInstanceReferenceMetricH2PersistenceDAO.java new file mode 100644 index 000000000..7e33d4152 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/AbstractInstanceReferenceMetricH2PersistenceDAO.java @@ -0,0 +1,98 @@ +/* + * 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.irmp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractInstanceReferenceMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractInstanceReferenceMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final InstanceReferenceMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceReferenceMetric instanceReferenceMetric = new InstanceReferenceMetric(); + instanceReferenceMetric.setId(resultSet.getString(InstanceReferenceMetricTable.COLUMN_ID)); + instanceReferenceMetric.setMetricId(resultSet.getString(InstanceReferenceMetricTable.COLUMN_METRIC_ID)); + + instanceReferenceMetric.setFrontApplicationId(resultSet.getInt(InstanceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID)); + instanceReferenceMetric.setBehindApplicationId(resultSet.getInt(InstanceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID)); + instanceReferenceMetric.setFrontInstanceId(resultSet.getInt(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID)); + instanceReferenceMetric.setBehindInstanceId(resultSet.getInt(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID)); + instanceReferenceMetric.setSourceValue(resultSet.getInt(InstanceReferenceMetricTable.COLUMN_SOURCE_VALUE)); + + instanceReferenceMetric.setTransactionCalls(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS)); + instanceReferenceMetric.setTransactionErrorCalls(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); + instanceReferenceMetric.setTransactionDurationSum(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); + instanceReferenceMetric.setTransactionErrorDurationSum(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); + + instanceReferenceMetric.setBusinessTransactionCalls(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); + instanceReferenceMetric.setBusinessTransactionErrorCalls(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); + instanceReferenceMetric.setBusinessTransactionDurationSum(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); + instanceReferenceMetric.setBusinessTransactionErrorDurationSum(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); + + instanceReferenceMetric.setMqTransactionCalls(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); + instanceReferenceMetric.setMqTransactionErrorCalls(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); + instanceReferenceMetric.setMqTransactionDurationSum(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); + instanceReferenceMetric.setMqTransactionErrorDurationSum(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); + + instanceReferenceMetric.setTimeBucket(resultSet.getLong(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET)); + return instanceReferenceMetric; + } + + @Override protected final Map streamDataToH2Data(InstanceReferenceMetric streamData) { + Map source = new HashMap<>(); + source.put(InstanceReferenceMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(InstanceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(InstanceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, streamData.getFrontInstanceId()); + source.put(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, streamData.getBehindInstanceId()); + source.put(InstanceReferenceMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls()); + source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls()); + source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum()); + source.put(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum()); + + source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls()); + source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls()); + source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum()); + source.put(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum()); + + source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls()); + source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls()); + source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum()); + source.put(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum()); + + source.put(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..4625c1c94 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.irmp; + +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.irmp.IInstanceReferenceDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceDayMetricH2PersistenceDAO extends AbstractInstanceReferenceMetricH2PersistenceDAO implements IInstanceReferenceDayMetricPersistenceDAO { + + public InstanceReferenceDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..c5432dbc1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.irmp; + +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.irmp.IInstanceReferenceHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceHourMetricH2PersistenceDAO extends AbstractInstanceReferenceMetricH2PersistenceDAO implements IInstanceReferenceHourMetricPersistenceDAO { + + public InstanceReferenceHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..e6a84cd60 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.irmp; + +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.irmp.IInstanceReferenceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMinuteMetricH2PersistenceDAO extends AbstractInstanceReferenceMetricH2PersistenceDAO implements IInstanceReferenceMinuteMetricPersistenceDAO { + + public InstanceReferenceMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..a696399ea --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/irmp/InstanceReferenceMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.irmp; + +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.irmp.IInstanceReferenceMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMonthMetricH2PersistenceDAO extends AbstractInstanceReferenceMetricH2PersistenceDAO implements IInstanceReferenceMonthMetricPersistenceDAO { + + public InstanceReferenceMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/AbstractServiceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/AbstractServiceMetricH2PersistenceDAO.java new file mode 100644 index 000000000..c8d7e6359 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/AbstractServiceMetricH2PersistenceDAO.java @@ -0,0 +1,96 @@ +/* + * 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.smp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractServiceMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + public AbstractServiceMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final ServiceMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + ServiceMetric serviceMetric = new ServiceMetric(); + serviceMetric.setId(resultSet.getString(ServiceMetricTable.COLUMN_ID)); + serviceMetric.setMetricId(resultSet.getString(ServiceMetricTable.COLUMN_METRIC_ID)); + + serviceMetric.setApplicationId(resultSet.getInt(ServiceMetricTable.COLUMN_APPLICATION_ID)); + serviceMetric.setInstanceId(resultSet.getInt(ServiceMetricTable.COLUMN_INSTANCE_ID)); + serviceMetric.setServiceId(resultSet.getInt(ServiceMetricTable.COLUMN_SERVICE_ID)); + serviceMetric.setSourceValue(resultSet.getInt(ServiceMetricTable.COLUMN_SOURCE_VALUE)); + + serviceMetric.setTransactionCalls(resultSet.getLong(ServiceMetricTable.COLUMN_TRANSACTION_CALLS)); + serviceMetric.setTransactionErrorCalls(resultSet.getLong(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); + serviceMetric.setTransactionDurationSum(resultSet.getLong(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); + serviceMetric.setTransactionErrorDurationSum(resultSet.getLong(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); + + serviceMetric.setBusinessTransactionCalls(resultSet.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); + serviceMetric.setBusinessTransactionErrorCalls(resultSet.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); + serviceMetric.setBusinessTransactionDurationSum(resultSet.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); + serviceMetric.setBusinessTransactionErrorDurationSum(resultSet.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); + + serviceMetric.setMqTransactionCalls(resultSet.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); + serviceMetric.setMqTransactionErrorCalls(resultSet.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); + serviceMetric.setMqTransactionDurationSum(resultSet.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); + serviceMetric.setMqTransactionErrorDurationSum(resultSet.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); + + serviceMetric.setTimeBucket(resultSet.getLong(ServiceMetricTable.COLUMN_TIME_BUCKET)); + return serviceMetric; + } + + @Override protected final Map streamDataToH2Data(ServiceMetric streamData) { + Map source = new HashMap<>(); + source.put(ServiceMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ServiceMetricTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(ServiceMetricTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(ServiceMetricTable.COLUMN_SERVICE_ID, streamData.getServiceId()); + source.put(ServiceMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls()); + source.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls()); + source.put(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum()); + source.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum()); + + source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls()); + source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls()); + source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum()); + source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum()); + + source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls()); + source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls()); + source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum()); + source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum()); + + source.put(ServiceMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..f2af31a86 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.smp; + +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.smp.IServiceDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceDayMetricH2PersistenceDAO extends AbstractServiceMetricH2PersistenceDAO implements IServiceDayMetricPersistenceDAO { + + public ServiceDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..a73cde0c6 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java @@ -0,0 +1,42 @@ +/* + * 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.smp; + +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.smp.IServiceHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceHourMetricH2PersistenceDAO extends AbstractServiceMetricH2PersistenceDAO implements IServiceHourMetricPersistenceDAO { + + public ServiceHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..7b9a22db8 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.smp; + +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.smp.IServiceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceMinuteMetricH2PersistenceDAO extends AbstractServiceMetricH2PersistenceDAO implements IServiceMinuteMetricPersistenceDAO { + + public ServiceMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..6b537ce70 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.smp; + +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.smp.IServiceMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceMonthMetricH2PersistenceDAO extends AbstractServiceMetricH2PersistenceDAO implements IServiceMonthMetricPersistenceDAO { + + public ServiceMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/AbstractServiceReferenceMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/AbstractServiceReferenceMetricH2PersistenceDAO.java new file mode 100644 index 000000000..d482c8ef4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/AbstractServiceReferenceMetricH2PersistenceDAO.java @@ -0,0 +1,102 @@ +/* + * 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.srmp; + +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.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractServiceReferenceMetricH2PersistenceDAO extends AbstractPersistenceH2DAO { + + AbstractServiceReferenceMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected final ServiceReferenceMetric h2DataToStreamData(ResultSet resultSet) throws SQLException { + ServiceReferenceMetric serviceReferenceMetric = new ServiceReferenceMetric(); + serviceReferenceMetric.setId(resultSet.getString(ServiceReferenceMetricTable.COLUMN_ID)); + serviceReferenceMetric.setMetricId(resultSet.getString(ServiceReferenceMetricTable.COLUMN_METRIC_ID)); + + serviceReferenceMetric.setFrontApplicationId(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID)); + serviceReferenceMetric.setBehindApplicationId(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID)); + serviceReferenceMetric.setFrontInstanceId(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID)); + serviceReferenceMetric.setBehindInstanceId(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID)); + serviceReferenceMetric.setFrontServiceId(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID)); + serviceReferenceMetric.setBehindServiceId(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID)); + serviceReferenceMetric.setSourceValue(resultSet.getInt(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE)); + + serviceReferenceMetric.setTransactionCalls(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS)); + serviceReferenceMetric.setTransactionErrorCalls(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); + serviceReferenceMetric.setTransactionDurationSum(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); + serviceReferenceMetric.setTransactionErrorDurationSum(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); + + serviceReferenceMetric.setBusinessTransactionCalls(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); + serviceReferenceMetric.setBusinessTransactionErrorCalls(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); + serviceReferenceMetric.setBusinessTransactionDurationSum(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); + serviceReferenceMetric.setBusinessTransactionErrorDurationSum(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); + + serviceReferenceMetric.setMqTransactionCalls(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); + serviceReferenceMetric.setMqTransactionErrorCalls(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); + serviceReferenceMetric.setMqTransactionDurationSum(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); + serviceReferenceMetric.setMqTransactionErrorDurationSum(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); + + serviceReferenceMetric.setTimeBucket(resultSet.getLong(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET)); + return serviceReferenceMetric; + } + + @Override protected final Map streamDataToH2Data(ServiceReferenceMetric streamData) { + Map source = new HashMap<>(); + source.put(ServiceReferenceMetricTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ServiceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(ServiceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, streamData.getFrontInstanceId()); + source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, streamData.getBehindInstanceId()); + source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, streamData.getFrontServiceId()); + source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, streamData.getBehindServiceId()); + source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls()); + source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls()); + source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum()); + source.put(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum()); + + source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls()); + source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls()); + source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum()); + source.put(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum()); + + source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls()); + source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls()); + source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum()); + source.put(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum()); + + source.put(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceDayMetricH2PersistenceDAO.java new file mode 100644 index 000000000..66bc73ebc --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceDayMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.srmp; + +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.srmp.IServiceReferenceDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceDayMetricH2PersistenceDAO extends AbstractServiceReferenceMetricH2PersistenceDAO implements IServiceReferenceDayMetricPersistenceDAO { + + public ServiceReferenceDayMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceHourMetricH2PersistenceDAO.java new file mode 100644 index 000000000..5e251d45c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceHourMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.srmp; + +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.srmp.IServiceReferenceHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceHourMetricH2PersistenceDAO extends AbstractServiceReferenceMetricH2PersistenceDAO implements IServiceReferenceHourMetricPersistenceDAO { + + public ServiceReferenceHourMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMinuteMetricH2PersistenceDAO.java new file mode 100644 index 000000000..fb2fefed1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMinuteMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.srmp; + +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.srmp.IServiceReferenceMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMinuteMetricH2PersistenceDAO extends AbstractServiceReferenceMetricH2PersistenceDAO implements IServiceReferenceMinuteMetricPersistenceDAO { + + public ServiceReferenceMinuteMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMonthMetricH2PersistenceDAO.java new file mode 100644 index 000000000..ce7b29316 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/srmp/ServiceReferenceMonthMetricH2PersistenceDAO.java @@ -0,0 +1,41 @@ +/* + * 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.srmp; + +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.srmp.IServiceReferenceMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMonthMetricH2PersistenceDAO extends AbstractServiceReferenceMetricH2PersistenceDAO implements IServiceReferenceMonthMetricPersistenceDAO { + + public ServiceReferenceMonthMetricH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/AbstractApplicationMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/AbstractApplicationMetricH2TableDefine.java new file mode 100644 index 000000000..e02b621f1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/AbstractApplicationMetricH2TableDefine.java @@ -0,0 +1,61 @@ +/* + * 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.amp; + +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.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationMetricH2TableDefine extends H2TableDefine { + + public AbstractApplicationMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationDayMetricH2TableDefine.java new file mode 100644 index 000000000..530777049 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.amp; + +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.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationDayMetricH2TableDefine extends AbstractApplicationMetricH2TableDefine { + + public ApplicationDayMetricH2TableDefine() { + super(ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationHourMetricH2TableDefine.java new file mode 100644 index 000000000..ad6f7f0ed --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.amp; + +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.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationHourMetricH2TableDefine extends AbstractApplicationMetricH2TableDefine { + + public ApplicationHourMetricH2TableDefine() { + super(ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..f7ade1f6b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.amp; + +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.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMinuteMetricH2TableDefine extends AbstractApplicationMetricH2TableDefine { + + public ApplicationMinuteMetricH2TableDefine() { + super(ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMonthMetricH2TableDefine.java new file mode 100644 index 000000000..6df3be8cd --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/amp/ApplicationMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.amp; + +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.application.ApplicationMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationMonthMetricH2TableDefine extends AbstractApplicationMetricH2TableDefine { + + public ApplicationMonthMetricH2TableDefine() { + super(ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/AbstractApplicationReferenceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/AbstractApplicationReferenceMetricH2TableDefine.java new file mode 100644 index 000000000..2d1568247 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/AbstractApplicationReferenceMetricH2TableDefine.java @@ -0,0 +1,61 @@ +/* + * 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.armp; + +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.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationReferenceMetricH2TableDefine extends H2TableDefine { + + AbstractApplicationReferenceMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceDayMetricH2TableDefine.java new file mode 100644 index 000000000..307c100d9 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.armp; + +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.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceDayMetricH2TableDefine extends AbstractApplicationReferenceMetricH2TableDefine { + + public ApplicationReferenceDayMetricH2TableDefine() { + super(ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceHourMetricH2TableDefine.java new file mode 100644 index 000000000..40a70bae8 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.armp; + +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.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceHourMetricH2TableDefine extends AbstractApplicationReferenceMetricH2TableDefine { + + public ApplicationReferenceHourMetricH2TableDefine() { + super(ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..cd9a3e329 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.armp; + +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.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceMinuteMetricH2TableDefine extends AbstractApplicationReferenceMetricH2TableDefine { + + public ApplicationReferenceMinuteMetricH2TableDefine() { + super(ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMonthMetricH2TableDefine.java new file mode 100644 index 000000000..39cff15ec --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/armp/ApplicationReferenceMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.armp; + +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.application.ApplicationReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceMonthMetricH2TableDefine extends AbstractApplicationReferenceMetricH2TableDefine { + + public ApplicationReferenceMonthMetricH2TableDefine() { + super(ApplicationReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/AbstractInstanceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/AbstractInstanceMetricH2TableDefine.java new file mode 100644 index 000000000..41f574924 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/AbstractInstanceMetricH2TableDefine.java @@ -0,0 +1,58 @@ +/* + * 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.imp; + +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.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractInstanceMetricH2TableDefine extends H2TableDefine { + + AbstractInstanceMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceDayMetricH2TableDefine.java new file mode 100644 index 000000000..a92772d35 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.imp; + +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.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceDayMetricH2TableDefine extends AbstractInstanceMetricH2TableDefine { + + public InstanceDayMetricH2TableDefine() { + super(InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceHourMetricH2TableDefine.java new file mode 100644 index 000000000..42634db68 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.imp; + +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.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceHourMetricH2TableDefine extends AbstractInstanceMetricH2TableDefine { + + public InstanceHourMetricH2TableDefine() { + super(InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..0991d637b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.imp; + +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.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMinuteMetricH2TableDefine extends AbstractInstanceMetricH2TableDefine { + + public InstanceMinuteMetricH2TableDefine() { + super(InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMonthMetricH2TableDefine.java new file mode 100644 index 000000000..881aad5bb --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/imp/InstanceMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.imp; + +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.instance.InstanceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceMonthMetricH2TableDefine extends AbstractInstanceMetricH2TableDefine { + + public InstanceMonthMetricH2TableDefine() { + super(InstanceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/AbstractInstanceReferenceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/AbstractInstanceReferenceMetricH2TableDefine.java new file mode 100644 index 000000000..a1e83fae5 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/AbstractInstanceReferenceMetricH2TableDefine.java @@ -0,0 +1,60 @@ +/* + * 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.irmp; + +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.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractInstanceReferenceMetricH2TableDefine extends H2TableDefine { + + AbstractInstanceReferenceMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceDayMetricH2TableDefine.java new file mode 100644 index 000000000..6cab3f1ec --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceDayMetricH2TableDefine.java @@ -0,0 +1,34 @@ +/* + * 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.irmp; + +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.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceDayMetricH2TableDefine extends AbstractInstanceReferenceMetricH2TableDefine { + + public InstanceReferenceDayMetricH2TableDefine() { + super(InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } + +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceHourMetricH2TableDefine.java new file mode 100644 index 000000000..73b4f7cf7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceHourMetricH2TableDefine.java @@ -0,0 +1,34 @@ +/* + * 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.irmp; + +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.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceHourMetricH2TableDefine extends AbstractInstanceReferenceMetricH2TableDefine { + + public InstanceReferenceHourMetricH2TableDefine() { + super(InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } + +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..481e3a6ba --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMinuteMetricH2TableDefine.java @@ -0,0 +1,34 @@ +/* + * 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.irmp; + +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.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMinuteMetricH2TableDefine extends AbstractInstanceReferenceMetricH2TableDefine { + + public InstanceReferenceMinuteMetricH2TableDefine() { + super(InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } + +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMonthMetricH2TableDefine.java new file mode 100644 index 000000000..9f6908dd4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/irmp/InstanceReferenceMonthMetricH2TableDefine.java @@ -0,0 +1,34 @@ +/* + * 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.irmp; + +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.instance.InstanceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMonthMetricH2TableDefine extends AbstractInstanceReferenceMetricH2TableDefine { + + public InstanceReferenceMonthMetricH2TableDefine() { + super(InstanceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } + +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/AbstractServiceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/AbstractServiceMetricH2TableDefine.java new file mode 100644 index 000000000..476ef5aef --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/AbstractServiceMetricH2TableDefine.java @@ -0,0 +1,59 @@ +/* + * 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.smp; + +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.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractServiceMetricH2TableDefine extends H2TableDefine { + + AbstractServiceMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceDayMetricH2TableDefine.java new file mode 100644 index 000000000..262f793c3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.smp; + +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.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceDayMetricH2TableDefine extends AbstractServiceMetricH2TableDefine { + + public ServiceDayMetricH2TableDefine() { + super(ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceHourMetricH2TableDefine.java new file mode 100644 index 000000000..8c67a95fc --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.smp; + +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.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceHourMetricH2TableDefine extends AbstractServiceMetricH2TableDefine { + + public ServiceHourMetricH2TableDefine() { + super(ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..f35f53514 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.smp; + +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.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceMinuteMetricH2TableDefine extends AbstractServiceMetricH2TableDefine { + + public ServiceMinuteMetricH2TableDefine() { + super(ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMonthMetricH2TableDefine.java new file mode 100644 index 000000000..6b08167f4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/smp/ServiceMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.smp; + +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.service.ServiceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceMonthMetricH2TableDefine extends AbstractServiceMetricH2TableDefine { + + public ServiceMonthMetricH2TableDefine() { + super(ServiceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/AbstractServiceReferenceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/AbstractServiceReferenceMetricH2TableDefine.java new file mode 100644 index 000000000..c30f1d5b7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/AbstractServiceReferenceMetricH2TableDefine.java @@ -0,0 +1,63 @@ +/* + * 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.srmp; + +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.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractServiceReferenceMetricH2TableDefine extends H2TableDefine { + + public AbstractServiceReferenceMetricH2TableDefine(String name) { + super(name); + } + + @Override public final void initialize() { + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceDayMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceDayMetricH2TableDefine.java new file mode 100644 index 000000000..bb5170177 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceDayMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.srmp; + +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.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceDayMetricH2TableDefine extends AbstractServiceReferenceMetricH2TableDefine { + + public ServiceReferenceDayMetricH2TableDefine() { + super(ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceHourMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceHourMetricH2TableDefine.java new file mode 100644 index 000000000..a6c2bdf89 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceHourMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.srmp; + +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.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceHourMetricH2TableDefine extends AbstractServiceReferenceMetricH2TableDefine { + + public ServiceReferenceHourMetricH2TableDefine() { + super(ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMinuteMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMinuteMetricH2TableDefine.java new file mode 100644 index 000000000..3c6881da0 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMinuteMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.srmp; + +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.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMinuteMetricH2TableDefine extends AbstractServiceReferenceMetricH2TableDefine { + + public ServiceReferenceMinuteMetricH2TableDefine() { + super(ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMonthMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMonthMetricH2TableDefine.java new file mode 100644 index 000000000..acd07ef18 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/srmp/ServiceReferenceMonthMetricH2TableDefine.java @@ -0,0 +1,33 @@ +/* + * 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.srmp; + +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.service.ServiceReferenceMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMonthMetricH2TableDefine extends AbstractServiceReferenceMetricH2TableDefine { + + public ServiceReferenceMonthMetricH2TableDefine() { + super(ServiceReferenceMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName()); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index 1c8275096..5e73ed2d6 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -44,4 +44,34 @@ org.apache.skywalking.apm.collector.storage.h2.define.instmapping.InstanceMappin org.apache.skywalking.apm.collector.storage.h2.define.GlobalTraceH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.SegmentCostH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.SegmentH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.SegmentH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.amp.ApplicationMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.amp.ApplicationHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.amp.ApplicationDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.amp.ApplicationMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.armp.ApplicationReferenceMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.armp.ApplicationReferenceHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.armp.ApplicationReferenceDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.armp.ApplicationReferenceMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.imp.InstanceMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.imp.InstanceHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.imp.InstanceDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.imp.InstanceMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.irmp.InstanceReferenceMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.irmp.InstanceReferenceHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.irmp.InstanceReferenceDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.irmp.InstanceReferenceMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.smp.ServiceMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.smp.ServiceHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.smp.ServiceDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.smp.ServiceMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceMinuteMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceHourMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceDayMetricH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceMonthMetricH2TableDefine \ No newline at end of file From 2609e27349c9bafe14b8037a7803cb5d34c7eeea Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Fri, 12 Jan 2018 22:20:24 +0800 Subject: [PATCH 16/18] Alarm aggregate by h2 storage test successful. --- .../provider/AnalysisAlarmModuleProvider.java | 44 ++--- .../src/main/resources/application.yml | 20 ++- .../apm/collector/storage/StorageModule.java | 38 +++-- .../storage/h2/StorageModuleH2Provider.java | 50 ++++-- .../dao/ApplicationAlarmH2PersistenceDAO.java | 55 ------ .../ApplicationAlarmListH2PersistenceDAO.java | 55 ------ ...plicationMinuteMetricH2PersistenceDAO.java | 153 ----------------- ...icationReferenceAlarmH2PersistenceDAO.java | 55 ------ ...ionReferenceAlarmListH2PersistenceDAO.java | 55 ------ ...ReferenceMinuteMetricH2PersistenceDAO.java | 156 ------------------ .../h2/dao/InstanceAlarmH2PersistenceDAO.java | 55 ------ .../InstanceAlarmListH2PersistenceDAO.java | 55 ------ .../InstanceMinuteMetricH2PersistenceDAO.java | 146 ---------------- ...nstanceReferenceAlarmH2PersistenceDAO.java | 55 ------ ...nceReferenceAlarmListH2PersistenceDAO.java | 55 ------ .../h2/dao/ServiceAlarmH2PersistenceDAO.java | 55 ------ .../dao/ServiceAlarmListH2PersistenceDAO.java | 55 ------ .../ServiceMinuteMetricH2PersistenceDAO.java | 148 ----------------- ...ServiceReferenceAlarmH2PersistenceDAO.java | 55 ------ ...iceReferenceAlarmListH2PersistenceDAO.java | 55 ------ .../ApplicationAlarmH2PersistenceDAO.java | 73 ++++++++ .../ApplicationAlarmListH2PersistenceDAO.java | 73 ++++++++ ...icationReferenceAlarmH2PersistenceDAO.java | 75 +++++++++ ...ionReferenceAlarmListH2PersistenceDAO.java | 75 +++++++++ .../alarm/InstanceAlarmH2PersistenceDAO.java | 75 +++++++++ .../InstanceAlarmListH2PersistenceDAO.java | 75 +++++++++ ...nstanceReferenceAlarmH2PersistenceDAO.java | 80 +++++++++ ...nceReferenceAlarmListH2PersistenceDAO.java | 79 +++++++++ .../alarm/ServiceAlarmH2PersistenceDAO.java | 77 +++++++++ .../ServiceAlarmListH2PersistenceDAO.java | 77 +++++++++ ...ServiceReferenceAlarmH2PersistenceDAO.java | 83 ++++++++++ ...iceReferenceAlarmListH2PersistenceDAO.java | 83 ++++++++++ ...plicationReferenceMetricH2TableDefine.java | 61 ------- .../define/InstanceMetricH2TableDefine.java | 57 ------- .../InstanceReferenceMetricH2TableDefine.java | 56 ------- .../h2/define/ServiceMetricH2TableDefine.java | 56 ------- .../ServiceReferenceMetricH2TableDefine.java | 58 ------- .../alarm/ApplicationAlarmH2TableDefine.java | 45 +++++ .../ApplicationAlarmListH2TableDefine.java | 45 +++++ ...pplicationReferenceAlarmH2TableDefine.java | 46 ++++++ ...cationReferenceAlarmListH2TableDefine.java | 46 ++++++ .../alarm/InstanceAlarmH2TableDefine.java | 46 ++++++ .../alarm/InstanceAlarmListH2TableDefine.java | 46 ++++++ .../InstanceReferenceAlarmH2TableDefine.java | 48 ++++++ ...stanceReferenceAlarmListH2TableDefine.java | 48 ++++++ .../alarm/ServiceAlarmH2TableDefine.java | 47 ++++++ .../alarm/ServiceAlarmListH2TableDefine.java | 47 ++++++ .../ServiceReferenceAlarmH2TableDefine.java | 50 ++++++ ...erviceReferenceAlarmListH2TableDefine.java | 50 ++++++ .../resources/META-INF/defines/storage.define | 15 +- 50 files changed, 1599 insertions(+), 1608 deletions(-) delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmListH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMinuteMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmListH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceMinuteMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmListH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMinuteMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmListH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmListH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceMinuteMetricH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmListH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmListH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmListH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmListH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmListH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmListH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmH2PersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmListH2PersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationReferenceMetricH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMetricH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceReferenceMetricH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceMetricH2TableDefine.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceReferenceMetricH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmListH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmListH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmListH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmListH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmListH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmH2TableDefine.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmListH2TableDefine.java diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java index 7a547edcc..9c560ff4a 100644 --- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java @@ -54,28 +54,28 @@ public class AnalysisAlarmModuleProvider extends ModuleProvider { } @Override public void start(Properties config) throws ServiceNotProvidedException { -// WorkerCreateListener workerCreateListener = new WorkerCreateListener(); -// -// ServiceMetricAlarmGraph serviceMetricAlarmGraph = new ServiceMetricAlarmGraph(getManager(), workerCreateListener); -// serviceMetricAlarmGraph.create(); -// -// InstanceMetricAlarmGraph instanceMetricAlarmGraph = new InstanceMetricAlarmGraph(getManager(), workerCreateListener); -// instanceMetricAlarmGraph.create(); -// -// ApplicationMetricAlarmGraph applicationMetricAlarmGraph = new ApplicationMetricAlarmGraph(getManager(), workerCreateListener); -// applicationMetricAlarmGraph.create(); -// -// ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener); -// serviceReferenceMetricAlarmGraph.create(); -// -// InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener); -// instanceReferenceMetricAlarmGraph.create(); -// -// ApplicationReferenceMetricAlarmGraph applicationReferenceMetricAlarmGraph = new ApplicationReferenceMetricAlarmGraph(getManager(), workerCreateListener); -// applicationReferenceMetricAlarmGraph.create(); -// -// PersistenceTimer persistenceTimer = new PersistenceTimer(AnalysisAlarmModule.NAME); -// persistenceTimer.start(getManager(), workerCreateListener.getPersistenceWorkers()); + WorkerCreateListener workerCreateListener = new WorkerCreateListener(); + + ServiceMetricAlarmGraph serviceMetricAlarmGraph = new ServiceMetricAlarmGraph(getManager(), workerCreateListener); + serviceMetricAlarmGraph.create(); + + InstanceMetricAlarmGraph instanceMetricAlarmGraph = new InstanceMetricAlarmGraph(getManager(), workerCreateListener); + instanceMetricAlarmGraph.create(); + + ApplicationMetricAlarmGraph applicationMetricAlarmGraph = new ApplicationMetricAlarmGraph(getManager(), workerCreateListener); + applicationMetricAlarmGraph.create(); + + ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener); + serviceReferenceMetricAlarmGraph.create(); + + InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener); + instanceReferenceMetricAlarmGraph.create(); + + ApplicationReferenceMetricAlarmGraph applicationReferenceMetricAlarmGraph = new ApplicationReferenceMetricAlarmGraph(getManager(), workerCreateListener); + applicationReferenceMetricAlarmGraph.create(); + + PersistenceTimer persistenceTimer = new PersistenceTimer(AnalysisAlarmModule.NAME); + persistenceTimer.start(getManager(), workerCreateListener.getPersistenceWorkers()); } @Override public void notifyAfterCompleted() throws ServiceNotProvidedException { diff --git a/apm-collector/apm-collector-boot/src/main/resources/application.yml b/apm-collector/apm-collector-boot/src/main/resources/application.yml index dfbc142e7..82d82b278 100644 --- a/apm-collector/apm-collector-boot/src/main/resources/application.yml +++ b/apm-collector/apm-collector-boot/src/main/resources/application.yml @@ -34,14 +34,18 @@ ui: host: localhost port: 12800 context_path: / -storage: - elasticsearch: - cluster_name: CollectorDBCluster - cluster_transport_sniffer: true - cluster_nodes: localhost:9300 - index_shards_number: 2 - index_replicas_number: 0 - ttl: 7 +#storage: +# elasticsearch: +# cluster_name: CollectorDBCluster +# cluster_transport_sniffer: true +# cluster_nodes: localhost:9300 +# index_shards_number: 2 +# index_replicas_number: 0 +# ttl: 7 +#storage: +# h2: +# url: jdbc:h2:tcp://localhost/~/test +# user_name: sa configuration: default: application_apdex_threshold: 2000 diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java index 2f01ffa65..769b8154f 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java @@ -43,6 +43,18 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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; @@ -237,18 +249,18 @@ public class StorageModule extends Module { } private void addAlarmDAO(List classes) { -// classes.add(IServiceReferenceAlarmPersistenceDAO.class); -// classes.add(IServiceReferenceAlarmListPersistenceDAO.class); -// classes.add(IInstanceReferenceAlarmPersistenceDAO.class); -// classes.add(IInstanceReferenceAlarmListPersistenceDAO.class); -// classes.add(IApplicationReferenceAlarmPersistenceDAO.class); -// classes.add(IApplicationReferenceAlarmListPersistenceDAO.class); -// -// classes.add(IServiceAlarmPersistenceDAO.class); -// classes.add(IServiceAlarmListPersistenceDAO.class); -// classes.add(IInstanceAlarmPersistenceDAO.class); -// classes.add(IInstanceAlarmListPersistenceDAO.class); -// classes.add(IApplicationAlarmPersistenceDAO.class); -// classes.add(IApplicationAlarmListPersistenceDAO.class); + classes.add(IServiceReferenceAlarmPersistenceDAO.class); + classes.add(IServiceReferenceAlarmListPersistenceDAO.class); + classes.add(IInstanceReferenceAlarmPersistenceDAO.class); + classes.add(IInstanceReferenceAlarmListPersistenceDAO.class); + classes.add(IApplicationReferenceAlarmPersistenceDAO.class); + classes.add(IApplicationReferenceAlarmListPersistenceDAO.class); + + classes.add(IServiceAlarmPersistenceDAO.class); + classes.add(IServiceAlarmListPersistenceDAO.class); + classes.add(IInstanceAlarmPersistenceDAO.class); + classes.add(IInstanceAlarmListPersistenceDAO.class); + classes.add(IApplicationAlarmPersistenceDAO.class); + classes.add(IApplicationAlarmListPersistenceDAO.class); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java index e362238b9..c7736d1c2 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java @@ -48,6 +48,18 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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; @@ -131,6 +143,18 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationCompone import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentHourH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMinuteH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMonthH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmListH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationReferenceAlarmH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationReferenceAlarmListH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.InstanceAlarmH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.InstanceAlarmListH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.InstanceReferenceAlarmH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.InstanceReferenceAlarmListH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ServiceAlarmH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ServiceAlarmListH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ServiceReferenceAlarmH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ServiceReferenceAlarmListH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationDayMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationHourMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.amp.ApplicationMinuteMetricH2PersistenceDAO; @@ -357,18 +381,18 @@ public class StorageModuleH2Provider extends ModuleProvider { } private void registerAlarmDAO() throws ServiceNotProvidedException { -// this.registerServiceImplementation(IServiceReferenceAlarmPersistenceDAO.class, new ServiceReferenceAlarmH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IServiceReferenceAlarmListPersistenceDAO.class, new ServiceReferenceAlarmListH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceReferenceAlarmPersistenceDAO.class, new InstanceReferenceAlarmH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceReferenceAlarmListPersistenceDAO.class, new InstanceReferenceAlarmListH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationReferenceAlarmPersistenceDAO.class, new ApplicationReferenceAlarmH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationReferenceAlarmListPersistenceDAO.class, new ApplicationReferenceAlarmListH2PersistenceDAO(h2Client)); -// -// this.registerServiceImplementation(IServiceAlarmPersistenceDAO.class, new ServiceAlarmH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IServiceAlarmListPersistenceDAO.class, new ServiceAlarmListH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceAlarmPersistenceDAO.class, new InstanceAlarmH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IInstanceAlarmListPersistenceDAO.class, new InstanceAlarmListH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationAlarmPersistenceDAO.class, new ApplicationAlarmH2PersistenceDAO(h2Client)); -// this.registerServiceImplementation(IApplicationAlarmListPersistenceDAO.class, new ApplicationAlarmListH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceReferenceAlarmPersistenceDAO.class, new ServiceReferenceAlarmH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceReferenceAlarmListPersistenceDAO.class, new ServiceReferenceAlarmListH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceReferenceAlarmPersistenceDAO.class, new InstanceReferenceAlarmH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceReferenceAlarmListPersistenceDAO.class, new InstanceReferenceAlarmListH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationReferenceAlarmPersistenceDAO.class, new ApplicationReferenceAlarmH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationReferenceAlarmListPersistenceDAO.class, new ApplicationReferenceAlarmListH2PersistenceDAO(h2Client)); + + this.registerServiceImplementation(IServiceAlarmPersistenceDAO.class, new ServiceAlarmH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IServiceAlarmListPersistenceDAO.class, new ServiceAlarmListH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceAlarmPersistenceDAO.class, new InstanceAlarmH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IInstanceAlarmListPersistenceDAO.class, new InstanceAlarmListH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationAlarmPersistenceDAO.class, new ApplicationAlarmH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationAlarmListPersistenceDAO.class, new ApplicationAlarmListH2PersistenceDAO(h2Client)); } } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmH2PersistenceDAO.java deleted file mode 100644 index bd31913ca..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationAlarmH2PersistenceDAO extends H2DAO implements IApplicationAlarmPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationAlarmH2PersistenceDAO.class); - - public ApplicationAlarmH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationAlarm get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationAlarm data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationAlarm data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmListH2PersistenceDAO.java deleted file mode 100644 index 9d9a85045..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationAlarmListH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationAlarmListH2PersistenceDAO extends H2DAO implements IApplicationAlarmListPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationAlarmListH2PersistenceDAO.class); - - public ApplicationAlarmListH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationAlarmList get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationAlarmList data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationAlarmList data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMinuteMetricH2PersistenceDAO.java deleted file mode 100644 index 4eee8a0a5..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationMinuteMetricH2PersistenceDAO.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationMinuteMetricH2PersistenceDAO extends H2DAO implements IApplicationMinuteMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationMinuteMetricH2PersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public ApplicationMinuteMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationMetric get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ApplicationMetricTable.TABLE, ApplicationMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - ApplicationMetric applicationMetric = new ApplicationMetric(); - applicationMetric.setId(id); - applicationMetric.setApplicationId(rs.getInt(ApplicationMetricTable.COLUMN_APPLICATION_ID)); - - applicationMetric.setTransactionCalls(rs.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS)); - applicationMetric.setTransactionErrorCalls(rs.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); - applicationMetric.setTransactionDurationSum(rs.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); - applicationMetric.setTransactionErrorDurationSum(rs.getLong(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); - - applicationMetric.setBusinessTransactionCalls(rs.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); - applicationMetric.setBusinessTransactionErrorCalls(rs.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); - applicationMetric.setBusinessTransactionDurationSum(rs.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); - applicationMetric.setBusinessTransactionErrorDurationSum(rs.getLong(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); - - applicationMetric.setMqTransactionCalls(rs.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); - applicationMetric.setMqTransactionErrorCalls(rs.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); - applicationMetric.setMqTransactionDurationSum(rs.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); - applicationMetric.setMqTransactionErrorDurationSum(rs.getLong(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); - - applicationMetric.setSatisfiedCount(rs.getLong(ApplicationMetricTable.COLUMN_SATISFIED_COUNT)); - applicationMetric.setToleratingCount(rs.getLong(ApplicationMetricTable.COLUMN_TOLERATING_COUNT)); - applicationMetric.setFrustratedCount(rs.getLong(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT)); - applicationMetric.setTimeBucket(rs.getLong(ApplicationMetricTable.COLUMN_TIME_BUCKET)); - return applicationMetric; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationMetricTable.COLUMN_ID, data.getId()); - source.put(ApplicationMetricTable.COLUMN_APPLICATION_ID, data.getApplicationId()); - - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, data.getSatisfiedCount()); - source.put(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, data.getToleratingCount()); - source.put(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, data.getFrustratedCount()); - source.put(ApplicationMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchInsertSql(ApplicationMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationMetricTable.COLUMN_APPLICATION_ID, data.getApplicationId()); - - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, data.getSatisfiedCount()); - source.put(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, data.getToleratingCount()); - source.put(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, data.getFrustratedCount()); - source.put(ApplicationMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(ApplicationMetricTable.TABLE, source.keySet(), ApplicationMetricTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmH2PersistenceDAO.java deleted file mode 100644 index 92bed74fa..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationReferenceAlarmH2PersistenceDAO extends H2DAO implements IApplicationReferenceAlarmPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationReferenceAlarmH2PersistenceDAO.class); - - public ApplicationReferenceAlarmH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationReferenceAlarm get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationReferenceAlarm data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationReferenceAlarm data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmListH2PersistenceDAO.java deleted file mode 100644 index 25c21724c..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceAlarmListH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationReferenceAlarmListH2PersistenceDAO extends H2DAO implements IApplicationReferenceAlarmListPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationReferenceAlarmListH2PersistenceDAO.class); - - public ApplicationReferenceAlarmListH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationReferenceAlarmList get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationReferenceAlarmList data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationReferenceAlarmList data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceMinuteMetricH2PersistenceDAO.java deleted file mode 100644 index d9e4ea4dc..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationReferenceMinuteMetricH2PersistenceDAO.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationReferenceMinuteMetricH2PersistenceDAO extends H2DAO implements IApplicationReferenceMinuteMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationReferenceMinuteMetricH2PersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public ApplicationReferenceMinuteMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ApplicationReferenceMetric get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ApplicationReferenceMetricTable.TABLE, ApplicationReferenceMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - ApplicationReferenceMetric applicationReferenceMetric = new ApplicationReferenceMetric(); - applicationReferenceMetric.setId(id); - applicationReferenceMetric.setFrontApplicationId(rs.getInt(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID)); - applicationReferenceMetric.setBehindApplicationId(rs.getInt(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID)); - - applicationReferenceMetric.setTransactionCalls(rs.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS)); - applicationReferenceMetric.setTransactionErrorCalls(rs.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); - applicationReferenceMetric.setTransactionDurationSum(rs.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); - applicationReferenceMetric.setTransactionErrorDurationSum(rs.getLong(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); - - applicationReferenceMetric.setBusinessTransactionCalls(rs.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); - applicationReferenceMetric.setBusinessTransactionErrorCalls(rs.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); - applicationReferenceMetric.setBusinessTransactionDurationSum(rs.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); - applicationReferenceMetric.setBusinessTransactionErrorDurationSum(rs.getLong(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); - - applicationReferenceMetric.setMqTransactionCalls(rs.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); - applicationReferenceMetric.setMqTransactionErrorCalls(rs.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); - applicationReferenceMetric.setMqTransactionDurationSum(rs.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); - applicationReferenceMetric.setMqTransactionErrorDurationSum(rs.getLong(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); - - applicationReferenceMetric.setSatisfiedCount(rs.getLong(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT)); - applicationReferenceMetric.setToleratingCount(rs.getLong(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT)); - applicationReferenceMetric.setFrustratedCount(rs.getLong(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT)); - applicationReferenceMetric.setTimeBucket(rs.getLong(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET)); - return applicationReferenceMetric; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ApplicationReferenceMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationReferenceMetricTable.COLUMN_ID, data.getId()); - source.put(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, data.getFrontApplicationId()); - source.put(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, data.getBehindApplicationId()); - - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT, data.getSatisfiedCount()); - source.put(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT, data.getToleratingCount()); - source.put(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT, data.getFrustratedCount()); - source.put(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchInsertSql(ApplicationReferenceMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(ApplicationReferenceMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, data.getFrontApplicationId()); - source.put(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, data.getBehindApplicationId()); - - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT, data.getSatisfiedCount()); - source.put(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT, data.getToleratingCount()); - source.put(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT, data.getFrustratedCount()); - source.put(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(ApplicationReferenceMetricTable.TABLE, source.keySet(), ApplicationReferenceMetricTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmH2PersistenceDAO.java deleted file mode 100644 index b807b76e7..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceAlarmH2PersistenceDAO extends H2DAO implements IInstanceAlarmPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceAlarmH2PersistenceDAO.class); - - public InstanceAlarmH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceAlarm get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceAlarm data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceAlarm data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmListH2PersistenceDAO.java deleted file mode 100644 index ccf739a47..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceAlarmListH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceAlarmListH2PersistenceDAO extends H2DAO implements IInstanceAlarmListPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceAlarmListH2PersistenceDAO.class); - - public InstanceAlarmListH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceAlarmList get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceAlarmList data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceAlarmList data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMinuteMetricH2PersistenceDAO.java deleted file mode 100644 index 657370990..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMinuteMetricH2PersistenceDAO.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMinuteMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric; -import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceMinuteMetricH2PersistenceDAO extends H2DAO implements IInstanceMinuteMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceMinuteMetricH2PersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public InstanceMinuteMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceMetric get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, InstanceMetricTable.TABLE, InstanceMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - InstanceMetric instanceMetric = new InstanceMetric(); - instanceMetric.setId(id); - instanceMetric.setApplicationId(rs.getInt(InstanceMetricTable.COLUMN_APPLICATION_ID)); - instanceMetric.setInstanceId(rs.getInt(InstanceMetricTable.COLUMN_INSTANCE_ID)); - - instanceMetric.setTransactionCalls(rs.getLong(InstanceMetricTable.COLUMN_TRANSACTION_CALLS)); - instanceMetric.setTransactionErrorCalls(rs.getLong(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); - instanceMetric.setTransactionDurationSum(rs.getLong(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); - instanceMetric.setTransactionErrorDurationSum(rs.getLong(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); - - instanceMetric.setBusinessTransactionCalls(rs.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); - instanceMetric.setBusinessTransactionErrorCalls(rs.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); - instanceMetric.setBusinessTransactionDurationSum(rs.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); - instanceMetric.setBusinessTransactionErrorDurationSum(rs.getLong(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); - - instanceMetric.setMqTransactionCalls(rs.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); - instanceMetric.setMqTransactionErrorCalls(rs.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); - instanceMetric.setMqTransactionDurationSum(rs.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); - instanceMetric.setMqTransactionErrorDurationSum(rs.getLong(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); - - instanceMetric.setTimeBucket(rs.getLong(InstanceMetricTable.COLUMN_TIME_BUCKET)); - return instanceMetric; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstanceMetricTable.COLUMN_ID, data.getId()); - source.put(InstanceMetricTable.COLUMN_APPLICATION_ID, data.getApplicationId()); - source.put(InstanceMetricTable.COLUMN_INSTANCE_ID, data.getInstanceId()); - - source.put(InstanceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(InstanceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchInsertSql(InstanceMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceMetric data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstanceMetricTable.COLUMN_APPLICATION_ID, data.getApplicationId()); - source.put(InstanceMetricTable.COLUMN_INSTANCE_ID, data.getInstanceId()); - - source.put(InstanceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(InstanceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - String sql = SqlBuilder.buildBatchUpdateSql(InstanceMetricTable.TABLE, source.keySet(), InstanceMetricTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmH2PersistenceDAO.java deleted file mode 100644 index 7e67a9aee..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceReferenceAlarmH2PersistenceDAO extends H2DAO implements IInstanceReferenceAlarmPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceReferenceAlarmH2PersistenceDAO.class); - - public InstanceReferenceAlarmH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceReferenceAlarm get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceReferenceAlarm data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceReferenceAlarm data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmListH2PersistenceDAO.java deleted file mode 100644 index 1ea9c3227..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceReferenceAlarmListH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceReferenceAlarmListH2PersistenceDAO extends H2DAO implements IInstanceReferenceAlarmListPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceReferenceAlarmListH2PersistenceDAO.class); - - public InstanceReferenceAlarmListH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public InstanceReferenceAlarmList get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(InstanceReferenceAlarmList data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(InstanceReferenceAlarmList data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmH2PersistenceDAO.java deleted file mode 100644 index 05df9059e..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceAlarmH2PersistenceDAO extends H2DAO implements IServiceAlarmPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceAlarmH2PersistenceDAO.class); - - public ServiceAlarmH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ServiceAlarm get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ServiceAlarm data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ServiceAlarm data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmListH2PersistenceDAO.java deleted file mode 100644 index 88b3d2a61..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceAlarmListH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceAlarmListH2PersistenceDAO extends H2DAO implements IServiceAlarmListPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceAlarmListH2PersistenceDAO.class); - - public ServiceAlarmListH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ServiceAlarmList get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ServiceAlarmList data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ServiceAlarmList data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceMinuteMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceMinuteMetricH2PersistenceDAO.java deleted file mode 100644 index d8973f6e7..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceMinuteMetricH2PersistenceDAO.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -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.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; -import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceMinuteMetricH2PersistenceDAO extends H2DAO implements IServiceMinuteMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceMinuteMetricH2PersistenceDAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - public ServiceMinuteMetricH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override - public ServiceMetric get(String id) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ServiceMetricTable.TABLE, ServiceMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - ServiceMetric serviceMetric = new ServiceMetric(); - serviceMetric.setId(id); - serviceMetric.setServiceId(rs.getInt(ServiceMetricTable.COLUMN_SERVICE_ID)); - - serviceMetric.setTransactionCalls(rs.getLong(ServiceMetricTable.COLUMN_TRANSACTION_CALLS)); - serviceMetric.setTransactionErrorCalls(rs.getLong(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)); - serviceMetric.setTransactionDurationSum(rs.getLong(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM)); - serviceMetric.setTransactionErrorDurationSum(rs.getLong(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)); - - serviceMetric.setBusinessTransactionCalls(rs.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)); - serviceMetric.setBusinessTransactionErrorCalls(rs.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)); - serviceMetric.setBusinessTransactionDurationSum(rs.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)); - serviceMetric.setBusinessTransactionErrorDurationSum(rs.getLong(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)); - - serviceMetric.setMqTransactionCalls(rs.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS)); - serviceMetric.setMqTransactionErrorCalls(rs.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)); - serviceMetric.setMqTransactionDurationSum(rs.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)); - serviceMetric.setMqTransactionErrorDurationSum(rs.getLong(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)); - - serviceMetric.setTimeBucket(rs.getLong(ServiceMetricTable.COLUMN_TIME_BUCKET)); - return serviceMetric; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public H2SqlEntity prepareBatchInsert(ServiceMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceMetricTable.COLUMN_ID, data.getId()); - source.put(ServiceMetricTable.COLUMN_SERVICE_ID, data.getServiceId()); - - source.put(ServiceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ServiceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchInsertSql(ServiceMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override - public H2SqlEntity prepareBatchUpdate(ServiceMetric data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceMetricTable.COLUMN_SERVICE_ID, data.getServiceId()); - - source.put(ServiceMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls()); - source.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls()); - source.put(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum()); - source.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum()); - - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls()); - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls()); - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum()); - source.put(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum()); - - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls()); - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls()); - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum()); - source.put(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum()); - - source.put(ServiceMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - String sql = SqlBuilder.buildBatchUpdateSql(ServiceMetricTable.TABLE, source.keySet(), ServiceMetricTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(data.getId()); - entity.setParams(values.toArray(new Object[0])); - return entity; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmH2PersistenceDAO.java deleted file mode 100644 index 0625a185b..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceAlarmH2PersistenceDAO extends H2DAO implements IServiceReferenceAlarmPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceAlarmH2PersistenceDAO.class); - - public ServiceReferenceAlarmH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ServiceReferenceAlarm get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ServiceReferenceAlarm data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ServiceReferenceAlarm data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmListH2PersistenceDAO.java deleted file mode 100644 index 6b0b329b5..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ServiceReferenceAlarmListH2PersistenceDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceAlarmListH2PersistenceDAO extends H2DAO implements IServiceReferenceAlarmListPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceAlarmListH2PersistenceDAO.class); - - public ServiceReferenceAlarmListH2PersistenceDAO(H2Client client) { - super(client); - } - - @Override public ServiceReferenceAlarmList get(String id) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(ServiceReferenceAlarmList data) { - return null; - } - - @Override public H2SqlEntity prepareBatchUpdate(ServiceReferenceAlarmList data) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmH2PersistenceDAO.java new file mode 100644 index 000000000..b0d6472cf --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmH2PersistenceDAO.java @@ -0,0 +1,73 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IApplicationAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationAlarmH2PersistenceDAO extends AbstractPersistenceH2DAO implements IApplicationAlarmPersistenceDAO { + + public ApplicationAlarmH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationAlarmTable.TABLE; + } + + @Override protected ApplicationAlarm h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationAlarm applicationAlarm = new ApplicationAlarm(); + applicationAlarm.setId(resultSet.getString(ApplicationAlarmTable.COLUMN_ID)); + applicationAlarm.setSourceValue(resultSet.getInt(ApplicationAlarmTable.COLUMN_SOURCE_VALUE)); + + applicationAlarm.setAlarmType(resultSet.getInt(ApplicationAlarmTable.COLUMN_ALARM_TYPE)); + + applicationAlarm.setApplicationId(resultSet.getInt(ApplicationAlarmTable.COLUMN_APPLICATION_ID)); + + applicationAlarm.setLastTimeBucket(resultSet.getLong(ApplicationAlarmTable.COLUMN_LAST_TIME_BUCKET)); + applicationAlarm.setAlarmContent(resultSet.getString(ApplicationAlarmTable.COLUMN_ALARM_CONTENT)); + + return applicationAlarm; + } + + @Override protected Map streamDataToH2Data(ApplicationAlarm streamData) { + Map source = new HashMap<>(); + source.put(ApplicationAlarmTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ApplicationAlarmTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ApplicationAlarmTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + + source.put(ApplicationAlarmTable.COLUMN_LAST_TIME_BUCKET, streamData.getLastTimeBucket()); + source.put(ApplicationAlarmTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmListH2PersistenceDAO.java new file mode 100644 index 000000000..700698e42 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationAlarmListH2PersistenceDAO.java @@ -0,0 +1,73 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IApplicationAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO implements IApplicationAlarmListPersistenceDAO { + + public ApplicationAlarmListH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationAlarmListTable.TABLE; + } + + @Override protected ApplicationAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList(); + applicationAlarmList.setId(resultSet.getString(ApplicationAlarmListTable.COLUMN_ID)); + applicationAlarmList.setSourceValue(resultSet.getInt(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE)); + + applicationAlarmList.setAlarmType(resultSet.getInt(ApplicationAlarmListTable.COLUMN_ALARM_TYPE)); + + applicationAlarmList.setApplicationId(resultSet.getInt(ApplicationAlarmListTable.COLUMN_APPLICATION_ID)); + + applicationAlarmList.setTimeBucket(resultSet.getLong(ApplicationAlarmListTable.COLUMN_TIME_BUCKET)); + applicationAlarmList.setAlarmContent(resultSet.getString(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT)); + + return applicationAlarmList; + } + + @Override protected Map streamDataToH2Data(ApplicationAlarmList streamData) { + Map source = new HashMap<>(); + source.put(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ApplicationAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ApplicationAlarmListTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + + source.put(ApplicationAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + source.put(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmH2PersistenceDAO.java new file mode 100644 index 000000000..ac2779ef3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmH2PersistenceDAO.java @@ -0,0 +1,75 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceAlarmH2PersistenceDAO extends AbstractPersistenceH2DAO implements IApplicationReferenceAlarmPersistenceDAO { + + public ApplicationReferenceAlarmH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationReferenceAlarmTable.TABLE; + } + + @Override protected ApplicationReferenceAlarm h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationReferenceAlarm applicationReferenceAlarm = new ApplicationReferenceAlarm(); + applicationReferenceAlarm.setId(resultSet.getString(ApplicationReferenceAlarmTable.COLUMN_ID)); + applicationReferenceAlarm.setSourceValue(resultSet.getInt(ApplicationReferenceAlarmTable.COLUMN_SOURCE_VALUE)); + + applicationReferenceAlarm.setAlarmType(resultSet.getInt(ApplicationReferenceAlarmTable.COLUMN_ALARM_TYPE)); + + applicationReferenceAlarm.setFrontApplicationId(resultSet.getInt(ApplicationReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID)); + applicationReferenceAlarm.setBehindApplicationId(resultSet.getInt(ApplicationReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID)); + + applicationReferenceAlarm.setLastTimeBucket(resultSet.getLong(ApplicationReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET)); + applicationReferenceAlarm.setAlarmContent(resultSet.getString(ApplicationReferenceAlarmTable.COLUMN_ALARM_CONTENT)); + + return applicationReferenceAlarm; + } + + @Override protected Map streamDataToH2Data(ApplicationReferenceAlarm streamData) { + Map source = new HashMap<>(); + source.put(ApplicationReferenceAlarmTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ApplicationReferenceAlarmTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ApplicationReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ApplicationReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + + source.put(ApplicationReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, streamData.getLastTimeBucket()); + source.put(ApplicationReferenceAlarmTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmListH2PersistenceDAO.java new file mode 100644 index 000000000..8b129cd18 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ApplicationReferenceAlarmListH2PersistenceDAO.java @@ -0,0 +1,75 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList; +import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO implements IApplicationReferenceAlarmListPersistenceDAO { + + public ApplicationReferenceAlarmListH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationReferenceAlarmListTable.TABLE; + } + + @Override protected ApplicationReferenceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException { + ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList(); + applicationReferenceAlarmList.setId(resultSet.getString(ApplicationReferenceAlarmListTable.COLUMN_ID)); + applicationReferenceAlarmList.setSourceValue(resultSet.getInt(ApplicationReferenceAlarmListTable.COLUMN_SOURCE_VALUE)); + + applicationReferenceAlarmList.setAlarmType(resultSet.getInt(ApplicationReferenceAlarmListTable.COLUMN_ALARM_TYPE)); + + applicationReferenceAlarmList.setFrontApplicationId(resultSet.getInt(ApplicationReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID)); + applicationReferenceAlarmList.setBehindApplicationId(resultSet.getInt(ApplicationReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID)); + + applicationReferenceAlarmList.setTimeBucket(resultSet.getLong(ApplicationReferenceAlarmListTable.COLUMN_TIME_BUCKET)); + applicationReferenceAlarmList.setAlarmContent(resultSet.getString(ApplicationReferenceAlarmListTable.COLUMN_ALARM_CONTENT)); + + return applicationReferenceAlarmList; + } + + @Override protected Map streamDataToH2Data(ApplicationReferenceAlarmList streamData) { + Map source = new HashMap<>(); + source.put(ApplicationReferenceAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ApplicationReferenceAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ApplicationReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ApplicationReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + + source.put(ApplicationReferenceAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + source.put(ApplicationReferenceAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmH2PersistenceDAO.java new file mode 100644 index 000000000..f3c2b23ee --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmH2PersistenceDAO.java @@ -0,0 +1,75 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IInstanceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class InstanceAlarmH2PersistenceDAO extends AbstractPersistenceH2DAO implements IInstanceAlarmPersistenceDAO { + + public InstanceAlarmH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceAlarmTable.TABLE; + } + + @Override protected InstanceAlarm h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceAlarm instanceAlarm = new InstanceAlarm(); + instanceAlarm.setId(resultSet.getString(InstanceAlarmTable.COLUMN_ID)); + instanceAlarm.setSourceValue(resultSet.getInt(InstanceAlarmTable.COLUMN_SOURCE_VALUE)); + + instanceAlarm.setAlarmType(resultSet.getInt(InstanceAlarmTable.COLUMN_ALARM_TYPE)); + + instanceAlarm.setApplicationId(resultSet.getInt(InstanceAlarmTable.COLUMN_APPLICATION_ID)); + instanceAlarm.setInstanceId(resultSet.getInt(InstanceAlarmTable.COLUMN_INSTANCE_ID)); + + instanceAlarm.setLastTimeBucket(resultSet.getLong(InstanceAlarmTable.COLUMN_LAST_TIME_BUCKET)); + instanceAlarm.setAlarmContent(resultSet.getString(InstanceAlarmTable.COLUMN_ALARM_CONTENT)); + + return instanceAlarm; + } + + @Override protected Map streamDataToH2Data(InstanceAlarm streamData) { + Map source = new HashMap<>(); + source.put(InstanceAlarmTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(InstanceAlarmTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(InstanceAlarmTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(InstanceAlarmTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + + source.put(InstanceAlarmTable.COLUMN_LAST_TIME_BUCKET, streamData.getLastTimeBucket()); + source.put(InstanceAlarmTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmListH2PersistenceDAO.java new file mode 100644 index 000000000..bd0aee269 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceAlarmListH2PersistenceDAO.java @@ -0,0 +1,75 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IInstanceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmList; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class InstanceAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO implements IInstanceAlarmListPersistenceDAO { + + public InstanceAlarmListH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceAlarmListTable.TABLE; + } + + @Override protected InstanceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceAlarmList instanceAlarmList = new InstanceAlarmList(); + instanceAlarmList.setId(resultSet.getString(InstanceAlarmListTable.COLUMN_ID)); + instanceAlarmList.setSourceValue(resultSet.getInt(InstanceAlarmListTable.COLUMN_SOURCE_VALUE)); + + instanceAlarmList.setAlarmType(resultSet.getInt(InstanceAlarmListTable.COLUMN_ALARM_TYPE)); + + instanceAlarmList.setApplicationId(resultSet.getInt(InstanceAlarmListTable.COLUMN_APPLICATION_ID)); + instanceAlarmList.setInstanceId(resultSet.getInt(InstanceAlarmListTable.COLUMN_INSTANCE_ID)); + + instanceAlarmList.setTimeBucket(resultSet.getLong(InstanceAlarmListTable.COLUMN_TIME_BUCKET)); + instanceAlarmList.setAlarmContent(resultSet.getString(InstanceAlarmListTable.COLUMN_ALARM_CONTENT)); + + return instanceAlarmList; + } + + @Override protected Map streamDataToH2Data(InstanceAlarmList streamData) { + Map source = new HashMap<>(); + source.put(InstanceAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(InstanceAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(InstanceAlarmListTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(InstanceAlarmListTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + + source.put(InstanceAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + source.put(InstanceAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmH2PersistenceDAO.java new file mode 100644 index 000000000..9b8fe7ecf --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmH2PersistenceDAO.java @@ -0,0 +1,80 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmTable; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceAlarmH2PersistenceDAO extends AbstractPersistenceH2DAO implements IInstanceReferenceAlarmPersistenceDAO { + + public InstanceReferenceAlarmH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceReferenceAlarmTable.TABLE; + } + + @Override protected InstanceReferenceAlarm h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceReferenceAlarm instanceReferenceAlarm = new InstanceReferenceAlarm(); + instanceReferenceAlarm.setId(resultSet.getString(ServiceReferenceAlarmTable.COLUMN_ID)); + instanceReferenceAlarm.setSourceValue(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_SOURCE_VALUE)); + + instanceReferenceAlarm.setAlarmType(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_ALARM_TYPE)); + + instanceReferenceAlarm.setFrontApplicationId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID)); + instanceReferenceAlarm.setFrontInstanceId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID)); + instanceReferenceAlarm.setBehindApplicationId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID)); + instanceReferenceAlarm.setBehindInstanceId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID)); + + instanceReferenceAlarm.setLastTimeBucket(resultSet.getLong(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET)); + instanceReferenceAlarm.setAlarmContent(resultSet.getString(ServiceReferenceAlarmTable.COLUMN_ALARM_CONTENT)); + + return instanceReferenceAlarm; + } + + @Override protected Map streamDataToH2Data(InstanceReferenceAlarm streamData) { + Map source = new HashMap<>(); + source.put(ServiceReferenceAlarmTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceReferenceAlarmTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ServiceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ServiceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID, streamData.getFrontInstanceId()); + source.put(ServiceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(ServiceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID, streamData.getBehindInstanceId()); + + source.put(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, streamData.getLastTimeBucket()); + source.put(ServiceReferenceAlarmTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmListH2PersistenceDAO.java new file mode 100644 index 000000000..2f8997c96 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/InstanceReferenceAlarmListH2PersistenceDAO.java @@ -0,0 +1,79 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO implements IInstanceReferenceAlarmListPersistenceDAO { + + public InstanceReferenceAlarmListH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return InstanceReferenceAlarmListTable.TABLE; + } + + @Override protected InstanceReferenceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException { + InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList(); + instanceReferenceAlarmList.setId(resultSet.getString(InstanceReferenceAlarmListTable.COLUMN_ID)); + instanceReferenceAlarmList.setSourceValue(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE)); + + instanceReferenceAlarmList.setAlarmType(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE)); + + instanceReferenceAlarmList.setFrontApplicationId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID)); + instanceReferenceAlarmList.setFrontInstanceId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID)); + instanceReferenceAlarmList.setBehindApplicationId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID)); + instanceReferenceAlarmList.setBehindInstanceId(resultSet.getInt(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID)); + + instanceReferenceAlarmList.setTimeBucket(resultSet.getLong(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET)); + instanceReferenceAlarmList.setAlarmContent(resultSet.getString(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT)); + + return instanceReferenceAlarmList; + } + + @Override protected Map streamDataToH2Data(InstanceReferenceAlarmList streamData) { + Map source = new HashMap<>(); + source.put(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID, streamData.getFrontInstanceId()); + source.put(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID, streamData.getBehindInstanceId()); + + source.put(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + source.put(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmH2PersistenceDAO.java new file mode 100644 index 000000000..135b931f7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmH2PersistenceDAO.java @@ -0,0 +1,77 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IServiceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ServiceAlarmH2PersistenceDAO extends AbstractPersistenceH2DAO implements IServiceAlarmPersistenceDAO { + + public ServiceAlarmH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceAlarmTable.TABLE; + } + + @Override protected ServiceAlarm h2DataToStreamData(ResultSet resultSet) throws SQLException { + ServiceAlarm serviceAlarm = new ServiceAlarm(); + serviceAlarm.setId(resultSet.getString(ServiceAlarmTable.COLUMN_ID)); + serviceAlarm.setSourceValue(resultSet.getInt(ServiceAlarmTable.COLUMN_SOURCE_VALUE)); + + serviceAlarm.setAlarmType(resultSet.getInt(ServiceAlarmTable.COLUMN_ALARM_TYPE)); + + serviceAlarm.setApplicationId(resultSet.getInt(ServiceAlarmTable.COLUMN_APPLICATION_ID)); + serviceAlarm.setInstanceId(resultSet.getInt(ServiceAlarmTable.COLUMN_INSTANCE_ID)); + serviceAlarm.setServiceId(resultSet.getInt(ServiceAlarmTable.COLUMN_SERVICE_ID)); + + serviceAlarm.setLastTimeBucket(resultSet.getLong(ServiceAlarmTable.COLUMN_LAST_TIME_BUCKET)); + serviceAlarm.setAlarmContent(resultSet.getString(ServiceAlarmTable.COLUMN_ALARM_CONTENT)); + + return serviceAlarm; + } + + @Override protected Map streamDataToH2Data(ServiceAlarm streamData) { + Map source = new HashMap<>(); + source.put(ServiceAlarmTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceAlarmTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ServiceAlarmTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(ServiceAlarmTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(ServiceAlarmTable.COLUMN_SERVICE_ID, streamData.getServiceId()); + + source.put(ServiceAlarmTable.COLUMN_LAST_TIME_BUCKET, streamData.getLastTimeBucket()); + source.put(ServiceAlarmTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmListH2PersistenceDAO.java new file mode 100644 index 000000000..161d84907 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceAlarmListH2PersistenceDAO.java @@ -0,0 +1,77 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IServiceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ServiceAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO implements IServiceAlarmListPersistenceDAO { + + public ServiceAlarmListH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceAlarmListTable.TABLE; + } + + @Override protected ServiceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException { + ServiceAlarmList serviceAlarmList = new ServiceAlarmList(); + serviceAlarmList.setId(resultSet.getString(ServiceAlarmListTable.COLUMN_ID)); + serviceAlarmList.setSourceValue(resultSet.getInt(ServiceAlarmListTable.COLUMN_SOURCE_VALUE)); + + serviceAlarmList.setAlarmType(resultSet.getInt(ServiceAlarmListTable.COLUMN_ALARM_TYPE)); + + serviceAlarmList.setApplicationId(resultSet.getInt(ServiceAlarmListTable.COLUMN_APPLICATION_ID)); + serviceAlarmList.setInstanceId(resultSet.getInt(ServiceAlarmListTable.COLUMN_INSTANCE_ID)); + serviceAlarmList.setServiceId(resultSet.getInt(ServiceAlarmListTable.COLUMN_SERVICE_ID)); + + serviceAlarmList.setTimeBucket(resultSet.getLong(ServiceAlarmListTable.COLUMN_TIME_BUCKET)); + serviceAlarmList.setAlarmContent(resultSet.getString(ServiceAlarmListTable.COLUMN_ALARM_CONTENT)); + + return serviceAlarmList; + } + + @Override protected Map streamDataToH2Data(ServiceAlarmList streamData) { + Map source = new HashMap<>(); + source.put(ServiceAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ServiceAlarmListTable.COLUMN_APPLICATION_ID, streamData.getApplicationId()); + source.put(ServiceAlarmListTable.COLUMN_INSTANCE_ID, streamData.getInstanceId()); + source.put(ServiceAlarmListTable.COLUMN_SERVICE_ID, streamData.getServiceId()); + + source.put(ServiceAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + source.put(ServiceAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmH2PersistenceDAO.java new file mode 100644 index 000000000..ef9879b56 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmH2PersistenceDAO.java @@ -0,0 +1,83 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceAlarmH2PersistenceDAO extends AbstractPersistenceH2DAO implements IServiceReferenceAlarmPersistenceDAO { + + public ServiceReferenceAlarmH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceReferenceAlarmTable.TABLE; + } + + @Override protected ServiceReferenceAlarm h2DataToStreamData(ResultSet resultSet) throws SQLException { + ServiceReferenceAlarm serviceReferenceAlarm = new ServiceReferenceAlarm(); + serviceReferenceAlarm.setId(resultSet.getString(ServiceReferenceAlarmTable.COLUMN_ID)); + serviceReferenceAlarm.setSourceValue(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_SOURCE_VALUE)); + + serviceReferenceAlarm.setAlarmType(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_ALARM_TYPE)); + + serviceReferenceAlarm.setFrontApplicationId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID)); + serviceReferenceAlarm.setFrontInstanceId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID)); + serviceReferenceAlarm.setFrontServiceId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_FRONT_SERVICE_ID)); + serviceReferenceAlarm.setBehindApplicationId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID)); + serviceReferenceAlarm.setBehindInstanceId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID)); + serviceReferenceAlarm.setBehindServiceId(resultSet.getInt(ServiceReferenceAlarmTable.COLUMN_BEHIND_SERVICE_ID)); + + serviceReferenceAlarm.setLastTimeBucket(resultSet.getLong(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET)); + serviceReferenceAlarm.setAlarmContent(resultSet.getString(ServiceReferenceAlarmTable.COLUMN_ALARM_CONTENT)); + + return serviceReferenceAlarm; + } + + @Override protected Map streamDataToH2Data(ServiceReferenceAlarm streamData) { + Map source = new HashMap<>(); + source.put(ServiceReferenceAlarmTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceReferenceAlarmTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ServiceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ServiceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID, streamData.getFrontInstanceId()); + source.put(ServiceReferenceAlarmTable.COLUMN_FRONT_SERVICE_ID, streamData.getFrontServiceId()); + source.put(ServiceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(ServiceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID, streamData.getBehindInstanceId()); + source.put(ServiceReferenceAlarmTable.COLUMN_BEHIND_SERVICE_ID, streamData.getBehindServiceId()); + + source.put(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, streamData.getLastTimeBucket()); + source.put(ServiceReferenceAlarmTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmListH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmListH2PersistenceDAO.java new file mode 100644 index 000000000..73c8e093d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/alarm/ServiceReferenceAlarmListH2PersistenceDAO.java @@ -0,0 +1,83 @@ +/* + * 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.alarm; + +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.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO; +import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO implements IServiceReferenceAlarmListPersistenceDAO { + + public ServiceReferenceAlarmListH2PersistenceDAO(H2Client client) { + super(client); + } + + @Override protected String tableName() { + return ServiceReferenceAlarmListTable.TABLE; + } + + @Override protected ServiceReferenceAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException { + ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList(); + serviceReferenceAlarmList.setId(resultSet.getString(ServiceReferenceAlarmListTable.COLUMN_ID)); + serviceReferenceAlarmList.setSourceValue(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_SOURCE_VALUE)); + + serviceReferenceAlarmList.setAlarmType(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_ALARM_TYPE)); + + serviceReferenceAlarmList.setFrontApplicationId(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID)); + serviceReferenceAlarmList.setFrontInstanceId(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID)); + serviceReferenceAlarmList.setFrontServiceId(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_FRONT_SERVICE_ID)); + serviceReferenceAlarmList.setBehindApplicationId(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID)); + serviceReferenceAlarmList.setBehindInstanceId(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID)); + serviceReferenceAlarmList.setBehindServiceId(resultSet.getInt(ServiceReferenceAlarmListTable.COLUMN_BEHIND_SERVICE_ID)); + + serviceReferenceAlarmList.setTimeBucket(resultSet.getLong(ServiceReferenceAlarmListTable.COLUMN_TIME_BUCKET)); + serviceReferenceAlarmList.setAlarmContent(resultSet.getString(ServiceReferenceAlarmListTable.COLUMN_ALARM_CONTENT)); + + return serviceReferenceAlarmList; + } + + @Override protected Map streamDataToH2Data(ServiceReferenceAlarmList streamData) { + Map source = new HashMap<>(); + source.put(ServiceReferenceAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue()); + + source.put(ServiceReferenceAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType()); + + source.put(ServiceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, streamData.getFrontApplicationId()); + source.put(ServiceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID, streamData.getFrontInstanceId()); + source.put(ServiceReferenceAlarmListTable.COLUMN_FRONT_SERVICE_ID, streamData.getFrontServiceId()); + source.put(ServiceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, streamData.getBehindApplicationId()); + source.put(ServiceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID, streamData.getBehindInstanceId()); + source.put(ServiceReferenceAlarmListTable.COLUMN_BEHIND_SERVICE_ID, streamData.getBehindServiceId()); + + source.put(ServiceReferenceAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + source.put(ServiceReferenceAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationReferenceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationReferenceMetricH2TableDefine.java deleted file mode 100644 index e209b4e31..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ApplicationReferenceMetricH2TableDefine.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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; - -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; -import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; - -/** - * @author peng-yongsheng - */ -public class ApplicationReferenceMetricH2TableDefine extends H2TableDefine { - - public ApplicationReferenceMetricH2TableDefine() { - super(ApplicationReferenceMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ApplicationReferenceMetricTable.COLUMN_FRUSTRATED_COUNT, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMetricH2TableDefine.java deleted file mode 100644 index 76c38e497..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceMetricH2TableDefine.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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; - -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.instance.InstanceMetricTable; - -/** - * @author peng-yongsheng - */ -public class InstanceMetricH2TableDefine extends H2TableDefine { - - public InstanceMetricH2TableDefine() { - super(InstanceMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(InstanceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceReferenceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceReferenceMetricH2TableDefine.java deleted file mode 100644 index 4d695f474..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/InstanceReferenceMetricH2TableDefine.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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; - -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.instance.InstanceReferenceMetricTable; - -/** - * @author peng-yongsheng - */ -public class InstanceReferenceMetricH2TableDefine extends H2TableDefine { - - public InstanceReferenceMetricH2TableDefine() { - super(InstanceReferenceMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(InstanceReferenceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceMetricH2TableDefine.java deleted file mode 100644 index 08b20390d..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceMetricH2TableDefine.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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; - -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.service.ServiceMetricTable; - -/** - * @author peng-yongsheng - */ -public class ServiceMetricH2TableDefine extends H2TableDefine { - - public ServiceMetricH2TableDefine() { - super(ServiceMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ServiceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceReferenceMetricH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceReferenceMetricH2TableDefine.java deleted file mode 100644 index 68d96f215..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/ServiceReferenceMetricH2TableDefine.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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; - -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.service.ServiceReferenceMetricTable; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceMetricH2TableDefine extends H2TableDefine { - - public ServiceReferenceMetricH2TableDefine() { - super(ServiceReferenceMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); - - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, H2ColumnDefine.Type.Bigint.name())); - - addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmH2TableDefine.java new file mode 100644 index 000000000..5ff834768 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmH2TableDefine.java @@ -0,0 +1,45 @@ +/* + * 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.alarm; + +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.alarm.ApplicationAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationAlarmH2TableDefine extends H2TableDefine { + + public ApplicationAlarmH2TableDefine() { + super(ApplicationAlarmTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ApplicationAlarmTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationAlarmTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationAlarmTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationAlarmTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationAlarmTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ApplicationAlarmTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmListH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmListH2TableDefine.java new file mode 100644 index 000000000..e54b7af13 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationAlarmListH2TableDefine.java @@ -0,0 +1,45 @@ +/* + * 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.alarm; + +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.alarm.ApplicationAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationAlarmListH2TableDefine extends H2TableDefine { + + public ApplicationAlarmListH2TableDefine() { + super(ApplicationAlarmListTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ApplicationAlarmListTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationAlarmListTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationAlarmListTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ApplicationAlarmListTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmH2TableDefine.java new file mode 100644 index 000000000..ceef29ce5 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmH2TableDefine.java @@ -0,0 +1,46 @@ +/* + * 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.alarm; + +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.alarm.ApplicationReferenceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceAlarmH2TableDefine extends H2TableDefine { + + public ApplicationReferenceAlarmH2TableDefine() { + super(ApplicationReferenceAlarmTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmListH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmListH2TableDefine.java new file mode 100644 index 000000000..7148d0e34 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ApplicationReferenceAlarmListH2TableDefine.java @@ -0,0 +1,46 @@ +/* + * 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.alarm; + +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.alarm.ApplicationReferenceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ApplicationReferenceAlarmListH2TableDefine extends H2TableDefine { + + public ApplicationReferenceAlarmListH2TableDefine() { + super(ApplicationReferenceAlarmListTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ApplicationReferenceAlarmListTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmH2TableDefine.java new file mode 100644 index 000000000..8d6e7e112 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmH2TableDefine.java @@ -0,0 +1,46 @@ +/* + * 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.alarm; + +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.alarm.InstanceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class InstanceAlarmH2TableDefine extends H2TableDefine { + + public InstanceAlarmH2TableDefine() { + super(InstanceAlarmTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(InstanceAlarmTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmListH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmListH2TableDefine.java new file mode 100644 index 000000000..e677f4df9 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceAlarmListH2TableDefine.java @@ -0,0 +1,46 @@ +/* + * 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.alarm; + +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.alarm.InstanceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class InstanceAlarmListH2TableDefine extends H2TableDefine { + + public InstanceAlarmListH2TableDefine() { + super(InstanceAlarmListTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(InstanceAlarmListTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmH2TableDefine.java new file mode 100644 index 000000000..5a1008765 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmH2TableDefine.java @@ -0,0 +1,48 @@ +/* + * 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.alarm; + +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.alarm.InstanceReferenceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceAlarmH2TableDefine extends H2TableDefine { + + public InstanceReferenceAlarmH2TableDefine() { + super(InstanceReferenceAlarmTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmListH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmListH2TableDefine.java new file mode 100644 index 000000000..d75fad873 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/InstanceReferenceAlarmListH2TableDefine.java @@ -0,0 +1,48 @@ +/* + * 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.alarm; + +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.alarm.InstanceReferenceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceAlarmListH2TableDefine extends H2TableDefine { + + public InstanceReferenceAlarmListH2TableDefine() { + super(InstanceReferenceAlarmListTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmH2TableDefine.java new file mode 100644 index 000000000..71a4206f4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmH2TableDefine.java @@ -0,0 +1,47 @@ +/* + * 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.alarm; + +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.alarm.ServiceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ServiceAlarmH2TableDefine extends H2TableDefine { + + public ServiceAlarmH2TableDefine() { + super(ServiceAlarmTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ServiceAlarmTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmListH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmListH2TableDefine.java new file mode 100644 index 000000000..5df00786b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceAlarmListH2TableDefine.java @@ -0,0 +1,47 @@ +/* + * 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.alarm; + +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.alarm.ServiceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ServiceAlarmListH2TableDefine extends H2TableDefine { + + public ServiceAlarmListH2TableDefine() { + super(ServiceAlarmListTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ServiceAlarmListTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmH2TableDefine.java new file mode 100644 index 000000000..f6b14e66c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmH2TableDefine.java @@ -0,0 +1,50 @@ +/* + * 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.alarm; + +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.alarm.ServiceReferenceAlarmTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceAlarmH2TableDefine extends H2TableDefine { + + public ServiceReferenceAlarmH2TableDefine() { + super(ServiceReferenceAlarmTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_FRONT_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_BEHIND_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmListH2TableDefine.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmListH2TableDefine.java new file mode 100644 index 000000000..79f4d6902 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/define/alarm/ServiceReferenceAlarmListH2TableDefine.java @@ -0,0 +1,50 @@ +/* + * 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.alarm; + +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.alarm.ServiceReferenceAlarmListTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceAlarmListH2TableDefine extends H2TableDefine { + + public ServiceReferenceAlarmListH2TableDefine() { + super(ServiceReferenceAlarmListTable.TABLE); + } + + @Override public void initialize() { + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_FRONT_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_BEHIND_SERVICE_ID, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name())); + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_ALARM_TYPE, H2ColumnDefine.Type.Int.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_ALARM_CONTENT, H2ColumnDefine.Type.Varchar.name())); + + addColumn(new H2ColumnDefine(ServiceReferenceAlarmListTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define index 5e73ed2d6..476ac990e 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/resources/META-INF/defines/storage.define @@ -74,4 +74,17 @@ org.apache.skywalking.apm.collector.storage.h2.define.smp.ServiceMonthMetricH2Ta org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceMinuteMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceHourMetricH2TableDefine org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceDayMetricH2TableDefine -org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceMonthMetricH2TableDefine \ No newline at end of file +org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceMonthMetricH2TableDefine + +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmListH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationReferenceAlarmH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationReferenceAlarmListH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.InstanceAlarmH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.InstanceAlarmListH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.InstanceReferenceAlarmH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.InstanceReferenceAlarmListH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ServiceAlarmH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ServiceAlarmListH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ServiceReferenceAlarmH2TableDefine +org.apache.skywalking.apm.collector.storage.h2.define.alarm.ServiceReferenceAlarmListH2TableDefine \ No newline at end of file From 5ba36ca6cb652b330ae4b7ffb062956ef22008e7 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Fri, 12 Jan 2018 23:23:43 +0800 Subject: [PATCH 17/18] Unused import error when continuous integration. --- .../storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java | 1 - .../dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java | 1 - .../dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java | 1 - .../armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java | 1 - .../storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java | 1 - 5 files changed, 5 deletions(-) diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java index 5e81c7f3e..7147ddcb0 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/amp/ApplicationDayMetricH2PersistenceDAO.java @@ -22,7 +22,6 @@ 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.amp.IApplicationDayMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable; diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java index 73c3e2205..09529ed20 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceDayMetricH2PersistenceDAO.java @@ -22,7 +22,6 @@ 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.armp.IApplicationReferenceDayMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java index 92bea1e7f..a2ce5acb1 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceHourMetricH2PersistenceDAO.java @@ -22,7 +22,6 @@ 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.armp.IApplicationReferenceHourMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetricTable; diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java index 2a2723ee8..bb71256d6 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/armp/ApplicationReferenceMonthMetricH2PersistenceDAO.java @@ -21,7 +21,6 @@ package org.apache.skywalking.apm.collector.storage.h2.dao.armp; 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.armp.IApplicationReferenceMinuteMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMonthMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric; diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java index a73cde0c6..14c116216 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/smp/ServiceHourMetricH2PersistenceDAO.java @@ -22,7 +22,6 @@ 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.smp.IServiceHourMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric; import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable; From 79cddf659b57626b1698593f26324d40f9784c4d Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Sat, 13 Jan 2018 17:18:44 +0800 Subject: [PATCH 18/18] Changed boolean type to integer, true: 1, false: 0. --- .../jvm/provider/service/MemoryMetricService.java | 3 ++- .../register/ApplicationRegisterSerialWorker.java | 3 ++- .../provider/register/InstanceRegisterSerialWorker.java | 3 ++- .../register/provider/service/ApplicationIDService.java | 9 +++------ .../register/provider/service/InstanceIDService.java | 5 +++-- .../src/main/resources/application.yml | 8 ++++---- .../apm/collector/storage/table/jvm/MemoryMetric.java | 9 ++++----- .../collector/storage/table/register/Application.java | 9 ++++----- .../apm/collector/storage/table/register/Instance.java | 9 ++++----- .../storage/es/dao/cache/InstanceEsCacheDAO.java | 4 ---- .../storage/es/dao/cache/NetworkAddressEsCacheDAO.java | 2 +- .../memorymp/AbstractMemoryMetricEsPersistenceDAO.java | 2 +- .../memorymp/AbstractMemoryMetricH2PersistenceDAO.java | 4 ++-- 13 files changed, 32 insertions(+), 38 deletions(-) diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java index c9ed19bed..97e1d7fd0 100644 --- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java @@ -22,6 +22,7 @@ import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefi import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryMetricService; import org.apache.skywalking.apm.collector.core.graph.Graph; import org.apache.skywalking.apm.collector.core.graph.GraphManager; +import org.apache.skywalking.apm.collector.core.util.BooleanUtils; import org.apache.skywalking.apm.collector.core.util.Const; import org.apache.skywalking.apm.collector.core.util.ObjectUtils; import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric; @@ -53,7 +54,7 @@ public class MemoryMetricService implements IMemoryMetricService { memoryMetric.setId(id); memoryMetric.setMetricId(metricId); memoryMetric.setInstanceId(instanceId); - memoryMetric.setIsHeap(isHeap); + memoryMetric.setIsHeap(BooleanUtils.booleanToValue(isHeap)); memoryMetric.setInit(init); memoryMetric.setMax(max); memoryMetric.setUsed(used); diff --git a/apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/ApplicationRegisterSerialWorker.java b/apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/ApplicationRegisterSerialWorker.java index 0562c9485..686320b54 100644 --- a/apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/ApplicationRegisterSerialWorker.java +++ b/apm-collector/apm-collector-analysis/analysis-register/register-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/register/provider/register/ApplicationRegisterSerialWorker.java @@ -25,6 +25,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerExce import org.apache.skywalking.apm.collector.cache.CacheModule; import org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService; import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.core.util.BooleanUtils; import org.apache.skywalking.apm.collector.core.util.Const; import org.apache.skywalking.apm.collector.storage.StorageModule; import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO; @@ -65,7 +66,7 @@ public class ApplicationRegisterSerialWorker extends AbstractLocalAsyncWorker { @@ -42,7 +42,7 @@ public abstract class AbstractMemoryMetricH2PersistenceDAO extends AbstractPersi memoryMetric.setMetricId(resultSet.getString(MemoryMetricTable.COLUMN_METRIC_ID)); memoryMetric.setInstanceId(resultSet.getInt(MemoryMetricTable.COLUMN_INSTANCE_ID)); - memoryMetric.setIsHeap(resultSet.getBoolean(MemoryMetricTable.COLUMN_IS_HEAP)); + memoryMetric.setIsHeap(resultSet.getInt(MemoryMetricTable.COLUMN_IS_HEAP)); memoryMetric.setInit(resultSet.getLong(MemoryMetricTable.COLUMN_INIT)); memoryMetric.setMax(resultSet.getLong(MemoryMetricTable.COLUMN_MAX));