提交 0b5e3f1d 编写于 作者: P peng-yongsheng

Application mapping pyramid aggregate.

上级 7effeccc
......@@ -82,24 +82,30 @@ public class MetricWorkerIdDefine {
public static final int APPLICATION_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4607;
public static final int APPLICATION_MONTH_METRIC_TRANSFORM_NODE_ID = 4608;
public static final int INSTANCE_MINUTE_MAPPING_AGGREGATION_WORKER_ID = 4700;
public static final int INSTANCE_MINUTE_MAPPING_REMOTE_WORKER_ID = 4701;
public static final int INSTANCE_MINUTE_MAPPING_PERSISTENCE_WORKER_ID = 4702;
public static final int INSTANCE_HOUR_MAPPING_PERSISTENCE_WORKER_ID = 4703;
public static final int INSTANCE_HOUR_MAPPING_TRANSFORM_NODE_ID = 4704;
public static final int INSTANCE_DAY_MAPPING_PERSISTENCE_WORKER_ID = 4705;
public static final int INSTANCE_DAY_MAPPING_TRANSFORM_NODE_ID = 4706;
public static final int INSTANCE_MONTH_MAPPING_PERSISTENCE_WORKER_ID = 4707;
public static final int INSTANCE_MONTH_MAPPING_TRANSFORM_NODE_ID = 4708;
public static final int INSTANCE_MAPPING_MINUTE_AGGREGATION_WORKER_ID = 4700;
public static final int INSTANCE_MAPPING_MINUTE_REMOTE_WORKER_ID = 4701;
public static final int INSTANCE_MAPPING_MINUTE_PERSISTENCE_WORKER_ID = 4702;
public static final int INSTANCE_MAPPING_HOUR_PERSISTENCE_WORKER_ID = 4703;
public static final int INSTANCE_MAPPING_HOUR_TRANSFORM_NODE_ID = 4704;
public static final int INSTANCE_MAPPING_DAY_PERSISTENCE_WORKER_ID = 4705;
public static final int INSTANCE_MAPPING_DAY_TRANSFORM_NODE_ID = 4706;
public static final int INSTANCE_MAPPING_MONTH_PERSISTENCE_WORKER_ID = 4707;
public static final int INSTANCE_MAPPING_MONTH_TRANSFORM_NODE_ID = 4708;
public static final int APPLICATION_MAPPING_MINUTE_AGGREGATION_WORKER_ID = 4800;
public static final int APPLICATION_MAPPING_MINUTE_REMOTE_WORKER_ID = 4801;
public static final int APPLICATION_MAPPING_MINUTE_PERSISTENCE_WORKER_ID = 4802;
public static final int APPLICATION_MAPPING_HOUR_PERSISTENCE_WORKER_ID = 4803;
public static final int APPLICATION_MAPPING_HOUR_TRANSFORM_NODE_ID = 4804;
public static final int APPLICATION_MAPPING_DAY_PERSISTENCE_WORKER_ID = 4805;
public static final int APPLICATION_MAPPING_DAY_TRANSFORM_NODE_ID = 4806;
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_MAPPING_AGGREGATION_WORKER_ID = 421;
public static final int APPLICATION_MAPPING_REMOTE_WORKER_ID = 422;
public static final int APPLICATION_MAPPING_PERSISTENCE_WORKER_ID = 423;
public static final int SERVICE_ENTRY_AGGREGATION_WORKER_ID = 424;
public static final int SERVICE_ENTRY_REMOTE_WORKER_ID = 425;
public static final int SERVICE_ENTRY_PERSISTENCE_WORKER_ID = 426;
......
......@@ -22,8 +22,8 @@ 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.ApplicationMappingGraph;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMappingSpanListener;
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;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric.ApplicationReferenceMetricGraph;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceGraph;
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.mapping;
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.ampp.IApplicationMappingDayPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingDayPersistenceWorker extends PersistenceWorker<ApplicationMapping> {
ApplicationMappingDayPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_DAY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationMapping> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingDayPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationMapping, ApplicationMappingDayPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationMappingDayPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingDayPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.mapping;
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.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingDayTransformNode implements NodeProcessor<ApplicationMapping, ApplicationMapping> {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_DAY_TRANSFORM_NODE_ID;
}
@Override
public void process(ApplicationMapping applicationMapping, Next<ApplicationMapping> next) {
long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationMapping.getTimeBucket());
applicationMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMapping.getMetricId());
applicationMapping.setTimeBucket(timeBucket);
next.execute(applicationMapping);
}
}
......@@ -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.mapping;
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 ApplicationMappingGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
.addNode(new ApplicationMappingAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationMappingRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationMappingPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
Node<ApplicationMapping, ApplicationMapping> remoteNode = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
.addNode(new ApplicationMappingMinuteAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationMappingRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID).create(workerCreateListener));
remoteNode.addNext(new ApplicationMappingMinutePersistenceWorker.Factory(moduleManager).create(workerCreateListener));
remoteNode.addNext(new ApplicationMappingHourTransformNode())
.addNext(new ApplicationMappingHourPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
remoteNode.addNext(new ApplicationMappingDayTransformNode())
.addNext(new ApplicationMappingDayPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
remoteNode.addNext(new ApplicationMappingMonthTransformNode())
.addNext(new ApplicationMappingMonthPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
......@@ -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.mapping;
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.IApplicationMappingPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingHourPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingPersistenceWorker extends PersistenceWorker<ApplicationMapping> {
public class ApplicationMappingHourPersistenceWorker extends PersistenceWorker<ApplicationMapping> {
ApplicationMappingPersistenceWorker(ModuleManager moduleManager) {
ApplicationMappingHourPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_MAPPING_HOUR_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......@@ -46,17 +46,17 @@ public class ApplicationMappingPersistenceWorker extends PersistenceWorker<Appli
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationMapping> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingPersistenceDAO.class);
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingHourPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationMapping, ApplicationMappingPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ApplicationMapping, ApplicationMappingHourPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationMappingPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingPersistenceWorker(moduleManager);
@Override public ApplicationMappingHourPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingHourPersistenceWorker(moduleManager);
}
@Override
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.mapping;
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.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingHourTransformNode implements NodeProcessor<ApplicationMapping, ApplicationMapping> {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_HOUR_TRANSFORM_NODE_ID;
}
@Override
public void process(ApplicationMapping applicationMapping, Next<ApplicationMapping> next) {
long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationMapping.getTimeBucket());
applicationMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMapping.getMetricId());
applicationMapping.setTimeBucket(timeBucket);
next.execute(applicationMapping);
}
}
......@@ -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.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
......@@ -27,24 +27,24 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public class ApplicationMappingAggregationWorker extends AggregationWorker<ApplicationMapping, ApplicationMapping> {
public class ApplicationMappingMinuteAggregationWorker extends AggregationWorker<ApplicationMapping, ApplicationMapping> {
ApplicationMappingAggregationWorker(ModuleManager moduleManager) {
ApplicationMappingMinuteAggregationWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_MAPPING_MINUTE_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationMapping, ApplicationMapping, ApplicationMappingAggregationWorker> {
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationMapping, ApplicationMapping, ApplicationMappingMinuteAggregationWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationMappingAggregationWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingAggregationWorker(moduleManager);
@Override public ApplicationMappingMinuteAggregationWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingMinuteAggregationWorker(moduleManager);
}
@Override
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.mapping;
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.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingMinutePersistenceWorker extends PersistenceWorker<ApplicationMapping> {
ApplicationMappingMinutePersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_MINUTE_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationMapping> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingMinutePersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationMapping, ApplicationMappingMinutePersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationMappingMinutePersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingMinutePersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.mapping;
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.ampp.IApplicationMappingMonthPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingMonthPersistenceWorker extends PersistenceWorker<ApplicationMapping> {
ApplicationMappingMonthPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_MONTH_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationMapping> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingMonthPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationMapping, ApplicationMappingMonthPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationMappingMonthPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMappingMonthPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.mapping;
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.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingMonthTransformNode implements NodeProcessor<ApplicationMapping, ApplicationMapping> {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_MONTH_TRANSFORM_NODE_ID;
}
@Override
public void process(ApplicationMapping applicationMapping, Next<ApplicationMapping> next) {
long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationMapping.getTimeBucket());
applicationMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMapping.getMetricId());
applicationMapping.setTimeBucket(timeBucket);
next.execute(applicationMapping);
}
}
......@@ -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.mapping;
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 ApplicationMappingRemoteWorker extends AbstractRemoteWorker<Applica
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_MAPPING_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_MAPPING_MINUTE_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationMapping applicationMapping) throws WorkerException {
......
......@@ -34,7 +34,7 @@ public class InstanceMappingAggregationWorker extends AggregationWorker<Instance
}
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_MINUTE_MAPPING_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_MINUTE_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<InstanceMapping, InstanceMapping, InstanceMappingAggregationWorker> {
......
......@@ -37,7 +37,7 @@ public class InstanceMappingDayPersistenceWorker extends PersistenceWorker<Insta
}
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_DAY_MAPPING_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_DAY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......
......@@ -31,7 +31,7 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappin
public class InstanceMappingDayTransformNode implements NodeProcessor<InstanceMapping, InstanceMapping> {
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_DAY_MAPPING_TRANSFORM_NODE_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_DAY_TRANSFORM_NODE_ID;
}
@Override public void process(InstanceMapping instanceMapping, Next<InstanceMapping> next) {
......
......@@ -37,7 +37,7 @@ public class InstanceMappingHourPersistenceWorker extends PersistenceWorker<Inst
}
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_HOUR_MAPPING_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_HOUR_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......
......@@ -31,7 +31,7 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappin
public class InstanceMappingHourTransformNode implements NodeProcessor<InstanceMapping, InstanceMapping> {
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_HOUR_MAPPING_TRANSFORM_NODE_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_HOUR_TRANSFORM_NODE_ID;
}
@Override public void process(InstanceMapping instanceMapping, Next<InstanceMapping> next) {
......
......@@ -37,7 +37,7 @@ public class InstanceMappingMinutePersistenceWorker extends PersistenceWorker<In
}
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_MINUTE_MAPPING_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_MINUTE_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......
......@@ -37,7 +37,7 @@ public class InstanceMappingMonthPersistenceWorker extends PersistenceWorker<Ins
}
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_MONTH_MAPPING_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_MONTH_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......
......@@ -31,7 +31,7 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappin
public class InstanceMappingMonthTransformNode implements NodeProcessor<InstanceMapping, InstanceMapping> {
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_MONTH_MAPPING_TRANSFORM_NODE_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_MONTH_TRANSFORM_NODE_ID;
}
@Override public void process(InstanceMapping instanceMapping, Next<InstanceMapping> next) {
......
......@@ -37,7 +37,7 @@ public class InstanceMappingRemoteWorker extends AbstractRemoteWorker<InstanceMa
}
@Override public int id() {
return MetricWorkerIdDefine.INSTANCE_MINUTE_MAPPING_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_MAPPING_MINUTE_REMOTE_WORKER_ID;
}
@Override protected void onWork(InstanceMapping instanceMapping) throws WorkerException {
......
......@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersiste
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.IApplicationComponentUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
......@@ -121,7 +121,7 @@ public class StorageModule extends Module {
classes.add(IGlobalTracePersistenceDAO.class);
classes.add(IApplicationComponentPersistenceDAO.class);
classes.add(IApplicationMappingPersistenceDAO.class);
classes.add(IApplicationMappingMinutePersistenceDAO.class);
classes.add(IApplicationMinuteMetricPersistenceDAO.class);
classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class);
classes.add(ISegmentCostPersistenceDAO.class);
......
......@@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.storage.dao;
package org.apache.skywalking.apm.collector.storage.dao.ampp;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
......@@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public interface IApplicationMappingPersistenceDAO<Insert, Update, DataImpl extends ApplicationMapping> extends IPersistenceDAO<Insert, Update, DataImpl> {
}
public interface IApplicationMappingDayPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMapping> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public interface IApplicationMappingHourPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMapping> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public interface IApplicationMappingMinutePersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMapping> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
public interface IApplicationMappingMonthPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMapping> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}
\ No newline at end of file
......@@ -16,18 +16,17 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.application;
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 ApplicationMapping extends AbstractData {
public class ApplicationMapping extends StreamData {
private static final Column[] STRING_COLUMNS = {
new Column(ApplicationMappingTable.COLUMN_ID, new NonOperation()),
......@@ -45,8 +44,24 @@ public class ApplicationMapping extends AbstractData {
private static final Column[] BOOLEAN_COLUMNS = {};
private static final Column[] BYTE_COLUMNS = {};
public ApplicationMapping(String id) {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
public ApplicationMapping() {
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 int getApplicationId() {
......
......@@ -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.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMinuteMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO;
......@@ -95,7 +96,7 @@ public class DataTTLKeeperTimer {
IApplicationComponentPersistenceDAO applicationComponentPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class);
applicationComponentPersistenceDAO.deleteHistory(startTimestamp, endTimestamp);
IApplicationMappingPersistenceDAO applicationMappingPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationMappingPersistenceDAO.class);
IApplicationMappingMinutePersistenceDAO applicationMappingPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationMappingMinutePersistenceDAO.class);
applicationMappingPersistenceDAO.deleteHistory(startTimestamp, endTimestamp);
IApplicationReferenceMinuteMetricPersistenceDAO applicationReferenceMetricPersistenceDAO = moduleManager.find(StorageModule.NAME).getService(IApplicationReferenceMinuteMetricPersistenceDAO.class);
......
......@@ -36,7 +36,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersiste
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.IApplicationComponentUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
......@@ -91,7 +91,7 @@ import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationComponentEs
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;
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationMappingEsPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.es.dao.ampp.ApplicationMappingMinuteEsPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationMappingEsUIDAO;
import org.apache.skywalking.apm.collector.storage.es.dao.amp.ApplicationMinuteMetricEsPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationReferenceAlarmEsPersistenceDAO;
......@@ -234,7 +234,7 @@ public class StorageModuleEsProvider extends ModuleProvider {
this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceEsPersistenceDAO(elasticSearchClient));
this.registerServiceImplementation(IApplicationComponentPersistenceDAO.class, new ApplicationComponentEsPersistenceDAO(elasticSearchClient));
this.registerServiceImplementation(IApplicationMappingPersistenceDAO.class, new ApplicationMappingEsPersistenceDAO(elasticSearchClient));
this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingMinuteEsPersistenceDAO(elasticSearchClient));
this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricEsPersistenceDAO(elasticSearchClient));
this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricEsPersistenceDAO(elasticSearchClient));
this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostEsPersistenceDAO(elasticSearchClient));
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.IApplicationMappingPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable;
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 ApplicationMappingEsPersistenceDAO extends EsDAO implements IApplicationMappingPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMapping> {
private final Logger logger = LoggerFactory.getLogger(ApplicationMappingEsPersistenceDAO.class);
public ApplicationMappingEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override public ApplicationMapping get(String id) {
GetResponse getResponse = getClient().prepareGet(ApplicationMappingTable.TABLE, id).get();
if (getResponse.isExists()) {
ApplicationMapping applicationMapping = new ApplicationMapping(id);
Map<String, Object> source = getResponse.getSource();
applicationMapping.setApplicationId(((Number)source.get(ApplicationMappingTable.COLUMN_APPLICATION_ID)).intValue());
applicationMapping.setAddressId(((Number)source.get(ApplicationMappingTable.COLUMN_ADDRESS_ID)).intValue());
applicationMapping.setTimeBucket(((Number)source.get(ApplicationMappingTable.COLUMN_TIME_BUCKET)).longValue());
return applicationMapping;
} else {
return null;
}
}
@Override public IndexRequestBuilder prepareBatchInsert(ApplicationMapping data) {
Map<String, Object> source = new HashMap<>();
source.put(ApplicationMappingTable.COLUMN_APPLICATION_ID, data.getApplicationId());
source.put(ApplicationMappingTable.COLUMN_ADDRESS_ID, data.getAddressId());
source.put(ApplicationMappingTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
return getClient().prepareIndex(ApplicationMappingTable.TABLE, data.getId()).setSource(source);
}
@Override public UpdateRequestBuilder prepareBatchUpdate(ApplicationMapping data) {
Map<String, Object> source = new HashMap<>();
source.put(ApplicationMappingTable.COLUMN_APPLICATION_ID, data.getApplicationId());
source.put(ApplicationMappingTable.COLUMN_ADDRESS_ID, data.getAddressId());
source.put(ApplicationMappingTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
return getClient().prepareUpdate(ApplicationMappingTable.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(ApplicationMappingTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket))
.source(ApplicationMappingTable.TABLE)
.get();
long deleted = response.getDeleted();
logger.info("Delete {} rows history from {} index.", deleted, ApplicationMappingTable.TABLE);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
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.ApplicationMapping;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable;
/**
* @author peng-yongsheng
*/
public abstract class AbstractApplicationMappingEsPersistenceDAO extends AbstractPersistenceEsDAO<ApplicationMapping> {
AbstractApplicationMappingEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected final String timeBucketColumnNameForDelete() {
return ApplicationMappingTable.COLUMN_TIME_BUCKET;
}
@Override protected final ApplicationMapping esDataToStreamData(Map<String, Object> source) {
ApplicationMapping applicationMapping = new ApplicationMapping();
applicationMapping.setId((String)source.get(ApplicationMappingTable.COLUMN_ID));
applicationMapping.setMetricId((String)source.get(ApplicationMappingTable.COLUMN_METRIC_ID));
applicationMapping.setApplicationId(((Number)source.get(ApplicationMappingTable.COLUMN_APPLICATION_ID)).intValue());
applicationMapping.setAddressId(((Number)source.get(ApplicationMappingTable.COLUMN_ADDRESS_ID)).intValue());
applicationMapping.setTimeBucket(((Number)source.get(ApplicationMappingTable.COLUMN_TIME_BUCKET)).longValue());
return applicationMapping;
}
@Override protected final Map<String, Object> esStreamDataToEsData(ApplicationMapping streamData) {
Map<String, Object> source = new HashMap<>();
source.put(ApplicationMappingTable.COLUMN_ID, streamData.getId());
source.put(ApplicationMappingTable.COLUMN_METRIC_ID, streamData.getMetricId());
source.put(ApplicationMappingTable.COLUMN_APPLICATION_ID, streamData.getApplicationId());
source.put(ApplicationMappingTable.COLUMN_ADDRESS_ID, streamData.getAddressId());
source.put(ApplicationMappingTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket());
return source;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
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.ampp.IApplicationMappingDayPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.update.UpdateRequestBuilder;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingDayEsPersistenceDAO extends AbstractApplicationMappingEsPersistenceDAO implements IApplicationMappingDayPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMapping> {
public ApplicationMappingDayEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
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.ampp.IApplicationMappingHourPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.update.UpdateRequestBuilder;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingHourEsPersistenceDAO extends AbstractApplicationMappingEsPersistenceDAO implements IApplicationMappingHourPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMapping> {
public ApplicationMappingHourEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
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.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.update.UpdateRequestBuilder;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingMinuteEsPersistenceDAO extends AbstractApplicationMappingEsPersistenceDAO implements IApplicationMappingMinutePersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMapping> {
public ApplicationMappingMinuteEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 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.ampp;
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.ampp.IApplicationMappingMonthPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMappingTable;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.update.UpdateRequestBuilder;
/**
* @author peng-yongsheng
*/
public class ApplicationMappingMonthEsPersistenceDAO extends AbstractApplicationMappingEsPersistenceDAO implements IApplicationMappingMonthPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMapping> {
public ApplicationMappingMonthEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationMappingTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName();
}
}
......@@ -32,7 +32,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersiste
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.IApplicationComponentUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
......@@ -87,7 +87,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2UIDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2CacheDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2RegisterDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2PersistenceDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2MinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2UIDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMinuteMetricH2PersistenceDAO;
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceAlarmH2PersistenceDAO;
......@@ -212,7 +212,7 @@ public class StorageModuleH2Provider extends ModuleProvider {
this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client));
this.registerServiceImplementation(IApplicationComponentPersistenceDAO.class, new ApplicationComponentH2PersistenceDAO(h2Client));
this.registerServiceImplementation(IApplicationMappingPersistenceDAO.class, new ApplicationMappingH2PersistenceDAO(h2Client));
this.registerServiceImplementation(IApplicationMappingMinutePersistenceDAO.class, new ApplicationMappingH2MinutePersistenceDAO(h2Client));
this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client));
this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client));
this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client));
......
......@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import org.apache.skywalking.apm.collector.client.h2.H2Client;
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
......@@ -39,12 +39,12 @@ import org.slf4j.LoggerFactory;
/**
* @author peng-yongsheng, clevertension
*/
public class ApplicationMappingH2PersistenceDAO extends H2DAO implements IApplicationMappingPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationMapping> {
public class ApplicationMappingH2MinutePersistenceDAO extends H2DAO implements IApplicationMappingMinutePersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationMapping> {
private final Logger logger = LoggerFactory.getLogger(ApplicationMappingH2PersistenceDAO.class);
private final Logger logger = LoggerFactory.getLogger(ApplicationMappingH2MinutePersistenceDAO.class);
private static final String GET_SQL = "select * from {0} where {1} = ?";
public ApplicationMappingH2PersistenceDAO(H2Client client) {
public ApplicationMappingH2MinutePersistenceDAO(H2Client client) {
super(client);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册