Split application alarm list entity to minute, hour, day, month.
This commit is contained in:
parent
778731f17a
commit
7ab59cb252
|
|
@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
|
|||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +46,7 @@ public class ApplicationMetricAlarmListPersistenceWorker extends PersistenceWork
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override protected IPersistenceDAO<?, ?, ApplicationAlarmList> persistenceDAO() {
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationAlarmListPersistenceDAO.class);
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationAlarmListMinutePersistenceDAO.class);
|
||||
}
|
||||
|
||||
public static class Factory extends PersistenceWorkerProvider<ApplicationAlarmList, ApplicationMetricAlarmListPersistenceWorker> {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent
|
|||
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.IApplicationAlarmListDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMonthPersistenceDAO;
|
||||
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;
|
||||
|
|
@ -269,6 +272,10 @@ public class StorageModule extends Module {
|
|||
classes.add(IInstanceAlarmPersistenceDAO.class);
|
||||
classes.add(IInstanceAlarmListPersistenceDAO.class);
|
||||
classes.add(IApplicationAlarmPersistenceDAO.class);
|
||||
classes.add(IApplicationAlarmListPersistenceDAO.class);
|
||||
|
||||
classes.add(IApplicationAlarmListMinutePersistenceDAO.class);
|
||||
classes.add(IApplicationAlarmListHourPersistenceDAO.class);
|
||||
classes.add(IApplicationAlarmListDayPersistenceDAO.class);
|
||||
classes.add(IApplicationAlarmListMonthPersistenceDAO.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmL
|
|||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationAlarmListPersistenceDAO<Insert, Update, DataImpl extends ApplicationAlarmList> extends IPersistenceDAO<Insert, Update, DataImpl> {
|
||||
public interface IApplicationAlarmListDayPersistenceDAO<Insert, Update, DataImpl extends ApplicationAlarmList> extends IPersistenceDAO<Insert, Update, DataImpl> {
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationAlarmListHourPersistenceDAO<Insert, Update, DataImpl extends ApplicationAlarmList> extends IPersistenceDAO<Insert, Update, DataImpl> {
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationAlarmListMinutePersistenceDAO<Insert, Update, DataImpl extends ApplicationAlarmList> extends IPersistenceDAO<Insert, Update, DataImpl> {
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationAlarmListMonthPersistenceDAO<Insert, Update, DataImpl extends ApplicationAlarmList> extends IPersistenceDAO<Insert, Update, DataImpl> {
|
||||
}
|
||||
|
|
@ -39,7 +39,10 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent
|
|||
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.IApplicationAlarmListDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMonthPersistenceDAO;
|
||||
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;
|
||||
|
|
@ -139,7 +142,10 @@ import org.apache.skywalking.apm.collector.storage.es.dao.acp.ApplicationCompone
|
|||
import org.apache.skywalking.apm.collector.storage.es.dao.acp.ApplicationComponentMinuteEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.acp.ApplicationComponentMonthEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationAlarmEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationAlarmListEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationAlarmListEsDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationAlarmListEsHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationAlarmListEsMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationAlarmListEsMonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationReferenceAlarmEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.ApplicationReferenceAlarmListEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.alarm.InstanceAlarmEsPersistenceDAO;
|
||||
|
|
@ -429,6 +435,10 @@ public class StorageModuleEsProvider extends ModuleProvider {
|
|||
this.registerServiceImplementation(IInstanceAlarmPersistenceDAO.class, new InstanceAlarmEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IInstanceAlarmListPersistenceDAO.class, new InstanceAlarmListEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationAlarmPersistenceDAO.class, new ApplicationAlarmEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationAlarmListPersistenceDAO.class, new ApplicationAlarmListEsPersistenceDAO(elasticSearchClient));
|
||||
|
||||
this.registerServiceImplementation(IApplicationAlarmListMinutePersistenceDAO.class, new ApplicationAlarmListEsMinutePersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationAlarmListHourPersistenceDAO.class, new ApplicationAlarmListEsHourPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationAlarmListDayPersistenceDAO.class, new ApplicationAlarmListEsDayPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationAlarmListMonthPersistenceDAO.class, new ApplicationAlarmListEsMonthPersistenceDAO(elasticSearchClient));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.alarm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.AbstractPersistenceEsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public abstract class AbstractApplicationAlarmListEsPersistenceDAO extends AbstractPersistenceEsDAO<ApplicationAlarmList> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(AbstractApplicationAlarmListEsPersistenceDAO.class);
|
||||
|
||||
public AbstractApplicationAlarmListEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected final String timeBucketColumnNameForDelete() {
|
||||
return ApplicationAlarmListTable.COLUMN_TIME_BUCKET;
|
||||
}
|
||||
|
||||
@Override protected final ApplicationAlarmList esDataToStreamData(Map<String, Object> source) {
|
||||
ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList();
|
||||
applicationAlarmList.setId((String)source.get(ApplicationAlarmListTable.COLUMN_ID));
|
||||
applicationAlarmList.setApplicationId(((Number)source.get(ApplicationAlarmListTable.COLUMN_APPLICATION_ID)).intValue());
|
||||
applicationAlarmList.setSourceValue(((Number)source.get(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE)).intValue());
|
||||
|
||||
applicationAlarmList.setAlarmType(((Number)source.get(ApplicationAlarmListTable.COLUMN_ALARM_TYPE)).intValue());
|
||||
applicationAlarmList.setAlarmContent((String)source.get(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT));
|
||||
|
||||
applicationAlarmList.setTimeBucket(((Number)source.get(ApplicationAlarmListTable.COLUMN_TIME_BUCKET)).longValue());
|
||||
return applicationAlarmList;
|
||||
}
|
||||
|
||||
@Override protected final Map<String, Object> esStreamDataToEsData(ApplicationAlarmList streamData) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ID, streamData.getId());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_APPLICATION_ID, streamData.getApplicationId());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue());
|
||||
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ALARM_TYPE, streamData.getAlarmType());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT, streamData.getAlarmContent());
|
||||
|
||||
source.put(ApplicationAlarmListTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket());
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListEsDayPersistenceDAO extends AbstractApplicationAlarmListEsPersistenceDAO implements IApplicationAlarmListDayPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListEsDayPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListEsHourPersistenceDAO extends AbstractApplicationAlarmListEsPersistenceDAO implements IApplicationAlarmListHourPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListEsHourPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListEsMinutePersistenceDAO extends AbstractApplicationAlarmListEsPersistenceDAO implements IApplicationAlarmListMinutePersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListEsMinutePersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.alarm;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListEsMonthPersistenceDAO extends AbstractApplicationAlarmListEsPersistenceDAO implements IApplicationAlarmListMonthPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListEsMonthPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -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.alarm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.reindex.BulkByScrollResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListEsPersistenceDAO extends EsDAO implements IApplicationAlarmListPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationAlarmList> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApplicationAlarmListEsPersistenceDAO.class);
|
||||
|
||||
public ApplicationAlarmListEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public ApplicationAlarmList get(String id) {
|
||||
GetResponse getResponse = getClient().prepareGet(ApplicationAlarmListTable.TABLE, id).get();
|
||||
if (getResponse.isExists()) {
|
||||
ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList();
|
||||
applicationAlarmList.setId(id);
|
||||
Map<String, Object> source = getResponse.getSource();
|
||||
applicationAlarmList.setApplicationId(((Number)source.get(ApplicationAlarmListTable.COLUMN_APPLICATION_ID)).intValue());
|
||||
applicationAlarmList.setSourceValue(((Number)source.get(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE)).intValue());
|
||||
|
||||
applicationAlarmList.setAlarmType(((Number)source.get(ApplicationAlarmListTable.COLUMN_ALARM_TYPE)).intValue());
|
||||
applicationAlarmList.setAlarmContent((String)source.get(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT));
|
||||
|
||||
applicationAlarmList.setTimeBucket(((Number)source.get(ApplicationAlarmListTable.COLUMN_TIME_BUCKET)).longValue());
|
||||
return applicationAlarmList;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public IndexRequestBuilder prepareBatchInsert(ApplicationAlarmList data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationAlarmListTable.COLUMN_APPLICATION_ID, data.getApplicationId());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ALARM_TYPE, data.getAlarmType());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT, data.getAlarmContent());
|
||||
|
||||
source.put(ApplicationAlarmListTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
|
||||
|
||||
return getClient().prepareIndex(ApplicationAlarmListTable.TABLE, data.getId()).setSource(source);
|
||||
}
|
||||
|
||||
@Override public UpdateRequestBuilder prepareBatchUpdate(ApplicationAlarmList data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationAlarmListTable.COLUMN_APPLICATION_ID, data.getApplicationId());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ALARM_TYPE, data.getAlarmType());
|
||||
source.put(ApplicationAlarmListTable.COLUMN_ALARM_CONTENT, data.getAlarmContent());
|
||||
|
||||
source.put(ApplicationAlarmListTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
|
||||
|
||||
return getClient().prepareUpdate(ApplicationAlarmListTable.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(ApplicationAlarmListTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket))
|
||||
.source(ApplicationAlarmListTable.TABLE)
|
||||
.get();
|
||||
|
||||
long deleted = response.getDeleted();
|
||||
logger.info("Delete {} rows history from {} index.", deleted, ApplicationAlarmListTable.TABLE);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,14 +25,10 @@ import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmL
|
|||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListEsTableDefine extends ElasticSearchTableDefine {
|
||||
public abstract class AbstractApplicationAlarmListEsTableDefine extends ElasticSearchTableDefine {
|
||||
|
||||
public ApplicationAlarmListEsTableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE);
|
||||
}
|
||||
|
||||
@Override public int refreshInterval() {
|
||||
return 2;
|
||||
AbstractApplicationAlarmListEsTableDefine(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListDayEsTableDefine extends AbstractApplicationAlarmListEsTableDefine {
|
||||
|
||||
public ApplicationAlarmListDayEsTableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName());
|
||||
}
|
||||
|
||||
@Override public int refreshInterval() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListHourEsTableDefine extends AbstractApplicationAlarmListEsTableDefine {
|
||||
|
||||
public ApplicationAlarmListHourEsTableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName());
|
||||
}
|
||||
|
||||
@Override public int refreshInterval() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListMinuteEsTableDefine extends AbstractApplicationAlarmListEsTableDefine {
|
||||
|
||||
public ApplicationAlarmListMinuteEsTableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName());
|
||||
}
|
||||
|
||||
@Override public int refreshInterval() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListMonthEsTableDefine extends AbstractApplicationAlarmListEsTableDefine {
|
||||
|
||||
public ApplicationAlarmListMonthEsTableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName());
|
||||
}
|
||||
|
||||
@Override public int refreshInterval() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,12 @@ org.apache.skywalking.apm.collector.storage.es.define.SegmentEsTableDefine
|
|||
org.apache.skywalking.apm.collector.storage.es.define.SegmentDurationEsTableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationAlarmEsTableDefine
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationAlarmListEsTableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationAlarmListMinuteEsTableDefine
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationAlarmListHourEsTableDefine
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationAlarmListDayEsTableDefine
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationAlarmListMonthEsTableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationReferenceAlarmEsTableDefine
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.ApplicationReferenceAlarmListEsTableDefine
|
||||
org.apache.skywalking.apm.collector.storage.es.define.alarm.InstanceAlarmEsTableDefine
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponent
|
|||
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.IApplicationAlarmListDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListMonthPersistenceDAO;
|
||||
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;
|
||||
|
|
@ -135,7 +138,10 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationCompone
|
|||
import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMinuteH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.acp.ApplicationComponentMonthH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmListH2DayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmListH2HourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmListH2MinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationAlarmListH2MonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationReferenceAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.ApplicationReferenceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.alarm.InstanceAlarmH2PersistenceDAO;
|
||||
|
|
@ -405,6 +411,10 @@ public class StorageModuleH2Provider extends ModuleProvider {
|
|||
this.registerServiceImplementation(IInstanceAlarmPersistenceDAO.class, new InstanceAlarmH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IInstanceAlarmListPersistenceDAO.class, new InstanceAlarmListH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationAlarmPersistenceDAO.class, new ApplicationAlarmH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationAlarmListPersistenceDAO.class, new ApplicationAlarmListH2PersistenceDAO(h2Client));
|
||||
|
||||
this.registerServiceImplementation(IApplicationAlarmListMinutePersistenceDAO.class, new ApplicationAlarmListH2MinutePersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationAlarmListHourPersistenceDAO.class, new ApplicationAlarmListH2HourPersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationAlarmListDayPersistenceDAO.class, new ApplicationAlarmListH2DayPersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationAlarmListMonthPersistenceDAO.class, new ApplicationAlarmListH2MonthPersistenceDAO(h2Client));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,26 +23,20 @@ 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.dao.alarm.IApplicationAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.AbstractPersistenceH2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO<ApplicationAlarmList> implements IApplicationAlarmListPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationAlarmList> {
|
||||
public abstract class AbstractApplicationAlarmListH2PersistenceDAO extends AbstractPersistenceH2DAO<ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListH2PersistenceDAO(H2Client client) {
|
||||
public AbstractApplicationAlarmListH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.TABLE;
|
||||
}
|
||||
|
||||
@Override protected ApplicationAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException {
|
||||
@Override protected final ApplicationAlarmList h2DataToStreamData(ResultSet resultSet) throws SQLException {
|
||||
ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList();
|
||||
applicationAlarmList.setId(resultSet.getString(ApplicationAlarmListTable.COLUMN_ID));
|
||||
applicationAlarmList.setSourceValue(resultSet.getInt(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE));
|
||||
|
|
@ -57,7 +51,7 @@ public class ApplicationAlarmListH2PersistenceDAO extends AbstractPersistenceH2D
|
|||
return applicationAlarmList;
|
||||
}
|
||||
|
||||
@Override protected Map<String, Object> streamDataToH2Data(ApplicationAlarmList streamData) {
|
||||
@Override protected final Map<String, Object> streamDataToH2Data(ApplicationAlarmList streamData) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationAlarmListTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue());
|
||||
|
||||
|
|
@ -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.alarm;
|
||||
|
||||
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.alarm.IApplicationAlarmListDayPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListH2DayPersistenceDAO extends AbstractApplicationAlarmListH2PersistenceDAO implements IApplicationAlarmListDayPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListH2DayPersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.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.alarm;
|
||||
|
||||
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.alarm.IApplicationAlarmListHourPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListH2HourPersistenceDAO extends AbstractApplicationAlarmListH2PersistenceDAO implements IApplicationAlarmListHourPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListH2HourPersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.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.alarm;
|
||||
|
||||
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.alarm.IApplicationAlarmListMinutePersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListH2MinutePersistenceDAO extends AbstractApplicationAlarmListH2PersistenceDAO implements IApplicationAlarmListMinutePersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListH2MinutePersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.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.alarm;
|
||||
|
||||
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.alarm.IApplicationAlarmListMonthPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
|
||||
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListH2MonthPersistenceDAO extends AbstractApplicationAlarmListH2PersistenceDAO implements IApplicationAlarmListMonthPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationAlarmList> {
|
||||
|
||||
public ApplicationAlarmListH2MonthPersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -25,10 +25,10 @@ import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmL
|
|||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListH2TableDefine extends H2TableDefine {
|
||||
public abstract class AbstractApplicationAlarmListH2TableDefine extends H2TableDefine {
|
||||
|
||||
public ApplicationAlarmListH2TableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE);
|
||||
AbstractApplicationAlarmListH2TableDefine(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override public void initialize() {
|
||||
|
|
@ -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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListDayH2TableDefine extends AbstractApplicationAlarmListH2TableDefine {
|
||||
|
||||
public ApplicationAlarmListDayH2TableDefine() {
|
||||
super(ApplicationAlarmListTable.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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListHourH2TableDefine extends AbstractApplicationAlarmListH2TableDefine {
|
||||
|
||||
public ApplicationAlarmListHourH2TableDefine() {
|
||||
super(ApplicationAlarmListTable.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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListMinuteH2TableDefine extends AbstractApplicationAlarmListH2TableDefine {
|
||||
|
||||
public ApplicationAlarmListMinuteH2TableDefine() {
|
||||
super(ApplicationAlarmListTable.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.alarm;
|
||||
|
||||
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.alarm.ApplicationAlarmListTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationAlarmListMonthH2TableDefine extends AbstractApplicationAlarmListH2TableDefine {
|
||||
|
||||
public ApplicationAlarmListMonthH2TableDefine() {
|
||||
super(ApplicationAlarmListTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -77,7 +77,12 @@ org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceDayMe
|
|||
org.apache.skywalking.apm.collector.storage.h2.define.srmp.ServiceReferenceMonthMetricH2TableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmListH2TableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmListMinuteH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmListHourH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmListDayH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationAlarmListMonthH2TableDefine
|
||||
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationReferenceAlarmH2TableDefine
|
||||
org.apache.skywalking.apm.collector.storage.h2.define.alarm.ApplicationReferenceAlarmListH2TableDefine
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue