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] 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