CPU metric pyramid aggregate by h2 storage test successful.
This commit is contained in:
parent
d42eb0199b
commit
ccd4c8ef83
|
|
@ -46,9 +46,9 @@ public class JVMMetricServiceHandlerTestCase {
|
|||
metricBuilder.setTime(System.currentTimeMillis());
|
||||
|
||||
buildCPUMetric(metricBuilder);
|
||||
buildGCMetric(metricBuilder);
|
||||
buildMemoryMetric(metricBuilder);
|
||||
buildMemoryPoolMetric(metricBuilder);
|
||||
// buildGCMetric(metricBuilder);
|
||||
// buildMemoryMetric(metricBuilder);
|
||||
// buildMemoryPoolMetric(metricBuilder);
|
||||
|
||||
builder.addMetrics(metricBuilder.build());
|
||||
|
||||
|
|
|
|||
|
|
@ -27,46 +27,14 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
|
|||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IGlobalTracePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IGlobalTraceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IInstanceHeartBeatPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentCostPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentCostUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO;
|
||||
|
|
@ -76,45 +44,10 @@ import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersi
|
|||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMonthMetricPersistenceDAO;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
|
|
@ -155,11 +88,11 @@ public class StorageModule extends Module {
|
|||
}
|
||||
|
||||
private void addPersistenceDAO(List<Class> classes) {
|
||||
// classes.add(ICpuSecondMetricPersistenceDAO.class);
|
||||
// classes.add(ICpuMinuteMetricPersistenceDAO.class);
|
||||
// classes.add(ICpuHourMetricPersistenceDAO.class);
|
||||
// classes.add(ICpuDayMetricPersistenceDAO.class);
|
||||
// classes.add(ICpuMonthMetricPersistenceDAO.class);
|
||||
classes.add(ICpuSecondMetricPersistenceDAO.class);
|
||||
classes.add(ICpuMinuteMetricPersistenceDAO.class);
|
||||
classes.add(ICpuHourMetricPersistenceDAO.class);
|
||||
classes.add(ICpuDayMetricPersistenceDAO.class);
|
||||
classes.add(ICpuMonthMetricPersistenceDAO.class);
|
||||
//
|
||||
// classes.add(IGCSecondMetricPersistenceDAO.class);
|
||||
// classes.add(IGCMinuteMetricPersistenceDAO.class);
|
||||
|
|
|
|||
|
|
@ -16,13 +16,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.base.sql;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng, clevertension
|
||||
*/
|
||||
public class SqlBuilder {
|
||||
public static String buildSql(String sql, Object... args) {
|
||||
return MessageFormat.format(sql, args);
|
||||
|
|
|
|||
|
|
@ -1,64 +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.register;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.Application;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationEsRegisterDAO extends EsDAO implements IApplicationRegisterDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApplicationEsRegisterDAO.class);
|
||||
|
||||
public ApplicationEsRegisterDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public int getMaxApplicationId() {
|
||||
return getMaxId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID);
|
||||
}
|
||||
|
||||
@Override public int getMinApplicationId() {
|
||||
return getMinId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID);
|
||||
}
|
||||
|
||||
@Override public void save(Application application) {
|
||||
logger.debug("save application register info, application getId: {}, application code: {}", application.getId(), application.getApplicationCode());
|
||||
ElasticSearchClient client = getClient();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationTable.COLUMN_APPLICATION_CODE, application.getApplicationCode());
|
||||
source.put(ApplicationTable.COLUMN_APPLICATION_ID, application.getApplicationId());
|
||||
source.put(ApplicationTable.COLUMN_ADDRESS_ID, application.getAddressId());
|
||||
source.put(ApplicationTable.COLUMN_IS_ADDRESS, application.getIsAddress());
|
||||
|
||||
IndexResponse response = client.prepareIndex(ApplicationTable.TABLE, application.getId()).setSource(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();
|
||||
logger.debug("save application register info, application getId: {}, application code: {}, status: {}", application.getApplicationId(), application.getApplicationCode(), response.status().name());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +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.register;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.Instance;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class InstanceEsRegisterDAO extends EsDAO implements IInstanceRegisterDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(InstanceEsRegisterDAO.class);
|
||||
|
||||
public InstanceEsRegisterDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public int getMaxInstanceId() {
|
||||
return getMaxId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID);
|
||||
}
|
||||
|
||||
@Override public int getMinInstanceId() {
|
||||
return getMinId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID);
|
||||
}
|
||||
|
||||
@Override public void save(Instance instance) {
|
||||
logger.debug("save instance register info, application getId: {}, agentUUID: {}", instance.getApplicationId(), instance.getAgentUUID());
|
||||
ElasticSearchClient client = getClient();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(InstanceTable.COLUMN_INSTANCE_ID, instance.getInstanceId());
|
||||
source.put(InstanceTable.COLUMN_APPLICATION_ID, instance.getApplicationId());
|
||||
source.put(InstanceTable.COLUMN_AGENT_UUID, instance.getAgentUUID());
|
||||
source.put(InstanceTable.COLUMN_REGISTER_TIME, instance.getRegisterTime());
|
||||
source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, instance.getHeartBeatTime());
|
||||
source.put(InstanceTable.COLUMN_OS_INFO, instance.getOsInfo());
|
||||
source.put(InstanceTable.COLUMN_ADDRESS_ID, instance.getAddressId());
|
||||
source.put(InstanceTable.COLUMN_IS_ADDRESS, instance.getIsAddress());
|
||||
|
||||
IndexResponse response = client.prepareIndex(InstanceTable.TABLE, instance.getId()).setSource(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();
|
||||
logger.debug("save instance register info, application getId: {}, agentUUID: {}, status: {}", instance.getApplicationId(), instance.getAgentUUID(), response.status().name());
|
||||
}
|
||||
|
||||
@Override public void updateHeartbeatTime(int instanceId, long heartbeatTime) {
|
||||
ElasticSearchClient client = getClient();
|
||||
UpdateRequest updateRequest = new UpdateRequest();
|
||||
updateRequest.index(InstanceTable.TABLE);
|
||||
updateRequest.type("type");
|
||||
updateRequest.id(String.valueOf(instanceId));
|
||||
updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, heartbeatTime);
|
||||
|
||||
updateRequest.doc(source);
|
||||
client.update(updateRequest);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +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.register;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ServiceName;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ServiceNameTable;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ServiceNameEsRegisterDAO extends EsDAO implements IServiceNameRegisterDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ServiceNameEsRegisterDAO.class);
|
||||
|
||||
public ServiceNameEsRegisterDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public int getMaxServiceId() {
|
||||
return getMaxId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID);
|
||||
}
|
||||
|
||||
@Override public int getMinServiceId() {
|
||||
return getMinId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID);
|
||||
}
|
||||
|
||||
@Override public void save(ServiceName serviceName) {
|
||||
logger.debug("save service name register info, application getId: {}, service name: {}", serviceName.getId(), serviceName.getServiceName());
|
||||
ElasticSearchClient client = getClient();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ServiceNameTable.COLUMN_SERVICE_ID, serviceName.getServiceId());
|
||||
source.put(ServiceNameTable.COLUMN_APPLICATION_ID, serviceName.getApplicationId());
|
||||
source.put(ServiceNameTable.COLUMN_SERVICE_NAME, serviceName.getServiceName());
|
||||
|
||||
IndexResponse response = client.prepareIndex(ServiceNameTable.TABLE, serviceName.getId()).setSource(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();
|
||||
logger.debug("save service name register info, application getId: {}, service name: {}, status: {}", serviceName.getId(), serviceName.getServiceName(), response.status().name());
|
||||
}
|
||||
}
|
||||
|
|
@ -27,108 +27,60 @@ import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedExcepti
|
|||
import org.apache.skywalking.apm.collector.storage.StorageException;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IBatchDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IApplicationCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IGlobalTracePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IGlobalTraceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IInstanceHeartBeatPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentCostPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentCostUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ISegmentUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IServiceNameCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
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.cache.IApplicationCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IInstanceCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.INetworkAddressCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cache.IServiceNameCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.imp.IInstanceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.irmp.IInstanceReferenceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.smp.IServiceMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO;
|
||||
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.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.register.ApplicationRegisterH2DAO;
|
||||
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;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMetricH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMinuteMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.CpuMetricH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.CpuSecondMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.GCMetricH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.GCSecondMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.GlobalTraceH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.GlobalTraceH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceH2CacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.InstanceRegisterH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceHeartBeatH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMappingH2MinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMetricH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceMinuteMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceReferenceAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceReferenceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.InstanceReferenceMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.MemoryMetricH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.MemoryPoolMetricH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.MemoryPoolSecondMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.MemorySecondMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.NetworkAddressH2CacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.NetworkAddressRegisterH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.SegmentCostH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.SegmentCostH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.SegmentH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.SegmentH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceMinuteMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceNameH2CacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.ServiceNameRegisterH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ServiceReferenceMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuDayMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuHourMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuMinuteMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuMonthMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.cpump.CpuSecondMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.ApplicationRegisterH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.InstanceRegisterH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.NetworkAddressRegisterH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.register.ServiceNameRegisterH2DAO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -201,7 +153,12 @@ public class StorageModuleH2Provider extends ModuleProvider {
|
|||
}
|
||||
|
||||
private void registerPersistenceDAO() throws ServiceNotProvidedException {
|
||||
// this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ICpuSecondMetricPersistenceDAO.class, new CpuSecondMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ICpuMinuteMetricPersistenceDAO.class, new CpuMinuteMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ICpuHourMetricPersistenceDAO.class, new CpuHourMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ICpuDayMetricPersistenceDAO.class, new CpuDayMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ICpuMonthMetricPersistenceDAO.class, new CpuMonthMetricH2PersistenceDAO(h2Client));
|
||||
|
||||
// this.registerServiceImplementation(IGCSecondMetricPersistenceDAO.class, new GCSecondMetricH2PersistenceDAO(h2Client));
|
||||
// this.registerServiceImplementation(IMemorySecondMetricPersistenceDAO.class, new MemorySecondMetricH2PersistenceDAO(h2Client));
|
||||
// this.registerServiceImplementation(IMemoryPoolSecondMetricPersistenceDAO.class, new MemoryPoolSecondMetricH2PersistenceDAO(h2Client));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.base.dao;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.apache.skywalking.apm.collector.core.data.CommonTable;
|
||||
import org.apache.skywalking.apm.collector.core.data.StreamData;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public abstract class AbstractPersistenceH2DAO<STREAM_DATA extends StreamData> extends H2DAO implements IPersistenceDAO<H2SqlEntity, H2SqlEntity, STREAM_DATA> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(AbstractPersistenceH2DAO.class);
|
||||
|
||||
public AbstractPersistenceH2DAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
private static final String GET_SQL = "select * from {0} where {1} = ?";
|
||||
|
||||
protected abstract STREAM_DATA h2DataToStreamData(ResultSet resultSet) throws SQLException;
|
||||
|
||||
protected abstract String tableName();
|
||||
|
||||
@Override public final STREAM_DATA get(String id) {
|
||||
String sql = SqlBuilder.buildSql(GET_SQL, tableName(), CommonTable.COLUMN_ID);
|
||||
|
||||
Object[] params = new Object[] {id};
|
||||
try (ResultSet resultSet = getClient().executeQuery(sql, params)) {
|
||||
if (resultSet.next()) {
|
||||
return h2DataToStreamData(resultSet);
|
||||
}
|
||||
} catch (SQLException | H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract Map<String, Object> streamDataToH2Data(STREAM_DATA streamData);
|
||||
|
||||
@Override public final H2SqlEntity prepareBatchInsert(STREAM_DATA streamData) {
|
||||
Map<String, Object> source = streamDataToH2Data(streamData);
|
||||
source.put(CommonTable.COLUMN_ID, streamData.getId());
|
||||
|
||||
H2SqlEntity entity = new H2SqlEntity();
|
||||
|
||||
String sql = SqlBuilder.buildBatchInsertSql(tableName(), source.keySet());
|
||||
entity.setSql(sql);
|
||||
entity.setParams(source.values().toArray(new Object[0]));
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override public final H2SqlEntity prepareBatchUpdate(STREAM_DATA streamData) {
|
||||
Map<String, Object> source = streamDataToH2Data(streamData);
|
||||
|
||||
H2SqlEntity entity = new H2SqlEntity();
|
||||
String sql = SqlBuilder.buildBatchUpdateSql(tableName(), source.keySet(), CommonTable.COLUMN_ID);
|
||||
entity.setSql(sql);
|
||||
List<Object> values = new ArrayList<>(source.values());
|
||||
values.add(streamData.getId());
|
||||
entity.setParams(values.toArray(new Object[0]));
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override public final void deleteHistory(Long startTimestamp, Long endTimestamp) {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +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.h2.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IApplicationRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.Application;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng, clevertension
|
||||
*/
|
||||
public class ApplicationH2RegisterDAO extends H2DAO implements IApplicationRegisterDAO {
|
||||
private final Logger logger = LoggerFactory.getLogger(ApplicationH2RegisterDAO.class);
|
||||
|
||||
public ApplicationH2RegisterDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxApplicationId() {
|
||||
return getMaxId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinApplicationId() {
|
||||
return getMinId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Application application) {
|
||||
H2Client client = getClient();
|
||||
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationTable.COLUMN_ID, application.getId());
|
||||
source.put(ApplicationTable.COLUMN_APPLICATION_CODE, application.getApplicationCode());
|
||||
source.put(ApplicationTable.COLUMN_APPLICATION_ID, application.getApplicationId());
|
||||
source.put(ApplicationTable.COLUMN_ADDRESS_ID, application.getAddressId());
|
||||
source.put(ApplicationTable.COLUMN_IS_ADDRESS, application.getIsAddress());
|
||||
|
||||
String sql = SqlBuilder.buildBatchInsertSql(ApplicationTable.TABLE, source.keySet());
|
||||
Object[] params = source.values().toArray(new Object[0]);
|
||||
try {
|
||||
client.execute(sql, params);
|
||||
} catch (H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +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.h2.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.Instance;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng, clevertension
|
||||
*/
|
||||
public class InstanceH2RegisterDAO extends H2DAO implements IInstanceRegisterDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(InstanceH2RegisterDAO.class);
|
||||
|
||||
public InstanceH2RegisterDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
private static final String UPDATE_HEARTBEAT_TIME_SQL = "update {0} set {1} = ? where {2} = ?";
|
||||
|
||||
@Override public int getMaxInstanceId() {
|
||||
return getMaxId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID);
|
||||
}
|
||||
|
||||
@Override public int getMinInstanceId() {
|
||||
return getMinId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID);
|
||||
}
|
||||
|
||||
@Override public void save(Instance instance) {
|
||||
H2Client client = getClient();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(InstanceTable.COLUMN_ID, instance.getId());
|
||||
source.put(InstanceTable.COLUMN_INSTANCE_ID, instance.getInstanceId());
|
||||
source.put(InstanceTable.COLUMN_APPLICATION_ID, instance.getApplicationId());
|
||||
source.put(InstanceTable.COLUMN_AGENT_UUID, instance.getAgentUUID());
|
||||
source.put(InstanceTable.COLUMN_REGISTER_TIME, instance.getRegisterTime());
|
||||
source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, instance.getHeartBeatTime());
|
||||
source.put(InstanceTable.COLUMN_OS_INFO, instance.getOsInfo());
|
||||
source.put(InstanceTable.COLUMN_ADDRESS_ID, instance.getAddressId());
|
||||
source.put(InstanceTable.COLUMN_IS_ADDRESS, instance.getIsAddress());
|
||||
|
||||
String sql = SqlBuilder.buildBatchInsertSql(InstanceTable.TABLE, source.keySet());
|
||||
Object[] params = source.values().toArray(new Object[0]);
|
||||
try {
|
||||
client.execute(sql, params);
|
||||
} catch (H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void updateHeartbeatTime(int instanceId, long heartbeatTime) {
|
||||
H2Client client = getClient();
|
||||
String sql = SqlBuilder.buildSql(UPDATE_HEARTBEAT_TIME_SQL, InstanceTable.TABLE, InstanceTable.COLUMN_HEARTBEAT_TIME,
|
||||
InstanceTable.COLUMN_ID);
|
||||
Object[] params = new Object[] {heartbeatTime, instanceId};
|
||||
try {
|
||||
client.execute(sql, params);
|
||||
} catch (H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +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.h2.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.INetworkAddressRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.NetworkAddress;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.NetworkAddressTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng, clevertension
|
||||
*/
|
||||
public class NetworkAddressRegisterH2DAO extends H2DAO implements INetworkAddressRegisterDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterH2DAO.class);
|
||||
|
||||
public NetworkAddressRegisterH2DAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxNetworkAddressId() {
|
||||
return getMaxId(NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinNetworkAddressId() {
|
||||
return getMinId(NetworkAddressTable.TABLE, NetworkAddressTable.COLUMN_ADDRESS_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(NetworkAddress networkAddress) {
|
||||
H2Client client = getClient();
|
||||
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(NetworkAddressTable.COLUMN_ID, networkAddress.getId());
|
||||
source.put(NetworkAddressTable.COLUMN_NETWORK_ADDRESS, networkAddress.getNetworkAddress());
|
||||
source.put(NetworkAddressTable.COLUMN_ADDRESS_ID, networkAddress.getAddressId());
|
||||
|
||||
String sql = SqlBuilder.buildBatchInsertSql(NetworkAddressTable.TABLE, source.keySet());
|
||||
Object[] params = source.values().toArray(new Object[0]);
|
||||
try {
|
||||
client.execute(sql, params);
|
||||
} catch (H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +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.h2.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.register.IServiceNameRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ServiceNameTable;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ServiceName;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng, clevertension
|
||||
*/
|
||||
public class ServiceNameH2RegisterDAO extends H2DAO implements IServiceNameRegisterDAO {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ServiceNameH2RegisterDAO.class);
|
||||
|
||||
public ServiceNameH2RegisterDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxServiceId() {
|
||||
return getMaxId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinServiceId() {
|
||||
return getMinId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ServiceName serviceName) {
|
||||
logger.debug("save service name register info, application getId: {}, service name: {}", serviceName.getId(), serviceName.getServiceName());
|
||||
H2Client client = getClient();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ServiceNameTable.COLUMN_ID, serviceName.getId());
|
||||
source.put(ServiceNameTable.COLUMN_SERVICE_ID, serviceName.getServiceId());
|
||||
source.put(ServiceNameTable.COLUMN_APPLICATION_ID, serviceName.getApplicationId());
|
||||
source.put(ServiceNameTable.COLUMN_SERVICE_NAME, serviceName.getServiceName());
|
||||
|
||||
String sql = SqlBuilder.buildBatchInsertSql(ServiceNameTable.TABLE, source.keySet());
|
||||
Object[] params = source.values().toArray(new Object[0]);
|
||||
try {
|
||||
client.execute(sql, params);
|
||||
} catch (H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao.cpump;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public abstract class AbstractCpuMetricH2PersistenceDAO extends AbstractPersistenceH2DAO<CpuMetric> {
|
||||
|
||||
public AbstractCpuMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected final CpuMetric h2DataToStreamData(ResultSet resultSet) throws SQLException {
|
||||
CpuMetric cpuMetric = new CpuMetric();
|
||||
cpuMetric.setId(resultSet.getString(CpuMetricTable.COLUMN_ID));
|
||||
cpuMetric.setMetricId(resultSet.getString(CpuMetricTable.COLUMN_METRIC_ID));
|
||||
|
||||
cpuMetric.setInstanceId(resultSet.getInt(CpuMetricTable.COLUMN_INSTANCE_ID));
|
||||
|
||||
cpuMetric.setUsagePercent(resultSet.getDouble(CpuMetricTable.COLUMN_USAGE_PERCENT));
|
||||
cpuMetric.setTimes(resultSet.getLong(CpuMetricTable.COLUMN_TIMES));
|
||||
cpuMetric.setTimeBucket(resultSet.getLong(CpuMetricTable.COLUMN_TIME_BUCKET));
|
||||
|
||||
return cpuMetric;
|
||||
}
|
||||
|
||||
@Override protected final Map<String, Object> streamDataToH2Data(CpuMetric streamData) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(CpuMetricTable.COLUMN_METRIC_ID, streamData.getMetricId());
|
||||
|
||||
source.put(CpuMetricTable.COLUMN_INSTANCE_ID, streamData.getInstanceId());
|
||||
source.put(CpuMetricTable.COLUMN_USAGE_PERCENT, streamData.getUsagePercent());
|
||||
source.put(CpuMetricTable.COLUMN_TIMES, streamData.getTimes());
|
||||
source.put(CpuMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket());
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao.cpump;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuDayMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuDayMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, CpuMetric> {
|
||||
|
||||
public CpuDayMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao.cpump;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuHourMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuHourMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, CpuMetric> {
|
||||
|
||||
public CpuHourMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao.cpump;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuMinuteMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuMinuteMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, CpuMetric> {
|
||||
|
||||
public CpuMinuteMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao.cpump;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuMonthMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuMonthMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, CpuMetric> {
|
||||
|
||||
public CpuMonthMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao.cpump;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuSecondMetricH2PersistenceDAO extends AbstractCpuMetricH2PersistenceDAO implements ICpuSecondMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, CpuMetric> {
|
||||
|
||||
public CpuSecondMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +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.h2.define;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class InstanceH2TableDefine extends H2TableDefine {
|
||||
|
||||
public InstanceH2TableDefine() {
|
||||
super(InstanceTable.TABLE);
|
||||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_AGENT_UUID, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_REGISTER_TIME, H2ColumnDefine.Type.Bigint.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_HEARTBEAT_TIME, H2ColumnDefine.Type.Bigint.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_OS_INFO, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(InstanceTable.COLUMN_IS_ADDRESS, H2ColumnDefine.Type.Boolean.name()));
|
||||
}
|
||||
}
|
||||
|
|
@ -16,26 +16,27 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define;
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define.cpu;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2TableDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.table.register.ApplicationTable;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationH2TableDefine extends H2TableDefine {
|
||||
public abstract class AbstractCpuMetricH2TableDefine extends H2TableDefine {
|
||||
|
||||
public ApplicationH2TableDefine() {
|
||||
super(ApplicationTable.TABLE);
|
||||
AbstractCpuMetricH2TableDefine(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_APPLICATION_CODE, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_IS_ADDRESS, H2ColumnDefine.Type.Boolean.name()));
|
||||
@Override public final void initialize() {
|
||||
addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_METRIC_ID, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_USAGE_PERCENT, H2ColumnDefine.Type.Double.name()));
|
||||
addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_TIMES, H2ColumnDefine.Type.Bigint.name()));
|
||||
addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define.cpu;
|
||||
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuDayMetricH2TableDefine extends AbstractCpuMetricH2TableDefine {
|
||||
|
||||
public CpuDayMetricH2TableDefine() {
|
||||
super(CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define.cpu;
|
||||
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuHourMetricH2TableDefine extends AbstractCpuMetricH2TableDefine {
|
||||
|
||||
public CpuHourMetricH2TableDefine() {
|
||||
super(CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define.cpu;
|
||||
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuMinuteMetricH2TableDefine extends AbstractCpuMetricH2TableDefine {
|
||||
|
||||
public CpuMinuteMetricH2TableDefine() {
|
||||
super(CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define.cpu;
|
||||
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuMonthMetricH2TableDefine extends AbstractCpuMetricH2TableDefine {
|
||||
|
||||
public CpuMonthMetricH2TableDefine() {
|
||||
super(CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.define.cpu;
|
||||
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuSecondMetricH2TableDefine extends AbstractCpuMetricH2TableDefine {
|
||||
|
||||
public CpuSecondMetricH2TableDefine() {
|
||||
super(CpuMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Second.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -3,3 +3,8 @@ org.apache.skywalking.apm.collector.storage.h2.define.register.ApplicationH2Tabl
|
|||
org.apache.skywalking.apm.collector.storage.h2.define.register.InstanceH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.register.ServiceNameH2TableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuSecondMetricH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuMinuteMetricH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuHourMetricH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuDayMetricH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.cpu.CpuMonthMetricH2TableDefine
|
||||
Loading…
Reference in New Issue