Application component pyramid aggregate.

This commit is contained in:
peng-yongsheng 2018-01-07 22:36:30 +08:00
parent 0b5e3f1db4
commit 8e2e5f4e75
29 changed files with 717 additions and 132 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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<App
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_COMPONENT_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationComponent, ApplicationComponent, ApplicationComponentAggregationWorker> {

View File

@ -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<ApplicationComponent> {
public class ApplicationComponentDayPersistenceWorker extends PersistenceWorker<ApplicationComponent> {
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<App
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationComponent> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class);
return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentDayPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationComponent, ApplicationComponentPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ApplicationComponent, ApplicationComponentDayPersistenceWorker> {
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

View File

@ -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<ApplicationComponent, ApplicationComponent> {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_COMPONENT_DAY_TRANSFORM_NODE_ID;
}
@Override
public void process(ApplicationComponent applicationComponent, Next<ApplicationComponent> next) {
long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationComponent.getTimeBucket());
applicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId());
applicationComponent.setTimeBucket(timeBucket);
next.execute(applicationComponent);
}
}

View File

@ -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<ApplicationComponent, ApplicationComponent> 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));
}
}

View File

@ -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<ApplicationComponent> {
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<?, ?, ApplicationComponent> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentHourPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationComponent, ApplicationComponentHourPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationComponentHourPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationComponentHourPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -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<ApplicationComponent, ApplicationComponent> {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_COMPONENT_HOUR_TRANSFORM_NODE_ID;
}
@Override
public void process(ApplicationComponent applicationComponent, Next<ApplicationComponent> next) {
long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationComponent.getTimeBucket());
applicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId());
applicationComponent.setTimeBucket(timeBucket);
next.execute(applicationComponent);
}
}

View File

@ -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<ApplicationComponent> {
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<?, ?, ApplicationComponent> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMinutePersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationComponent, ApplicationComponentMinutePersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationComponentMinutePersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationComponentMinutePersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -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<ApplicationComponent> {
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<?, ?, ApplicationComponent> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMonthPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationComponent, ApplicationComponentMonthPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationComponentMonthPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationComponentMonthPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -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<ApplicationComponent, ApplicationComponent> {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_COMPONENT_MONTH_TRANSFORM_NODE_ID;
}
@Override
public void process(ApplicationComponent applicationComponent, Next<ApplicationComponent> next) {
long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationComponent.getTimeBucket());
applicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId());
applicationComponent.setTimeBucket(timeBucket);
next.execute(applicationComponent);
}
}

View File

@ -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<Appli
}
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_COMPONENT_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationComponent applicationComponent) throws WorkerException {

View File

@ -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 java.util.ArrayList;
import java.util.List;
@ -50,7 +50,8 @@ public class ApplicationComponentSpanListener implements EntrySpanListener, Exit
public void parseExit(SpanDecorator spanDecorator, int applicationId, int instanceId, String segmentId) {
String id = spanDecorator.getPeerId() + Const.ID_SPLIT + String.valueOf(spanDecorator.getComponentId());
ApplicationComponent applicationComponent = new ApplicationComponent(id);
ApplicationComponent applicationComponent = new ApplicationComponent();
applicationComponent.setId(id);
applicationComponent.setComponentId(spanDecorator.getComponentId());
applicationComponent.setPeerId(spanDecorator.getPeerId());
applicationComponents.add(applicationComponent);
@ -60,7 +61,8 @@ public class ApplicationComponentSpanListener implements EntrySpanListener, Exit
public void parseEntry(SpanDecorator spanDecorator, int applicationId, int instanceId, String segmentId) {
String id = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(spanDecorator.getComponentId());
ApplicationComponent applicationComponent = new ApplicationComponent(id);
ApplicationComponent applicationComponent = new ApplicationComponent();
applicationComponent.setId(id);
applicationComponent.setComponentId(spanDecorator.getComponentId());
applicationComponent.setPeerId(applicationId);
applicationComponents.add(applicationComponent);

View File

@ -25,7 +25,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;
@ -120,7 +120,7 @@ public class StorageModule extends Module {
classes.add(IMemoryPoolMetricPersistenceDAO.class);
classes.add(IGlobalTracePersistenceDAO.class);
classes.add(IApplicationComponentPersistenceDAO.class);
classes.add(IApplicationComponentMinutePersistenceDAO.class);
classes.add(IApplicationMappingMinutePersistenceDAO.class);
classes.add(IApplicationMinuteMetricPersistenceDAO.class);
classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class);

View File

@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.storage.dao;
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;
@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public interface IApplicationComponentPersistenceDAO<Insert, Update, DataImpl extends ApplicationComponent> extends IPersistenceDAO<Insert, Update, DataImpl> {
public interface IApplicationComponentDayPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationComponent> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}

View File

@ -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<INSERT, UPDATE, STREAM_DATA extends ApplicationComponent> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}

View File

@ -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<INSERT, UPDATE, STREAM_DATA extends ApplicationComponent> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}

View File

@ -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<INSERT, UPDATE, STREAM_DATA extends ApplicationComponent> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
}

View File

@ -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);

View File

@ -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));

View File

@ -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<IndexRequestBuilder, UpdateRequestBuilder, ApplicationComponent> {
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<String, Object> 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<String, Object> 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<String, Object> 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);
}
}

View File

@ -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);

View File

@ -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<ApplicationComponent> {
AbstractApplicationComponentEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected final String timeBucketColumnNameForDelete() {
return ApplicationComponentTable.COLUMN_TIME_BUCKET;
}
@Override protected final ApplicationComponent esDataToStreamData(Map<String, Object> 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<String, Object> esStreamDataToEsData(ApplicationComponent streamData) {
Map<String, Object> 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;
}
}

View File

@ -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<IndexRequestBuilder, UpdateRequestBuilder, ApplicationComponent> {
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();
}
}

View File

@ -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<IndexRequestBuilder, UpdateRequestBuilder, ApplicationComponent> {
public ApplicationComponentHourEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName();
}
}

View File

@ -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<IndexRequestBuilder, UpdateRequestBuilder, ApplicationComponent> {
public ApplicationComponentMinuteEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName();
}
}

View File

@ -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<IndexRequestBuilder, UpdateRequestBuilder, ApplicationComponent> {
public ApplicationComponentMonthEsPersistenceDAO(ElasticSearchClient client) {
super(client);
}
@Override protected String tableName() {
return ApplicationComponentTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName();
}
}

View File

@ -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));

View File

@ -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<H2SqlEntity, H2SqlEntity, ApplicationComponent> {
private final Logger logger = LoggerFactory.getLogger(ApplicationComponentH2PersistenceDAO.class);
public class ApplicationComponentH2MinutePersistenceDAO extends H2DAO implements IApplicationComponentMinutePersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationComponent> {
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);
}