From 8e2e5f4e753e8a9b84bef5379002afb6fbe778db Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Sun, 7 Jan 2018 22:36:30 +0800 Subject: [PATCH] Application component pyramid aggregate. --- .../define/graph/MetricWorkerIdDefine.java | 12 ++- .../AnalysisMetricModuleProvider.java | 4 +- ...ApplicationComponentAggregationWorker.java | 4 +- ...icationComponentDayPersistenceWorker.java} | 18 ++-- .../ApplicationComponentDayTransformNode.java | 45 +++++++++ .../ApplicationComponentGraph.java | 19 +++- ...icationComponentHourPersistenceWorker.java | 67 ++++++++++++++ ...ApplicationComponentHourTransformNode.java | 45 +++++++++ ...ationComponentMinutePersistenceWorker.java | 67 ++++++++++++++ ...cationComponentMonthPersistenceWorker.java | 67 ++++++++++++++ ...pplicationComponentMonthTransformNode.java | 45 +++++++++ .../ApplicationComponentRemoteWorker.java | 4 +- .../ApplicationComponentSpanListener.java | 8 +- .../apm/collector/storage/StorageModule.java | 4 +- ...pplicationComponentDayPersistenceDAO.java} | 4 +- ...pplicationComponentHourPersistenceDAO.java | 28 ++++++ ...licationComponentMinutePersistenceDAO.java | 28 ++++++ ...plicationComponentMonthPersistenceDAO.java | 28 ++++++ .../storage/es/DataTTLKeeperTimer.java | 3 +- .../storage/es/StorageModuleEsProvider.java | 6 +- .../ApplicationComponentEsPersistenceDAO.java | 91 ------------------- .../es/dao/ApplicationComponentEsUIDAO.java | 3 +- ...tApplicationComponentEsPersistenceDAO.java | 63 +++++++++++++ ...plicationComponentDayEsPersistenceDAO.java | 46 ++++++++++ ...licationComponentHourEsPersistenceDAO.java | 42 +++++++++ ...cationComponentMinuteEsPersistenceDAO.java | 42 +++++++++ ...icationComponentMonthEsPersistenceDAO.java | 42 +++++++++ .../storage/h2/StorageModuleH2Provider.java | 6 +- ...ationComponentH2MinutePersistenceDAO.java} | 8 +- 29 files changed, 717 insertions(+), 132 deletions(-) rename apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/{ => component}/ApplicationComponentAggregationWorker.java (94%) rename apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/{ApplicationComponentPersistenceWorker.java => component/ApplicationComponentDayPersistenceWorker.java} (74%) create mode 100644 apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java rename apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/{ => component}/ApplicationComponentGraph.java (68%) create mode 100644 apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.java create mode 100644 apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java create mode 100644 apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.java create mode 100644 apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.java create mode 100644 apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java rename apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/{ => component}/ApplicationComponentRemoteWorker.java (95%) rename apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/{ => component}/ApplicationComponentSpanListener.java (96%) rename apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/{IApplicationComponentPersistenceDAO.java => acp/IApplicationComponentDayPersistenceDAO.java} (81%) create mode 100644 apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentHourPersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMinutePersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMonthPersistenceDAO.java delete mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsPersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/AbstractApplicationComponentEsPersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentDayEsPersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentHourEsPersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMinuteEsPersistenceDAO.java create mode 100644 apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMonthEsPersistenceDAO.java rename apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/{ApplicationComponentH2PersistenceDAO.java => ApplicationComponentH2MinutePersistenceDAO.java} (91%) diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java index 558898878..b73d5f7d6 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java @@ -102,9 +102,15 @@ public class MetricWorkerIdDefine { public static final int APPLICATION_MAPPING_MONTH_PERSISTENCE_WORKER_ID = 4807; public static final int APPLICATION_MAPPING_MONTH_TRANSFORM_NODE_ID = 4808; - public static final int APPLICATION_COMPONENT_AGGREGATION_WORKER_ID = 418; - public static final int APPLICATION_COMPONENT_REMOTE_WORKER_ID = 419; - public static final int APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID = 420; + public static final int APPLICATION_COMPONENT_MINUTE_AGGREGATION_WORKER_ID = 4900; + public static final int APPLICATION_COMPONENT_MINUTE_REMOTE_WORKER_ID = 4901; + public static final int APPLICATION_COMPONENT_MINUTE_PERSISTENCE_WORKER_ID = 4902; + public static final int APPLICATION_COMPONENT_HOUR_PERSISTENCE_WORKER_ID = 4903; + public static final int APPLICATION_COMPONENT_HOUR_TRANSFORM_NODE_ID = 4904; + public static final int APPLICATION_COMPONENT_DAY_PERSISTENCE_WORKER_ID = 4905; + public static final int APPLICATION_COMPONENT_DAY_TRANSFORM_NODE_ID = 4906; + public static final int APPLICATION_COMPONENT_MONTH_PERSISTENCE_WORKER_ID = 4907; + public static final int APPLICATION_COMPONENT_MONTH_TRANSFORM_NODE_ID = 4908; public static final int SERVICE_ENTRY_AGGREGATION_WORKER_ID = 424; public static final int SERVICE_ENTRY_REMOTE_WORKER_ID = 425; diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java index 89af38b6e..5c4dc8bde 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java @@ -20,8 +20,8 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider; import java.util.Properties; import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule; -import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationComponentGraph; -import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationComponentSpanListener; +import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component.ApplicationComponentGraph; +import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component.ApplicationComponentSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping.ApplicationMappingGraph; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping.ApplicationMappingSpanListener; import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric.ApplicationMetricGraph; diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentAggregationWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentAggregationWorker.java similarity index 94% rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentAggregationWorker.java rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentAggregationWorker.java index fb9a22521..d5bc90c80 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentAggregationWorker.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentAggregationWorker.java @@ -16,7 +16,7 @@ * */ -package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application; +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider; @@ -34,7 +34,7 @@ public class ApplicationComponentAggregationWorker extends AggregationWorker { diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayPersistenceWorker.java similarity index 74% rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentPersistenceWorker.java rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayPersistenceWorker.java index d25641126..4da338c07 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentPersistenceWorker.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayPersistenceWorker.java @@ -16,7 +16,7 @@ * */ -package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application; +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; 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.IApplicationComponentPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentDayPersistenceDAO; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; /** * @author peng-yongsheng */ -public class ApplicationComponentPersistenceWorker extends PersistenceWorker { +public class ApplicationComponentDayPersistenceWorker extends PersistenceWorker { - public ApplicationComponentPersistenceWorker(ModuleManager moduleManager) { + public ApplicationComponentDayPersistenceWorker(ModuleManager moduleManager) { super(moduleManager); } @Override public int id() { - return MetricWorkerIdDefine.APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID; + return MetricWorkerIdDefine.APPLICATION_COMPONENT_DAY_PERSISTENCE_WORKER_ID; } @Override protected boolean needMergeDBData() { @@ -46,17 +46,17 @@ public class ApplicationComponentPersistenceWorker extends PersistenceWorker persistenceDAO() { - return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class); + return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentDayPersistenceDAO.class); } - public static class Factory extends PersistenceWorkerProvider { + public static class Factory extends PersistenceWorkerProvider { public Factory(ModuleManager moduleManager) { super(moduleManager); } - @Override public ApplicationComponentPersistenceWorker workerInstance(ModuleManager moduleManager) { - return new ApplicationComponentPersistenceWorker(moduleManager); + @Override public ApplicationComponentDayPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new ApplicationComponentDayPersistenceWorker(moduleManager); } @Override diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java new file mode 100644 index 000000000..f03ca9779 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; + +import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; +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.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentDayTransformNode implements NodeProcessor { + + @Override public int id() { + return MetricWorkerIdDefine.APPLICATION_COMPONENT_DAY_TRANSFORM_NODE_ID; + } + + @Override + public void process(ApplicationComponent applicationComponent, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationComponent.getTimeBucket()); + applicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId()); + applicationComponent.setTimeBucket(timeBucket); + + next.execute(applicationComponent); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentGraph.java similarity index 68% rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentGraph.java rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentGraph.java index faa58e49d..427df7af1 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentGraph.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentGraph.java @@ -16,11 +16,12 @@ * */ -package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application; +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine; 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.remote.RemoteModule; import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService; @@ -42,9 +43,19 @@ public class ApplicationComponentGraph { public void create() { RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class); - GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class) + Node remoteNode = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class) .addNode(new ApplicationComponentAggregationWorker.Factory(moduleManager).create(workerCreateListener)) - .addNext(new ApplicationComponentRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID).create(workerCreateListener)) - .addNext(new ApplicationComponentPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + .addNext(new ApplicationComponentRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID).create(workerCreateListener)); + + remoteNode.addNext(new ApplicationComponentMinutePersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + remoteNode.addNext(new ApplicationComponentHourTransformNode()) + .addNext(new ApplicationComponentHourPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + remoteNode.addNext(new ApplicationComponentDayTransformNode()) + .addNext(new ApplicationComponentDayPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + remoteNode.addNext(new ApplicationComponentMonthTransformNode()) + .addNext(new ApplicationComponentMonthPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); } } diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.java new file mode 100644 index 000000000..fc18f82d7 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.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.metric.provider.worker.application.component; + +import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; +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.acp.IApplicationComponentHourPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentHourPersistenceWorker extends PersistenceWorker { + + public ApplicationComponentHourPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return MetricWorkerIdDefine.APPLICATION_COMPONENT_HOUR_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentHourPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public ApplicationComponentHourPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new ApplicationComponentHourPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java new file mode 100644 index 000000000..198bde2ea --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; + +import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; +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.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentHourTransformNode implements NodeProcessor { + + @Override public int id() { + return MetricWorkerIdDefine.APPLICATION_COMPONENT_HOUR_TRANSFORM_NODE_ID; + } + + @Override + public void process(ApplicationComponent applicationComponent, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationComponent.getTimeBucket()); + applicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId()); + applicationComponent.setTimeBucket(timeBucket); + + next.execute(applicationComponent); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.java new file mode 100644 index 000000000..78ca9cd23 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.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.metric.provider.worker.application.component; + +import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; +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.acp.IApplicationComponentMinutePersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMinutePersistenceWorker extends PersistenceWorker { + + public ApplicationComponentMinutePersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMinutePersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public ApplicationComponentMinutePersistenceWorker workerInstance(ModuleManager moduleManager) { + return new ApplicationComponentMinutePersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.java new file mode 100644 index 000000000..bd5d2f07c --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.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.metric.provider.worker.application.component; + +import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; +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.acp.IApplicationComponentMonthPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMonthPersistenceWorker extends PersistenceWorker { + + public ApplicationComponentMonthPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return MetricWorkerIdDefine.APPLICATION_COMPONENT_MONTH_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMonthPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public ApplicationComponentMonthPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new ApplicationComponentMonthPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java new file mode 100644 index 000000000..f06563028 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; + +import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; +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.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMonthTransformNode implements NodeProcessor { + + @Override public int id() { + return MetricWorkerIdDefine.APPLICATION_COMPONENT_MONTH_TRANSFORM_NODE_ID; + } + + @Override + public void process(ApplicationComponent applicationComponent, Next next) { + long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationComponent.getTimeBucket()); + applicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId()); + applicationComponent.setTimeBucket(timeBucket); + + next.execute(applicationComponent); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentRemoteWorker.java similarity index 95% rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentRemoteWorker.java rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentRemoteWorker.java index 5d3cb9af1..04b3b99f4 100644 --- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentRemoteWorker.java +++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentRemoteWorker.java @@ -16,7 +16,7 @@ * */ -package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application; +package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component; import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine; import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker; @@ -37,7 +37,7 @@ public class ApplicationComponentRemoteWorker extends AbstractRemoteWorker extends IPersistenceDAO { +public interface IApplicationComponentDayPersistenceDAO extends IPersistenceDAO { } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentHourPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentHourPersistenceDAO.java new file mode 100644 index 000000000..6af2384f7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentHourPersistenceDAO.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.acp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public interface IApplicationComponentHourPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMinutePersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMinutePersistenceDAO.java new file mode 100644 index 000000000..72cf17ac6 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMinutePersistenceDAO.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.acp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public interface IApplicationComponentMinutePersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMonthPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMonthPersistenceDAO.java new file mode 100644 index 000000000..b4268f2e3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/acp/IApplicationComponentMonthPersistenceDAO.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.acp; + +import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; + +/** + * @author peng-yongsheng + */ +public interface IApplicationComponentMonthPersistenceDAO extends IPersistenceDAO { +} 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 282ede446..7283a2a9d 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 @@ -26,6 +26,7 @@ import org.apache.skywalking.apm.collector.storage.dao.*; import java.util.Calendar; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO; 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.imp.IInstanceMinuteMetricPersistenceDAO; @@ -93,7 +94,7 @@ public class DataTTLKeeperTimer { IInstanceMinuteMetricPersistenceDAO instanceMetricPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IInstanceMinuteMetricPersistenceDAO.class); instanceMetricPersistenceDAO.deleteHistory(startTimestamp, endTimestamp); - IApplicationComponentPersistenceDAO applicationComponentPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class); + IApplicationComponentMinutePersistenceDAO applicationComponentPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationComponentMinutePersistenceDAO.class); applicationComponentPersistenceDAO.deleteHistory(startTimestamp, endTimestamp); IApplicationMappingMinutePersistenceDAO applicationMappingPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationMappingMinutePersistenceDAO.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 e2f98ea4d..85069500b 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 @@ -34,7 +34,7 @@ import org.apache.skywalking.apm.collector.storage.base.dao.IBatchDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmListPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationCacheDAO; -import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO; import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO; @@ -87,7 +87,7 @@ import org.apache.skywalking.apm.collector.storage.es.base.dao.BatchEsDAO; import org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchStorageInstaller; import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationAlarmEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationAlarmListEsPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationComponentEsPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.es.dao.acp.ApplicationComponentMinuteEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationComponentEsUIDAO; import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationEsCacheDAO; import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationEsRegisterDAO; @@ -233,7 +233,7 @@ public class StorageModuleEsProvider extends ModuleProvider { this.registerServiceImplementation(IMemoryPoolMetricPersistenceDAO.class, new MemoryPoolMetricEsPersistenceDAO(elasticSearchClient)); this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceEsPersistenceDAO(elasticSearchClient)); - this.registerServiceImplementation(IApplicationComponentPersistenceDAO.class, new ApplicationComponentEsPersistenceDAO(elasticSearchClient)); + this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentMinuteEsPersistenceDAO(elasticSearchClient)); this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingMinuteEsPersistenceDAO(elasticSearchClient)); this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricEsPersistenceDAO(elasticSearchClient)); this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricEsPersistenceDAO(elasticSearchClient)); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsPersistenceDAO.java deleted file mode 100644 index 2014e10fe..000000000 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsPersistenceDAO.java +++ /dev/null @@ -1,91 +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.IApplicationComponentPersistenceDAO; -import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; -import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; -import org.elasticsearch.action.get.GetResponse; -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 ApplicationComponentEsPersistenceDAO extends EsDAO implements IApplicationComponentPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationComponentEsPersistenceDAO.class); - - public ApplicationComponentEsPersistenceDAO(ElasticSearchClient client) { - super(client); - } - - @Override public ApplicationComponent get(String id) { - GetResponse getResponse = getClient().prepareGet(ApplicationComponentTable.TABLE, id).get(); - if (getResponse.isExists()) { - ApplicationComponent applicationComponent = new ApplicationComponent(id); - Map source = getResponse.getSource(); - applicationComponent.setComponentId(((Number)source.get(ApplicationComponentTable.COLUMN_COMPONENT_ID)).intValue()); - applicationComponent.setPeerId(((Number)source.get(ApplicationComponentTable.COLUMN_PEER_ID)).intValue()); - applicationComponent.setTimeBucket((Long)source.get(ApplicationComponentTable.COLUMN_TIME_BUCKET)); - return applicationComponent; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(ApplicationComponent data) { - Map source = new HashMap<>(); - source.put(ApplicationComponentTable.COLUMN_COMPONENT_ID, data.getComponentId()); - source.put(ApplicationComponentTable.COLUMN_PEER_ID, data.getPeerId()); - source.put(ApplicationComponentTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - return getClient().prepareIndex(ApplicationComponentTable.TABLE, data.getId()).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(ApplicationComponent data) { - Map source = new HashMap<>(); - source.put(ApplicationComponentTable.COLUMN_COMPONENT_ID, data.getComponentId()); - source.put(ApplicationComponentTable.COLUMN_PEER_ID, data.getPeerId()); - source.put(ApplicationComponentTable.COLUMN_TIME_BUCKET, data.getTimeBucket()); - - return getClient().prepareUpdate(ApplicationComponentTable.TABLE, data.getId()).setDoc(source); - } - - @Override public void deleteHistory(Long startTimestamp, Long endTimestamp) { - long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp); - long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp); - BulkByScrollResponse response = getClient().prepareDelete() - .filter(QueryBuilders.rangeQuery(ApplicationComponentTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket)) - .source(ApplicationComponentTable.TABLE) - .get(); - - long deleted = response.getDeleted(); - logger.info("Delete {} rows history from {} index.", deleted, ApplicationComponentTable.TABLE); - } -} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsUIDAO.java index 8f2fb349a..d77825ec2 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ApplicationComponentEsUIDAO.java @@ -23,6 +23,7 @@ import com.google.gson.JsonObject; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; +import org.apache.skywalking.apm.collector.storage.es.dao.acp.ApplicationComponentMinuteEsPersistenceDAO; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; @@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory; */ public class ApplicationComponentEsUIDAO extends EsDAO implements IApplicationComponentUIDAO { - private final Logger logger = LoggerFactory.getLogger(ApplicationComponentEsPersistenceDAO.class); + private final Logger logger = LoggerFactory.getLogger(ApplicationComponentMinuteEsPersistenceDAO.class); public ApplicationComponentEsUIDAO(ElasticSearchClient client) { super(client); diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/AbstractApplicationComponentEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/AbstractApplicationComponentEsPersistenceDAO.java new file mode 100644 index 000000000..69f318201 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/AbstractApplicationComponentEsPersistenceDAO.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.collector.storage.es.dao.acp; + +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.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; + +/** + * @author peng-yongsheng + */ +public abstract class AbstractApplicationComponentEsPersistenceDAO extends AbstractPersistenceEsDAO { + + AbstractApplicationComponentEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected final String timeBucketColumnNameForDelete() { + return ApplicationComponentTable.COLUMN_TIME_BUCKET; + } + + @Override protected final ApplicationComponent esDataToStreamData(Map source) { + ApplicationComponent applicationComponent = new ApplicationComponent(); + applicationComponent.setId((String)source.get(ApplicationComponentTable.COLUMN_ID)); + applicationComponent.setMetricId((String)source.get(ApplicationComponentTable.COLUMN_METRIC_ID)); + + applicationComponent.setComponentId(((Number)source.get(ApplicationComponentTable.COLUMN_COMPONENT_ID)).intValue()); + applicationComponent.setPeerId(((Number)source.get(ApplicationComponentTable.COLUMN_PEER_ID)).intValue()); + applicationComponent.setTimeBucket((Long)source.get(ApplicationComponentTable.COLUMN_TIME_BUCKET)); + return applicationComponent; + } + + @Override protected final Map esStreamDataToEsData(ApplicationComponent streamData) { + Map source = new HashMap<>(); + source.put(ApplicationComponentTable.COLUMN_ID, streamData.getId()); + source.put(ApplicationComponentTable.COLUMN_METRIC_ID, streamData.getMetricId()); + + source.put(ApplicationComponentTable.COLUMN_COMPONENT_ID, streamData.getComponentId()); + source.put(ApplicationComponentTable.COLUMN_PEER_ID, streamData.getPeerId()); + source.put(ApplicationComponentTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket()); + + return source; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentDayEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentDayEsPersistenceDAO.java new file mode 100644 index 000000000..1f1b7ca2c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentDayEsPersistenceDAO.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.collector.storage.es.dao.acp; + +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.acp.IApplicationComponentDayPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentDayEsPersistenceDAO extends AbstractApplicationComponentEsPersistenceDAO implements IApplicationComponentDayPersistenceDAO { + + private final Logger logger = LoggerFactory.getLogger(ApplicationComponentDayEsPersistenceDAO.class); + + public ApplicationComponentDayEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentHourEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentHourEsPersistenceDAO.java new file mode 100644 index 000000000..a6be4e959 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentHourEsPersistenceDAO.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.acp; + +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.acp.IApplicationComponentHourPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentHourEsPersistenceDAO extends AbstractApplicationComponentEsPersistenceDAO implements IApplicationComponentHourPersistenceDAO { + + public ApplicationComponentHourEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMinuteEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMinuteEsPersistenceDAO.java new file mode 100644 index 000000000..0b0bc83eb --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMinuteEsPersistenceDAO.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.acp; + +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.acp.IApplicationComponentMinutePersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMinuteEsPersistenceDAO extends AbstractApplicationComponentEsPersistenceDAO implements IApplicationComponentMinutePersistenceDAO { + + public ApplicationComponentMinuteEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMonthEsPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMonthEsPersistenceDAO.java new file mode 100644 index 000000000..2ee5eb3ff --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/acp/ApplicationComponentMonthEsPersistenceDAO.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.acp; + +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.acp.IApplicationComponentMonthPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; +import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; +import org.elasticsearch.action.index.IndexRequestBuilder; +import org.elasticsearch.action.update.UpdateRequestBuilder; + +/** + * @author peng-yongsheng + */ +public class ApplicationComponentMonthEsPersistenceDAO extends AbstractApplicationComponentEsPersistenceDAO implements IApplicationComponentMonthPersistenceDAO { + + public ApplicationComponentMonthEsPersistenceDAO(ElasticSearchClient client) { + super(client); + } + + @Override protected String tableName() { + return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName(); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/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 8611026e1..b7be5bebe 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 @@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.base.dao.IBatchDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmListPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationCacheDAO; -import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO; import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO; import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO; @@ -83,7 +83,7 @@ import org.apache.skywalking.apm.collector.storage.h2.base.dao.BatchH2DAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2StorageInstaller; import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationAlarmH2PersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationAlarmListH2PersistenceDAO; -import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2PersistenceDAO; +import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2MinutePersistenceDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2UIDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2CacheDAO; import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2RegisterDAO; @@ -211,7 +211,7 @@ public class StorageModuleH2Provider extends ModuleProvider { this.registerServiceImplementation(IMemoryPoolMetricPersistenceDAO.class, new MemoryPoolMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client)); - this.registerServiceImplementation(IApplicationComponentPersistenceDAO.class, new ApplicationComponentH2PersistenceDAO(h2Client)); + this.registerServiceImplementation(IApplicationComponentMinutePersistenceDAO.class, new ApplicationComponentH2MinutePersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingH2MinutePersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client)); this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client)); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2PersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java similarity index 91% rename from apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2PersistenceDAO.java rename to apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java index 4a9f154c5..e931d0a10 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2PersistenceDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ApplicationComponentH2MinutePersistenceDAO.java @@ -31,7 +31,7 @@ import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable; import org.apache.skywalking.apm.collector.client.h2.H2ClientException; -import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO; import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,11 +39,11 @@ import org.slf4j.LoggerFactory; /** * @author peng-yongsheng, clevertension */ -public class ApplicationComponentH2PersistenceDAO extends H2DAO implements IApplicationComponentPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(ApplicationComponentH2PersistenceDAO.class); +public class ApplicationComponentH2MinutePersistenceDAO extends H2DAO implements IApplicationComponentMinutePersistenceDAO { + private final Logger logger = LoggerFactory.getLogger(ApplicationComponentH2MinutePersistenceDAO.class); private static final String GET_SQL = "select * from {0} where {1} = ?"; - public ApplicationComponentH2PersistenceDAO(H2Client client) { + public ApplicationComponentH2MinutePersistenceDAO(H2Client client) { super(client); }