Compile success.
This commit is contained in:
parent
97abe99bfd
commit
d2b4edd8d9
|
|
@ -20,8 +20,8 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.serv
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.MetricSource;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.ReferenceDecorator;
|
||||
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
|
||||
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
|
||||
|
|
@ -55,7 +55,7 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
|
|||
@Override
|
||||
public void parseFirst(SpanDecorator spanDecorator, int applicationId, int instanceId,
|
||||
String segmentId) {
|
||||
timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime());
|
||||
this.timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -65,8 +65,6 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
|
|||
for (int i = 0; i < spanDecorator.getRefsCount(); i++) {
|
||||
ReferenceDecorator reference = spanDecorator.getRefs(i);
|
||||
ServiceReferenceMetric serviceReferenceMetric = new ServiceReferenceMetric(Const.EMPTY_STRING);
|
||||
serviceReferenceMetric.setEntryServiceId(reference.getEntryServiceId());
|
||||
serviceReferenceMetric.setEntryInstanceId(reference.getEntryApplicationInstanceId());
|
||||
serviceReferenceMetric.setFrontServiceId(reference.getParentServiceId());
|
||||
serviceReferenceMetric.setFrontInstanceId(reference.getParentApplicationInstanceId());
|
||||
serviceReferenceMetric.setBehindServiceId(spanDecorator.getOperationNameId());
|
||||
|
|
@ -77,8 +75,6 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
|
|||
}
|
||||
} else {
|
||||
ServiceReferenceMetric serviceReferenceMetric = new ServiceReferenceMetric(Const.EMPTY_STRING);
|
||||
serviceReferenceMetric.setEntryServiceId(spanDecorator.getOperationNameId());
|
||||
serviceReferenceMetric.setEntryInstanceId(instanceId);
|
||||
serviceReferenceMetric.setFrontServiceId(Const.NONE_SERVICE_ID);
|
||||
serviceReferenceMetric.setFrontInstanceId(instanceId);
|
||||
serviceReferenceMetric.setBehindServiceId(spanDecorator.getOperationNameId());
|
||||
|
|
@ -135,7 +131,7 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
|
|||
logger.debug("service reference listener build");
|
||||
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
|
||||
entryReferenceMetric.forEach(serviceReferenceMetric -> {
|
||||
String id = timeBucket + Const.ID_SPLIT + serviceReferenceMetric.getEntryServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getFrontServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getBehindServiceId();
|
||||
String id = timeBucket + Const.ID_SPLIT + serviceReferenceMetric.getFrontServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getBehindServiceId();
|
||||
|
||||
serviceReferenceMetric.setId(id);
|
||||
serviceReferenceMetric.setTimeBucket(timeBucket);
|
||||
|
|
@ -145,16 +141,13 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
|
|||
});
|
||||
|
||||
exitReferenceMetric.forEach(serviceReferenceMetric -> {
|
||||
serviceReferenceMetric.setEntryInstanceId(Const.NONE_INSTANCE_ID);
|
||||
if (ObjectUtils.isNotEmpty(entrySpanDecorator)) {
|
||||
serviceReferenceMetric.setEntryServiceId(entrySpanDecorator.getOperationNameId());
|
||||
serviceReferenceMetric.setFrontServiceId(entrySpanDecorator.getOperationNameId());
|
||||
} else {
|
||||
serviceReferenceMetric.setEntryServiceId(Const.NONE_SERVICE_ID);
|
||||
serviceReferenceMetric.setFrontServiceId(Const.NONE_SERVICE_ID);
|
||||
}
|
||||
|
||||
String id = timeBucket + Const.ID_SPLIT + serviceReferenceMetric.getEntryServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getFrontServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getBehindServiceId();
|
||||
String id = timeBucket + Const.ID_SPLIT + serviceReferenceMetric.getFrontServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getBehindServiceId();
|
||||
serviceReferenceMetric.setId(id);
|
||||
serviceReferenceMetric.setTimeBucket(timeBucket);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ 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.IAlertingListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO;
|
||||
|
|
@ -71,7 +70,6 @@ import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceMetricPe
|
|||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
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.AlertingListEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationComponentEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationComponentEsUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationEsCacheDAO;
|
||||
|
|
@ -149,7 +147,7 @@ public class StorageModuleEsProvider extends ModuleProvider {
|
|||
registerRegisterDAO();
|
||||
registerPersistenceDAO();
|
||||
registerUiDAO();
|
||||
registerAlertingDAO();
|
||||
registerAlarmDAO();
|
||||
}
|
||||
|
||||
@Override public void start(Properties config) throws ServiceNotProvidedException {
|
||||
|
|
@ -237,7 +235,6 @@ public class StorageModuleEsProvider extends ModuleProvider {
|
|||
this.registerServiceImplementation(IServiceReferenceUIDAO.class, new ServiceReferenceEsUIDAO(elasticSearchClient));
|
||||
}
|
||||
|
||||
private void registerAlertingDAO() throws ServiceNotProvidedException {
|
||||
this.registerServiceImplementation(IAlertingListPersistenceDAO.class, new AlertingListEsPersistenceDAO(elasticSearchClient));
|
||||
private void registerAlarmDAO() throws ServiceNotProvidedException {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,104 +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.storage.es.base.dao.EsDAO;
|
||||
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.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IAlertingListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.AlertingList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.AlertingListTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class AlertingListEsPersistenceDAO extends EsDAO implements IAlertingListPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, AlertingList> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(AlertingListEsPersistenceDAO.class);
|
||||
|
||||
public AlertingListEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public AlertingList get(String id) {
|
||||
GetResponse getResponse = getClient().prepareGet(AlertingListTable.TABLE, id).get();
|
||||
if (getResponse.isExists()) {
|
||||
AlertingList alertingList = new AlertingList(id);
|
||||
Map<String, Object> source = getResponse.getSource();
|
||||
alertingList.setLayer(((Number)source.get(AlertingListTable.COLUMN_LAYER)).intValue());
|
||||
alertingList.setLayerId(((Number)source.get(AlertingListTable.COLUMN_LAYER_ID)).intValue());
|
||||
alertingList.setFirstTimeBucket(((Number)source.get(AlertingListTable.COLUMN_FIRST_TIME_BUCKET)).longValue());
|
||||
alertingList.setLastTimeBucket(((Number)source.get(AlertingListTable.COLUMN_LAST_TIME_BUCKET)).longValue());
|
||||
alertingList.setExpected(((Number)source.get(AlertingListTable.COLUMN_EXPECTED)).intValue());
|
||||
alertingList.setActual(((Number)source.get(AlertingListTable.COLUMN_ACTUAL)).intValue());
|
||||
alertingList.setValid((Boolean)source.get(AlertingListTable.COLUMN_VALID));
|
||||
return alertingList;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public IndexRequestBuilder prepareBatchInsert(AlertingList data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(AlertingListTable.COLUMN_LAYER, data.getLayer());
|
||||
source.put(AlertingListTable.COLUMN_LAYER_ID, data.getLayerId());
|
||||
source.put(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, data.getFirstTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_LAST_TIME_BUCKET, data.getLastTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_EXPECTED, data.getExpected());
|
||||
source.put(AlertingListTable.COLUMN_ACTUAL, data.getActual());
|
||||
source.put(AlertingListTable.COLUMN_VALID, data.getValid());
|
||||
|
||||
return getClient().prepareIndex(AlertingListTable.TABLE, data.getId()).setSource(source);
|
||||
}
|
||||
|
||||
@Override public UpdateRequestBuilder prepareBatchUpdate(AlertingList data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(AlertingListTable.COLUMN_LAYER, data.getLayer());
|
||||
source.put(AlertingListTable.COLUMN_LAYER_ID, data.getLayerId());
|
||||
source.put(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, data.getFirstTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_LAST_TIME_BUCKET, data.getLastTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_EXPECTED, data.getExpected());
|
||||
source.put(AlertingListTable.COLUMN_ACTUAL, data.getActual());
|
||||
source.put(AlertingListTable.COLUMN_VALID, data.getValid());
|
||||
|
||||
return getClient().prepareUpdate(AlertingListTable.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(AlertingListTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket))
|
||||
.source(AlertingListTable.TABLE)
|
||||
.get();
|
||||
|
||||
long deleted = response.getDeleted();
|
||||
logger.info("Delete {} rows history from {} index.", deleted, AlertingListTable.TABLE);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,14 +16,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.util.ColumnNameUtils;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
|
|
@ -34,8 +35,6 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.apache.skywalking.apm.collector.core.util.ColumnNameUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -59,7 +58,6 @@ public class ServiceReferenceEsUIDAO extends EsDAO implements IServiceReferenceU
|
|||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
boolQuery.must().add(QueryBuilders.rangeQuery(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime));
|
||||
boolQuery.must().add(QueryBuilders.rangeQuery(ServiceReferenceMetricTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime));
|
||||
boolQuery.must().add(QueryBuilders.matchQuery(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, entryServiceId));
|
||||
|
||||
searchRequestBuilder.setQuery(boolQuery);
|
||||
searchRequestBuilder.setSize(0);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ public class ServiceReferenceMetricEsPersistenceDAO extends EsDAO implements ISe
|
|||
if (getResponse.isExists()) {
|
||||
ServiceReferenceMetric serviceReferenceMetric = new ServiceReferenceMetric(id);
|
||||
Map<String, Object> source = getResponse.getSource();
|
||||
serviceReferenceMetric.setEntryServiceId(((Number)source.get(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID)).intValue());
|
||||
serviceReferenceMetric.setFrontServiceId(((Number)source.get(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID)).intValue());
|
||||
serviceReferenceMetric.setBehindServiceId(((Number)source.get(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID)).intValue());
|
||||
serviceReferenceMetric.setSourceValue(((Number)source.get(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE)).intValue());
|
||||
|
|
@ -79,7 +78,6 @@ public class ServiceReferenceMetricEsPersistenceDAO extends EsDAO implements ISe
|
|||
|
||||
@Override public IndexRequestBuilder prepareBatchInsert(ServiceReferenceMetric data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, data.getEntryServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, data.getFrontServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, data.getBehindServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
|
@ -106,7 +104,6 @@ public class ServiceReferenceMetricEsPersistenceDAO extends EsDAO implements ISe
|
|||
|
||||
@Override public UpdateRequestBuilder prepareBatchUpdate(ServiceReferenceMetric data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, data.getEntryServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, data.getFrontServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, data.getBehindServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
|
|
|||
|
|
@ -1,48 +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.define;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchColumnDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchTableDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.AlertingListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class AlertingListEsTableDefine extends ElasticSearchTableDefine {
|
||||
|
||||
public AlertingListEsTableDefine() {
|
||||
super(AlertingListTable.TABLE);
|
||||
}
|
||||
|
||||
@Override public int refreshInterval() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_LAYER, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_LAYER_ID, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_LAST_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_EXPECTED, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_ACTUAL, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(AlertingListTable.COLUMN_VALID, ElasticSearchColumnDefine.Type.Boolean.name()));
|
||||
}
|
||||
}
|
||||
|
|
@ -16,12 +16,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.define;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchColumnDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchTableDefine;
|
||||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
|
|
@ -37,7 +36,6 @@ public class ServiceReferenceMetricEsTableDefine extends ElasticSearchTableDefin
|
|||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
addColumn(new ElasticSearchColumnDefine(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, ElasticSearchColumnDefine.Type.Integer.name()));
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ 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.IAlertingListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationCacheDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO;
|
||||
|
|
@ -67,7 +66,6 @@ import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceMetricPe
|
|||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
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.AlertingListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationComponentH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2CacheDAO;
|
||||
|
|
@ -140,7 +138,7 @@ public class StorageModuleH2Provider extends ModuleProvider {
|
|||
registerRegisterDAO();
|
||||
registerPersistenceDAO();
|
||||
registerUiDAO();
|
||||
registerAlertingDAO();
|
||||
registerAlarmDAO();
|
||||
}
|
||||
|
||||
@Override public void start(Properties config) throws ServiceNotProvidedException {
|
||||
|
|
@ -215,7 +213,6 @@ public class StorageModuleH2Provider extends ModuleProvider {
|
|||
this.registerServiceImplementation(IServiceReferenceUIDAO.class, new ServiceReferenceH2UIDAO(h2Client));
|
||||
}
|
||||
|
||||
private void registerAlertingDAO() throws ServiceNotProvidedException {
|
||||
this.registerServiceImplementation(IAlertingListPersistenceDAO.class, new AlertingListH2PersistenceDAO(h2Client));
|
||||
private void registerAlarmDAO() throws ServiceNotProvidedException {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,113 +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.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
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.dao.IAlertingListPersistenceDAO;
|
||||
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.alarm.AlertingList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.AlertingListTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class AlertingListH2PersistenceDAO extends H2DAO implements IAlertingListPersistenceDAO<H2SqlEntity, H2SqlEntity, AlertingList> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(AlertingListH2PersistenceDAO.class);
|
||||
|
||||
private static final String GET_SQL = "select * from {0} where {1} = ?";
|
||||
|
||||
public AlertingListH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public AlertingList get(String id) {
|
||||
H2Client client = getClient();
|
||||
String sql = SqlBuilder.buildSql(GET_SQL, AlertingListTable.TABLE, AlertingListTable.COLUMN_ID);
|
||||
Object[] params = new Object[] {id};
|
||||
try (ResultSet rs = client.executeQuery(sql, params)) {
|
||||
if (rs.next()) {
|
||||
AlertingList alertingList = new AlertingList(id);
|
||||
alertingList.setLayer(rs.getInt(AlertingListTable.COLUMN_LAYER));
|
||||
alertingList.setLayerId(rs.getInt(AlertingListTable.COLUMN_LAYER_ID));
|
||||
alertingList.setFirstTimeBucket(rs.getLong(AlertingListTable.COLUMN_FIRST_TIME_BUCKET));
|
||||
alertingList.setLastTimeBucket(rs.getLong(AlertingListTable.COLUMN_LAST_TIME_BUCKET));
|
||||
alertingList.setExpected(rs.getInt(AlertingListTable.COLUMN_EXPECTED));
|
||||
alertingList.setActual(rs.getInt(AlertingListTable.COLUMN_ACTUAL));
|
||||
alertingList.setValid(rs.getBoolean(AlertingListTable.COLUMN_VALID));
|
||||
|
||||
return alertingList;
|
||||
}
|
||||
} catch (SQLException | H2ClientException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public H2SqlEntity prepareBatchInsert(AlertingList data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
H2SqlEntity entity = new H2SqlEntity();
|
||||
source.put(AlertingListTable.COLUMN_LAYER, data.getLayer());
|
||||
source.put(AlertingListTable.COLUMN_LAYER_ID, data.getLayerId());
|
||||
source.put(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, data.getFirstTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_LAST_TIME_BUCKET, data.getLastTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_EXPECTED, data.getExpected());
|
||||
source.put(AlertingListTable.COLUMN_ACTUAL, data.getActual());
|
||||
source.put(AlertingListTable.COLUMN_VALID, data.getValid());
|
||||
|
||||
String sql = SqlBuilder.buildBatchInsertSql(AlertingListTable.TABLE, source.keySet());
|
||||
entity.setSql(sql);
|
||||
entity.setParams(source.values().toArray(new Object[0]));
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override public H2SqlEntity prepareBatchUpdate(AlertingList data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
H2SqlEntity entity = new H2SqlEntity();
|
||||
source.put(AlertingListTable.COLUMN_LAYER, data.getLayer());
|
||||
source.put(AlertingListTable.COLUMN_LAYER_ID, data.getLayerId());
|
||||
source.put(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, data.getFirstTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_LAST_TIME_BUCKET, data.getLastTimeBucket());
|
||||
source.put(AlertingListTable.COLUMN_EXPECTED, data.getExpected());
|
||||
source.put(AlertingListTable.COLUMN_ACTUAL, data.getActual());
|
||||
source.put(AlertingListTable.COLUMN_VALID, data.getValid());
|
||||
String sql = SqlBuilder.buildBatchUpdateSql(AlertingListTable.TABLE, source.keySet(), AlertingListTable.COLUMN_ID);
|
||||
entity.setSql(sql);
|
||||
List<Object> values = new ArrayList<>(source.values());
|
||||
values.add(data.getId());
|
||||
entity.setParams(values.toArray(new Object[0]));
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override public void deleteHistory(Long startTimestamp, Long endTimestamp) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
|
@ -24,11 +23,11 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
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.util.ColumnNameUtils;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable;
|
||||
|
|
@ -53,7 +52,7 @@ public class ServiceReferenceH2UIDAO extends H2DAO implements IServiceReferenceU
|
|||
public Map<String, JsonObject> load(int entryServiceId, long startTime, long endTime) {
|
||||
H2Client client = getClient();
|
||||
String sql = SqlBuilder.buildSql(GET_SRV_REF_LOAD1, ServiceReferenceMetricTable.TABLE,
|
||||
ServiceReferenceMetricTable.COLUMN_TIME_BUCKET, ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID,
|
||||
ServiceReferenceMetricTable.COLUMN_TIME_BUCKET,
|
||||
ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID,
|
||||
ServiceReferenceMetricTable.COLUMN_TRANSACTION_CALLS, ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, ServiceReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM,
|
||||
ServiceReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.h2.dao;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
|
|
@ -26,13 +25,13 @@ import java.util.HashMap;
|
|||
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.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceMetricPersistenceDAO;
|
||||
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.service.ServiceReferenceMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetricTable;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2ClientException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -56,7 +55,6 @@ public class ServiceReferenceMetricH2PersistenceDAO extends H2DAO implements ISe
|
|||
try (ResultSet rs = client.executeQuery(sql, params)) {
|
||||
if (rs.next()) {
|
||||
ServiceReferenceMetric serviceReferenceMetric = new ServiceReferenceMetric(id);
|
||||
serviceReferenceMetric.setEntryServiceId(rs.getInt(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID));
|
||||
serviceReferenceMetric.setFrontServiceId(rs.getInt(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID));
|
||||
serviceReferenceMetric.setBehindServiceId(rs.getInt(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID));
|
||||
serviceReferenceMetric.setSourceValue(rs.getInt(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE));
|
||||
|
|
@ -90,7 +88,6 @@ public class ServiceReferenceMetricH2PersistenceDAO extends H2DAO implements ISe
|
|||
H2SqlEntity entity = new H2SqlEntity();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_ID, data.getId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, data.getEntryServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, data.getFrontServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, data.getBehindServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
|
@ -122,7 +119,6 @@ public class ServiceReferenceMetricH2PersistenceDAO extends H2DAO implements ISe
|
|||
public H2SqlEntity prepareBatchUpdate(ServiceReferenceMetric data) {
|
||||
H2SqlEntity entity = new H2SqlEntity();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, data.getEntryServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, data.getFrontServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, data.getBehindServiceId());
|
||||
source.put(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
|
|
|||
|
|
@ -1,47 +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.alarm.AlertingListTable;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponentTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class AlertingListH2TableDefine extends H2TableDefine {
|
||||
|
||||
public AlertingListH2TableDefine() {
|
||||
super(AlertingListTable.TABLE);
|
||||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
addColumn(new H2ColumnDefine(ApplicationComponentTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name()));
|
||||
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_LAYER, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_LAYER_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name()));
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_LAST_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name()));
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_EXPECTED, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_ACTUAL, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(AlertingListTable.COLUMN_VALID, H2ColumnDefine.Type.Boolean.name()));
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,6 @@ public class ServiceReferenceMetricH2TableDefine extends H2TableDefine {
|
|||
|
||||
@Override public void initialize() {
|
||||
addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name()));
|
||||
addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, H2ColumnDefine.Type.Int.name()));
|
||||
addColumn(new H2ColumnDefine(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, H2ColumnDefine.Type.Int.name()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue