diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java index 59fc6691b..ff4729001 100644 --- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java @@ -33,7 +33,17 @@ public class WorkerIdDefine { public static final int CPU_MONTH_METRIC_PERSISTENCE_WORKER_ID = 3008; public static final int CPU_MONTH_METRIC_TRANSFORM_NODE_ID = 3009; - public static final int GC_METRIC_PERSISTENCE_WORKER_ID = 301; + public static final int GC_METRIC_BRIDGE_NODE_ID = 3100; + public static final int GC_SECOND_METRIC_PERSISTENCE_WORKER_ID = 3101; + public static final int GC_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 3102; + public static final int GC_MINUTE_METRIC_TRANSFORM_NODE_ID = 3103; + public static final int GC_HOUR_METRIC_PERSISTENCE_WORKER_ID = 3104; + public static final int GC_HOUR_METRIC_TRANSFORM_NODE_ID = 3105; + public static final int GC_DAY_METRIC_PERSISTENCE_WORKER_ID = 3106; + public static final int GC_DAY_METRIC_TRANSFORM_NODE_ID = 3107; + public static final int GC_MONTH_METRIC_PERSISTENCE_WORKER_ID = 3108; + public static final int GC_MONTH_METRIC_TRANSFORM_NODE_ID = 3109; + public static final int INST_HEART_BEAT_PERSISTENCE_WORKER_ID = 302; public static final int MEMORY_METRIC_PERSISTENCE_WORKER_ID = 303; public static final int MEMORY_POOL_METRIC_PERSISTENCE_WORKER_ID = 303; diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java index f23351e56..9a8e62586 100644 --- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java @@ -31,7 +31,7 @@ import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.Instanc import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.MemoryMetricService; import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.MemoryPoolMetricService; import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu.CpuMetricPersistenceGraph; -import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.GCMetricPersistenceGraph; +import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc.GCMetricPersistenceGraph; import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.InstanceHeartBeatPersistenceGraph; import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.MemoryMetricPersistenceGraph; import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.MemoryPoolMetricPersistenceGraph; diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricPersistenceWorker.java new file mode 100644 index 000000000..433a6146c --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricPersistenceWorker.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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider; +import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.storage.StorageModule; +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCDayMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCDayMetricPersistenceWorker extends PersistenceWorker { + + public GCDayMetricPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return WorkerIdDefine.GC_DAY_METRIC_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IGCDayMetricPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public GCDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new GCDayMetricPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricTransformNode.java new file mode 100644 index 000000000..273246231 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricTransformNode.java @@ -0,0 +1,44 @@ +/* + * 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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.core.graph.Next; +import org.apache.skywalking.apm.collector.core.graph.NodeProcessor; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCDayMetricTransformNode implements NodeProcessor { + + @Override public int id() { + return WorkerIdDefine.GC_DAY_METRIC_TRANSFORM_NODE_ID; + } + + @Override public void process(GCMetric gcMetric, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.secondToDay(gcMetric.getTimeBucket()); + gcMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId()); + gcMetric.setTimeBucket(timeBucket); + + next.execute(gcMetric); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricPersistenceWorker.java new file mode 100644 index 000000000..08b9addcb --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricPersistenceWorker.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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider; +import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.storage.StorageModule; +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCHourMetricPersistenceWorker extends PersistenceWorker { + + public GCHourMetricPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return WorkerIdDefine.GC_HOUR_METRIC_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IGCHourMetricPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public GCHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new GCHourMetricPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricTransformNode.java new file mode 100644 index 000000000..4f4615e4f --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricTransformNode.java @@ -0,0 +1,44 @@ +/* + * 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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.core.graph.Next; +import org.apache.skywalking.apm.collector.core.graph.NodeProcessor; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCHourMetricTransformNode implements NodeProcessor { + + @Override public int id() { + return WorkerIdDefine.GC_HOUR_METRIC_TRANSFORM_NODE_ID; + } + + @Override public void process(GCMetric gcMetric, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.secondToHour(gcMetric.getTimeBucket()); + gcMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId()); + gcMetric.setTimeBucket(timeBucket); + + next.execute(gcMetric); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricBridgeNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricBridgeNode.java new file mode 100644 index 000000000..97e23e772 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricBridgeNode.java @@ -0,0 +1,38 @@ +/* + * 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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.core.graph.Next; +import org.apache.skywalking.apm.collector.core.graph.NodeProcessor; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCMetricBridgeNode implements NodeProcessor { + + @Override public int id() { + return WorkerIdDefine.GC_METRIC_BRIDGE_NODE_ID; + } + + @Override public void process(GCMetric metric, Next next) { + next.execute(metric); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceGraph.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricPersistenceGraph.java similarity index 61% rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceGraph.java rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricPersistenceGraph.java index 24329f04d..9034ccbb0 100644 --- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceGraph.java +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricPersistenceGraph.java @@ -16,11 +16,12 @@ * */ -package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker; +package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc; import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine; import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener; import org.apache.skywalking.apm.collector.core.graph.GraphManager; +import org.apache.skywalking.apm.collector.core.graph.Node; import org.apache.skywalking.apm.collector.core.module.ModuleManager; import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; @@ -38,7 +39,21 @@ public class GCMetricPersistenceGraph { } public void create() { - GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.GC_METRIC_PERSISTENCE_GRAPH_ID, GCMetric.class) - .addNode(new GCMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + Node bridgeNode = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.GC_METRIC_PERSISTENCE_GRAPH_ID, GCMetric.class) + .addNode(new GCMetricBridgeNode()); + + bridgeNode.addNext(new GCSecondMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + bridgeNode.addNext(new GCMinuteMetricTransformNode()) + .addNext(new GCMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + bridgeNode.addNext(new GCHourMetricTransformNode()) + .addNext(new GCHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + bridgeNode.addNext(new GCDayMetricTransformNode()) + .addNext(new GCDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + bridgeNode.addNext(new GCMonthMetricTransformNode()) + .addNext(new GCMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); } } diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricPersistenceWorker.java new file mode 100644 index 000000000..f65752c95 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricPersistenceWorker.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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider; +import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.storage.StorageModule; +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMinuteMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCMinuteMetricPersistenceWorker extends PersistenceWorker { + + public GCMinuteMetricPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return WorkerIdDefine.GC_MINUTE_METRIC_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IGCMinuteMetricPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public GCMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new GCMinuteMetricPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricTransformNode.java new file mode 100644 index 000000000..49e37ed38 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricTransformNode.java @@ -0,0 +1,44 @@ +/* + * 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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.core.graph.Next; +import org.apache.skywalking.apm.collector.core.graph.NodeProcessor; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCMinuteMetricTransformNode implements NodeProcessor { + + @Override public int id() { + return WorkerIdDefine.GC_MINUTE_METRIC_TRANSFORM_NODE_ID; + } + + @Override public void process(GCMetric gcMetric, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.secondToMinute(gcMetric.getTimeBucket()); + gcMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId()); + gcMetric.setTimeBucket(timeBucket); + + next.execute(gcMetric); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricPersistenceWorker.java new file mode 100644 index 000000000..1d5268090 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricPersistenceWorker.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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker; +import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider; +import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.storage.StorageModule; +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMonthMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCMonthMetricPersistenceWorker extends PersistenceWorker { + + public GCMonthMetricPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return WorkerIdDefine.GC_MONTH_METRIC_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IGCMonthMetricPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public GCMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new GCMonthMetricPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricTransformNode.java new file mode 100644 index 000000000..540aca2d3 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricTransformNode.java @@ -0,0 +1,44 @@ +/* + * 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.analysis.jvm.provider.worker.gc; + +import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; +import org.apache.skywalking.apm.collector.core.graph.Next; +import org.apache.skywalking.apm.collector.core.graph.NodeProcessor; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public class GCMonthMetricTransformNode implements NodeProcessor { + + @Override public int id() { + return WorkerIdDefine.GC_MONTH_METRIC_TRANSFORM_NODE_ID; + } + + @Override public void process(GCMetric gcMetric, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.secondToMonth(gcMetric.getTimeBucket()); + gcMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId()); + gcMetric.setTimeBucket(timeBucket); + + next.execute(gcMetric); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCSecondMetricPersistenceWorker.java similarity index 77% rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceWorker.java rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCSecondMetricPersistenceWorker.java index b19eff2d9..df47a8db1 100644 --- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceWorker.java +++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCSecondMetricPersistenceWorker.java @@ -16,7 +16,7 @@ * */ -package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker; +package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc; import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine; import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker; @@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc import org.apache.skywalking.apm.collector.core.module.ModuleManager; import org.apache.skywalking.apm.collector.storage.StorageModule; import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; /** * @author peng-yongsheng */ -public class GCMetricPersistenceWorker extends PersistenceWorker { +public class GCSecondMetricPersistenceWorker extends PersistenceWorker { - public GCMetricPersistenceWorker(ModuleManager moduleManager) { + public GCSecondMetricPersistenceWorker(ModuleManager moduleManager) { super(moduleManager); } @Override public int id() { - return WorkerIdDefine.GC_METRIC_PERSISTENCE_WORKER_ID; + return WorkerIdDefine.GC_SECOND_METRIC_PERSISTENCE_WORKER_ID; } @Override protected boolean needMergeDBData() { @@ -46,17 +46,17 @@ public class GCMetricPersistenceWorker extends PersistenceWorker { @SuppressWarnings("unchecked") @Override protected IPersistenceDAO persistenceDAO() { - return getModuleManager().find(StorageModule.NAME).getService(IGCMetricPersistenceDAO.class); + return getModuleManager().find(StorageModule.NAME).getService(IGCSecondMetricPersistenceDAO.class); } - public static class Factory extends PersistenceWorkerProvider { + public static class Factory extends PersistenceWorkerProvider { public Factory(ModuleManager moduleManager) { super(moduleManager); } - @Override public GCMetricPersistenceWorker workerInstance(ModuleManager moduleManager) { - return new GCMetricPersistenceWorker(moduleManager); + @Override public GCSecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new GCSecondMetricPersistenceWorker(moduleManager); } @Override 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 93e7d8b0f..4132b3287 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 @@ -37,7 +37,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetr import org.apache.skywalking.apm.collector.storage.dao.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO; -import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO; 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; @@ -115,7 +115,7 @@ public class StorageModule extends Module { private void addPersistenceDAO(List classes) { classes.add(ICpuSecondMetricPersistenceDAO.class); - classes.add(IGCMetricPersistenceDAO.class); + classes.add(IGCSecondMetricPersistenceDAO.class); classes.add(IMemoryMetricPersistenceDAO.class); classes.add(IMemoryPoolMetricPersistenceDAO.class); diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IGCMetricPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCDayMetricPersistenceDAO.java similarity index 82% rename from apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IGCMetricPersistenceDAO.java rename to apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCDayMetricPersistenceDAO.java index 9757d693b..2b7be6b04 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IGCMetricPersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCDayMetricPersistenceDAO.java @@ -16,7 +16,7 @@ * */ -package org.apache.skywalking.apm.collector.storage.dao; +package org.apache.skywalking.apm.collector.storage.dao.gcmp; import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; @@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; /** * @author peng-yongsheng */ -public interface IGCMetricPersistenceDAO extends IPersistenceDAO { +public interface IGCDayMetricPersistenceDAO extends IPersistenceDAO { } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCHourMetricPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCHourMetricPersistenceDAO.java new file mode 100644 index 000000000..5c6e86261 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCHourMetricPersistenceDAO.java @@ -0,0 +1,28 @@ +/* + * 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.dao.gcmp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public interface IGCHourMetricPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCMinuteMetricPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCMinuteMetricPersistenceDAO.java new file mode 100644 index 000000000..62996d7e1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCMinuteMetricPersistenceDAO.java @@ -0,0 +1,28 @@ +/* + * 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.dao.gcmp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public interface IGCMinuteMetricPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCMonthMetricPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCMonthMetricPersistenceDAO.java new file mode 100644 index 000000000..b3684f1e1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCMonthMetricPersistenceDAO.java @@ -0,0 +1,28 @@ +/* + * 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.dao.gcmp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public interface IGCMonthMetricPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCSecondMetricPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCSecondMetricPersistenceDAO.java new file mode 100644 index 000000000..2373cff29 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/gcmp/IGCSecondMetricPersistenceDAO.java @@ -0,0 +1,28 @@ +/* + * 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.dao.gcmp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; + +/** + * @author peng-yongsheng + */ +public interface IGCSecondMetricPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/CpuMetric.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/CpuMetric.java index e689d6f81..73731f85f 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/CpuMetric.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/CpuMetric.java @@ -67,7 +67,6 @@ public class CpuMetric extends StreamData { @Override public void setMetricId(String metricId) { setDataString(1, metricId); - } public Integer getInstanceId() { diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/GCMetric.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/GCMetric.java index 752b6a5eb..d5b3922c1 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/GCMetric.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/jvm/GCMetric.java @@ -16,21 +16,21 @@ * */ - package org.apache.skywalking.apm.collector.storage.table.jvm; import org.apache.skywalking.apm.collector.core.data.Column; -import org.apache.skywalking.apm.collector.core.data.AbstractData; +import org.apache.skywalking.apm.collector.core.data.StreamData; import org.apache.skywalking.apm.collector.core.data.operator.CoverOperation; import org.apache.skywalking.apm.collector.core.data.operator.NonOperation; /** * @author peng-yongsheng */ -public class GCMetric extends AbstractData { +public class GCMetric extends StreamData { private static final Column[] STRING_COLUMNS = { new Column(GCMetricTable.COLUMN_ID, new NonOperation()), + new Column(GCMetricTable.COLUMN_METRIC_ID, new NonOperation()), }; private static final Column[] LONG_COLUMNS = { @@ -50,8 +50,25 @@ public class GCMetric extends AbstractData { private static final Column[] BOOLEAN_COLUMNS = {}; private static final Column[] BYTE_COLUMNS = {}; - public GCMetric(String id) { - super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS); + public GCMetric() { + super(STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS); + } + + @Override public String getId() { + return getDataString(0); + } + + @Override public void setId(String id) { + setDataString(0, id); + } + + @Override public String getMetricId() { + return getDataString(1); + } + + @Override public void setMetricId(String metricId) { + setDataString(1, metricId); + } public Long getCount() { diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/DataTTLKeeperTimer.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/DataTTLKeeperTimer.java index 1bae81e4e..056aaa502 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/DataTTLKeeperTimer.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/DataTTLKeeperTimer.java @@ -30,6 +30,7 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent 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.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.srmp.IServiceReferenceMinuteMetricPersistenceDAO; @@ -78,7 +79,7 @@ public class DataTTLKeeperTimer { ICpuSecondMetricPersistenceDAO cpuMetricPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(ICpuSecondMetricPersistenceDAO.class); cpuMetricPersistenceDAO.deleteHistory(startTimestamp, endTimestamp); - IGCMetricPersistenceDAO gcMetricPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IGCMetricPersistenceDAO.class); + IGCSecondMetricPersistenceDAO gcMetricPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IGCSecondMetricPersistenceDAO.class); gcMetricPersistenceDAO.deleteHistory(startTimestamp, endTimestamp); IMemoryMetricPersistenceDAO memoryMetricPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IMemoryMetricPersistenceDAO.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 b87982709..4621bded8 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 @@ -46,7 +46,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetr import org.apache.skywalking.apm.collector.storage.dao.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO; -import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO; 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; @@ -100,7 +100,7 @@ import org.apache.skywalking.apm.collector.storage.es.dao.armp.ApplicationRefere import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationReferenceMetricEsUIDAO; import org.apache.skywalking.apm.collector.storage.es.dao.cpump.CpuSecondMetricEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.CpuMetricEsUIDAO; -import org.apache.skywalking.apm.collector.storage.es.dao.GCMetricEsPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.es.dao.gcmp.GCSecondMetricEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.GCMetricEsUIDAO; import org.apache.skywalking.apm.collector.storage.es.dao.GlobalTraceEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.GlobalTraceEsUIDAO; @@ -228,7 +228,7 @@ public class StorageModuleEsProvider extends ModuleProvider { private void registerPersistenceDAO() throws ServiceNotProvidedException { this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricEsPersistenceDAO(elasticSearchClient)); - this.registerServiceImplementation(IGCMetricPersistenceDAO.class, new GCMetricEsPersistenceDAO(elasticSearchClient)); + this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricEsPersistenceDAO(elasticSearchClient)); this.registerServiceImplementation(IMemoryMetricPersistenceDAO.class, new MemoryMetricEsPersistenceDAO(elasticSearchClient)); this.registerServiceImplementation(IMemoryPoolMetricPersistenceDAO.class, new MemoryPoolMetricEsPersistenceDAO(elasticSearchClient)); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsPersistenceDAO.java deleted file mode 100644 index 4931f52b9..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsPersistenceDAO.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.es.dao; - -import java.util.HashMap; -import java.util.Map; -import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; -import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; -import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GCMetricEsPersistenceDAO extends EsDAO implements IGCMetricPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(GCMetricEsPersistenceDAO.class); - - public GCMetricEsPersistenceDAO(ElasticSearchClient client) { - super(client); - } - - @Override public GCMetric get(String id) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(GCMetric gcMetric) { - Map source = new HashMap<>(); - source.put(GCMetricTable.COLUMN_INSTANCE_ID, gcMetric.getInstanceId()); - source.put(GCMetricTable.COLUMN_PHRASE, gcMetric.getPhrase()); - source.put(GCMetricTable.COLUMN_COUNT, gcMetric.getCount()); - source.put(GCMetricTable.COLUMN_TIME, gcMetric.getTime()); - source.put(GCMetricTable.COLUMN_TIME_BUCKET, gcMetric.getTimeBucket()); - - return getClient().prepareIndex(GCMetricTable.TABLE, gcMetric.getId()).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(GCMetric gcMetric) { - return null; - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - long startTimeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(startTimestamp); - long endTimeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(endTimestamp); - BulkByScrollResponse response = getClient().prepareDelete() - .filter(QueryBuilders.rangeQuery(GCMetricTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket)) - .source(GCMetricTable.TABLE) - .get(); - - long deleted = response.getDeleted(); - logger.info("Delete {} rows history from {} index.", deleted, GCMetricTable.TABLE); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/AbstractGCMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/AbstractGCMetricEsPersistenceDAO.java new file mode 100644 index 000000000..893626c85 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/AbstractGCMetricEsPersistenceDAO.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.es.dao.gcmp; + +import java.util.HashMap; +import java.util.Map; +import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +import org.apache.skywalking.apm.collector.storage.es.base.dao.AbstractPersistenceEsDAO; +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 AbstractGCMetricEsPersistenceDAO extends AbstractPersistenceEsDAO { + + AbstractGCMetricEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected final String timeBucketColumnNameForDelete() { + return GCMetricTable.COLUMN_TIME_BUCKET; + } + + @Override protected final GCMetric esDataToStreamData(Map source) { + return null; + } + + @Override protected final Map esStreamDataToEsData(GCMetric streamData) { + Map source = new HashMap<>(); + source.put(GCMetricTable.COLUMN_ID, streamData.getId()); + 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_TIME, streamData.getTime()); + source.put(GCMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCDayMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCDayMetricEsPersistenceDAO.java new file mode 100644 index 000000000..213a937ef --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCDayMetricEsPersistenceDAO.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.es.dao.gcmp; + +import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +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.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class GCDayMetricEsPersistenceDAO extends AbstractGCMetricEsPersistenceDAO implements IGCDayMetricPersistenceDAO { + + public GCDayMetricEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCHourMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCHourMetricEsPersistenceDAO.java new file mode 100644 index 000000000..6ed12489b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCHourMetricEsPersistenceDAO.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.es.dao.gcmp; + +import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +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.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class GCHourMetricEsPersistenceDAO extends AbstractGCMetricEsPersistenceDAO implements IGCHourMetricPersistenceDAO { + + public GCHourMetricEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected String tableName() { + return GCMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCMinuteMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCMinuteMetricEsPersistenceDAO.java new file mode 100644 index 000000000..1a7fbfaaf --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCMinuteMetricEsPersistenceDAO.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.es.dao.gcmp; + +import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +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.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class GCMinuteMetricEsPersistenceDAO extends AbstractGCMetricEsPersistenceDAO implements IGCMinuteMetricPersistenceDAO { + + public GCMinuteMetricEsPersistenceDAO(ElasticSearchClient 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-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCMonthMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCMonthMetricEsPersistenceDAO.java new file mode 100644 index 000000000..7b09af017 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCMonthMetricEsPersistenceDAO.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.es.dao.gcmp; + +import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +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.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class GCMonthMetricEsPersistenceDAO extends AbstractGCMetricEsPersistenceDAO implements IGCMonthMetricPersistenceDAO { + + public GCMonthMetricEsPersistenceDAO(ElasticSearchClient 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-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCSecondMetricEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCSecondMetricEsPersistenceDAO.java new file mode 100644 index 000000000..92da1c5b5 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/gcmp/GCSecondMetricEsPersistenceDAO.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.es.dao.gcmp; + +import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +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.table.jvm.GCMetric; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class GCSecondMetricEsPersistenceDAO extends AbstractGCMetricEsPersistenceDAO implements IGCSecondMetricPersistenceDAO { + + public GCSecondMetricEsPersistenceDAO(ElasticSearchClient 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/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 282f65c24..2c238b62d 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 @@ -42,7 +42,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetr import org.apache.skywalking.apm.collector.storage.dao.IApplicationRegisterDAO; import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO; -import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO; 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; @@ -96,7 +96,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMi import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMetricH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.CpuSecondMetricH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.CpuMetricH2UIDAO; -import org.apache.skywalking.apm.collector.storage.h2.dao.GCMetricH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.GCSecondMetricH2PersistenceDAO; 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; @@ -206,7 +206,7 @@ public class StorageModuleH2Provider extends ModuleProvider { private void registerPersistenceDAO() throws ServiceNotProvidedException { this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IGCMetricPersistenceDAO.class, new GCMetricH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IMemoryMetricPersistenceDAO.class, new MemoryMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IMemoryPoolMetricPersistenceDAO.class, new MemoryPoolMetricH2PersistenceDAO(h2Client)); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java similarity index 89% rename from apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2PersistenceDAO.java rename to apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java index a83d83457..2904a14c7 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCSecondMetricH2PersistenceDAO.java @@ -24,7 +24,7 @@ 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.IGCMetricPersistenceDAO; +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; @@ -32,9 +32,9 @@ import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric; /** * @author peng-yongsheng, clevertension */ -public class GCMetricH2PersistenceDAO extends H2DAO implements IGCMetricPersistenceDAO { +public class GCSecondMetricH2PersistenceDAO extends H2DAO implements IGCSecondMetricPersistenceDAO { - public GCMetricH2PersistenceDAO(H2Client client) { + public GCSecondMetricH2PersistenceDAO(H2Client client) { super(client); }