Application reference metric alarm.

This commit is contained in:
peng-yongsheng 2018-01-01 15:48:41 +08:00
parent a55a5f046e
commit 97abe99bfd
19 changed files with 841 additions and 1 deletions

View File

@ -27,4 +27,5 @@ public class AlarmGraphIdDefine {
public static final int APPLICATION_METRIC_ALARM_GRAPH_ID = 502;
public static final int SERVICE_REFERENCE_METRIC_ALARM_GRAPH_ID = 503;
public static final int INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_ID = 504;
public static final int APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_ID = 505;
}

View File

@ -56,4 +56,11 @@ public class AlarmWorkerIdDefine {
public static final int INSTANCE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 543;
public static final int INSTANCE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 544;
public static final int INSTANCE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 545;
public static final int APPLICATION_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID = 550;
public static final int APPLICATION_REFERENCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 551;
public static final int APPLICATION_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID = 552;
public static final int APPLICATION_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 553;
public static final int APPLICATION_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 554;
public static final int APPLICATION_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 555;
}

View File

@ -21,6 +21,7 @@ package org.apache.skywalking.apm.collector.analysis.alarm.provider;
import java.util.Properties;
import org.apache.skywalking.apm.collector.analysis.alarm.define.AnalysisAlarmModule;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application.ApplicationMetricAlarmGraph;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application.ApplicationReferenceMetricAlarmGraph;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.instance.InstanceMetricAlarmGraph;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.instance.InstanceReferenceMetricAlarmGraph;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service.ServiceMetricAlarmGraph;
@ -68,6 +69,9 @@ public class AnalysisAlarmModuleProvider extends ModuleProvider {
InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener);
instanceReferenceMetricAlarmGraph.create();
ApplicationReferenceMetricAlarmGraph applicationReferenceMetricAlarmGraph = new ApplicationReferenceMetricAlarmGraph(getManager(), workerCreateListener);
applicationReferenceMetricAlarmGraph.create();
}
@Override public void notifyAfterCompleted() throws ServiceNotProvidedException {

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
import org.apache.skywalking.apm.collector.configuration.service.IApplicationReferenceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricAlarmAssertWorker extends AlarmAssertWorker<ApplicationReferenceMetric, ApplicationReferenceAlarm> {
private final IApplicationReferenceAlarmRuleConfig applicationReferenceAlarmRuleConfig;
public ApplicationReferenceMetricAlarmAssertWorker(ModuleManager moduleManager) {
super(moduleManager);
this.applicationReferenceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IApplicationReferenceAlarmRuleConfig.class);
}
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID;
}
@Override protected ApplicationReferenceAlarm newAlarmObject(String id, ApplicationReferenceMetric inputMetric) {
ApplicationReferenceAlarm applicationReferenceAlarm = new ApplicationReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontApplicationId() + Const.ID_SPLIT + inputMetric.getBehindApplicationId());
applicationReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId());
applicationReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId());
return applicationReferenceAlarm;
}
@Override protected Double calleeErrorRateThreshold() {
return applicationReferenceAlarmRuleConfig.calleeErrorRateThreshold();
}
@Override protected Double callerErrorRateThreshold() {
return applicationReferenceAlarmRuleConfig.callerErrorRateThreshold();
}
@Override protected Double calleeAverageResponseTimeThreshold() {
return applicationReferenceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
}
@Override protected Double callerAverageResponseTimeThreshold() {
return applicationReferenceAlarmRuleConfig.callerAverageResponseTimeThreshold();
}
public static class Factory extends AlarmAssertWorkerProvider<ApplicationReferenceMetric, ApplicationReferenceAlarm, ApplicationReferenceMetricAlarmAssertWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationReferenceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationReferenceMetricAlarmAssertWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.graph.Next;
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricAlarmGraph {
private final ModuleManager moduleManager;
private final WorkerCreateListener workerCreateListener;
public ApplicationReferenceMetricAlarmGraph(ModuleManager moduleManager,
WorkerCreateListener workerCreateListener) {
this.moduleManager = moduleManager;
this.workerCreateListener = workerCreateListener;
}
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
Graph<ApplicationReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_ID, ApplicationReferenceMetric.class);
graph.addNode(new ApplicationReferenceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationReferenceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationReferenceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
graph.toFinder().findNode(AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_REMOTE_WORKER_ID, ApplicationReferenceAlarm.class)
.addNext(new ApplicationReferenceMetricAlarmToListNodeProcessor())
.addNext(new ApplicationReferenceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<ApplicationReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, ApplicationReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, ApplicationReferenceMetric.class)
.addNext(new NodeProcessor<ApplicationReferenceMetric, ApplicationReferenceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID;
}
@Override public void process(ApplicationReferenceMetric applicationReferenceMetric,
Next<ApplicationReferenceMetric> next) {
graph.start(applicationReferenceMetric);
}
});
}
}

View File

@ -0,0 +1,67 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricAlarmListPersistenceWorker extends PersistenceWorker<ApplicationReferenceAlarmList> {
public ApplicationReferenceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationReferenceAlarmList> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceAlarmListPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationReferenceAlarmList, ApplicationReferenceMetricAlarmListPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override
public ApplicationReferenceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationReferenceMetricAlarmListPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricAlarmPersistenceWorker extends PersistenceWorker<ApplicationReferenceAlarm> {
public ApplicationReferenceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationReferenceAlarm> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceAlarmPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<ApplicationReferenceAlarm, ApplicationReferenceMetricAlarmPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationReferenceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationReferenceMetricAlarmPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
import org.apache.skywalking.apm.collector.remote.service.Selector;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricAlarmRemoteWorker extends AbstractRemoteWorker<ApplicationReferenceAlarm, ApplicationReferenceAlarm> {
public ApplicationReferenceMetricAlarmRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID;
}
@Override public Selector selector() {
return Selector.HashCode;
}
@Override protected void onWork(ApplicationReferenceAlarm message) throws WorkerException {
onNext(message);
}
public static class Factory extends AbstractRemoteWorkerProvider<ApplicationReferenceAlarm, ApplicationReferenceAlarm, ApplicationReferenceMetricAlarmRemoteWorker> {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
@Override public ApplicationReferenceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationReferenceMetricAlarmRemoteWorker(moduleManager);
}
}
}

View File

@ -0,0 +1,53 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.core.graph.Next;
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricAlarmToListNodeProcessor implements NodeProcessor<ApplicationReferenceAlarm, ApplicationReferenceAlarmList> {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
}
@Override
public void process(ApplicationReferenceAlarm applicationReferenceAlarm, Next<ApplicationReferenceAlarmList> next) {
String id = applicationReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + applicationReferenceAlarm.getSourceValue()
+ Const.ID_SPLIT + applicationReferenceAlarm.getAlarmType()
+ Const.ID_SPLIT + applicationReferenceAlarm.getFrontApplicationId()
+ Const.ID_SPLIT + applicationReferenceAlarm.getBehindApplicationId();
ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList(id);
applicationReferenceAlarmList.setFrontApplicationId(applicationReferenceAlarm.getFrontApplicationId());
applicationReferenceAlarmList.setBehindApplicationId(applicationReferenceAlarm.getBehindApplicationId());
applicationReferenceAlarmList.setSourceValue(applicationReferenceAlarm.getSourceValue());
applicationReferenceAlarmList.setAlarmType(applicationReferenceAlarm.getAlarmType());
applicationReferenceAlarmList.setTimeBucket(applicationReferenceAlarm.getLastTimeBucket());
applicationReferenceAlarmList.setAlarmContent(applicationReferenceAlarm.getAlarmContent());
next.execute(applicationReferenceAlarmList);
}
}

View File

@ -20,6 +20,7 @@ package org.apache.skywalking.apm.collector.configuration;
import org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService;
import org.apache.skywalking.apm.collector.configuration.service.IApplicationAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IApplicationReferenceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IInstanceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig;
@ -41,6 +42,6 @@ public class ConfigurationModule extends Module {
return new Class[] {
IApdexThresholdService.class,
IServiceAlarmRuleConfig.class, IInstanceAlarmRuleConfig.class, IApplicationAlarmRuleConfig.class,
IServiceReferenceAlarmRuleConfig.class, IInstanceReferenceAlarmRuleConfig.class};
IServiceReferenceAlarmRuleConfig.class, IInstanceReferenceAlarmRuleConfig.class, IApplicationReferenceAlarmRuleConfig.class};
}
}

View File

@ -0,0 +1,34 @@
/*
* 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.configuration.service;
import org.apache.skywalking.apm.collector.core.module.Service;
/**
* @author peng-yongsheng
*/
public interface IApplicationReferenceAlarmRuleConfig extends Service {
double calleeErrorRateThreshold();
double calleeAverageResponseTimeThreshold();
double callerErrorRateThreshold();
double callerAverageResponseTimeThreshold();
}

View File

@ -21,8 +21,10 @@ package org.apache.skywalking.apm.collector.configuration;
import java.util.Properties;
import org.apache.skywalking.apm.collector.configuration.service.ApdexThresholdService;
import org.apache.skywalking.apm.collector.configuration.service.ApplicationAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.ApplicationReferenceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService;
import org.apache.skywalking.apm.collector.configuration.service.IApplicationAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IApplicationReferenceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IInstanceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig;
@ -55,6 +57,7 @@ public class ConfigurationModuleProvider extends ModuleProvider {
this.registerServiceImplementation(IApplicationAlarmRuleConfig.class, new ApplicationAlarmRuleConfig());
this.registerServiceImplementation(IServiceReferenceAlarmRuleConfig.class, new ServiceReferenceAlarmRuleConfig());
this.registerServiceImplementation(IInstanceReferenceAlarmRuleConfig.class, new InstanceReferenceAlarmRuleConfig());
this.registerServiceImplementation(IApplicationReferenceAlarmRuleConfig.class, new ApplicationReferenceAlarmRuleConfig());
}
@Override public void start(Properties config) throws ServiceNotProvidedException {

View File

@ -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.configuration.service;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceAlarmRuleConfig implements IApplicationReferenceAlarmRuleConfig {
@Override public double calleeErrorRateThreshold() {
return 10.00;
}
@Override public double calleeAverageResponseTimeThreshold() {
return 2000;
}
@Override public double callerErrorRateThreshold() {
return 10.00;
}
@Override public double callerAverageResponseTimeThreshold() {
return 3000;
}
}

View File

@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.storage.dao;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
/**
* @author peng-yongsheng
*/
public interface IApplicationReferenceAlarmListPersistenceDAO<Insert, Update, DataImpl extends ApplicationReferenceAlarmList> extends IPersistenceDAO<Insert, Update, DataImpl> {
}

View File

@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.storage.dao;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
/**
* @author peng-yongsheng
*/
public interface IApplicationReferenceAlarmPersistenceDAO<Insert, Update, DataImpl extends ApplicationReferenceAlarm> extends IPersistenceDAO<Insert, Update, DataImpl> {
}

View File

@ -0,0 +1,112 @@
/*
* 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.table.alarm;
import org.apache.skywalking.apm.collector.core.data.Column;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.data.operator.CoverOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceAlarm extends Data implements Alarm {
private static final Column[] STRING_COLUMNS = {
new Column(ApplicationReferenceAlarmTable.COLUMN_ID, new NonOperation()),
new Column(ApplicationReferenceAlarmTable.COLUMN_ALARM_CONTENT, new CoverOperation()),
};
private static final Column[] LONG_COLUMNS = {
new Column(ApplicationReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, new CoverOperation()),
};
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ApplicationReferenceAlarmTable.COLUMN_ALARM_TYPE, new NonOperation()),
new Column(ApplicationReferenceAlarmTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ApplicationReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()),
new Column(ApplicationReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
private static final Column[] BYTE_COLUMNS = {};
public ApplicationReferenceAlarm(String id) {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
@Override
public Integer getAlarmType() {
return getDataInteger(0);
}
@Override
public void setAlarmType(Integer alarmType) {
setDataInteger(0, alarmType);
}
@Override
public Integer getSourceValue() {
return getDataInteger(1);
}
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(1, sourceValue);
}
public Integer getFrontApplicationId() {
return getDataInteger(2);
}
public void setFrontApplicationId(Integer frontApplicationId) {
setDataInteger(2, frontApplicationId);
}
public Integer getBehindApplicationId() {
return getDataInteger(3);
}
public void setBehindApplicationId(Integer behindApplicationId) {
setDataInteger(3, behindApplicationId);
}
@Override
public Long getLastTimeBucket() {
return getDataLong(0);
}
@Override
public void setLastTimeBucket(Long lastTimeBucket) {
setDataLong(0, lastTimeBucket);
}
@Override
public String getAlarmContent() {
return getDataString(1);
}
@Override
public void setAlarmContent(String alarmContent) {
setDataString(1, alarmContent);
}
}

View File

@ -0,0 +1,104 @@
/*
* 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.table.alarm;
import org.apache.skywalking.apm.collector.core.data.Column;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.data.operator.CoverOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceAlarmList extends Data {
private static final Column[] STRING_COLUMNS = {
new Column(ApplicationReferenceAlarmListTable.COLUMN_ID, new NonOperation()),
new Column(ApplicationReferenceAlarmListTable.COLUMN_ALARM_CONTENT, new CoverOperation()),
};
private static final Column[] LONG_COLUMNS = {
new Column(ApplicationReferenceAlarmListTable.COLUMN_TIME_BUCKET, new NonOperation()),
};
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ApplicationReferenceAlarmListTable.COLUMN_ALARM_TYPE, new NonOperation()),
new Column(ApplicationReferenceAlarmListTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ApplicationReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()),
new Column(ApplicationReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
private static final Column[] BYTE_COLUMNS = {};
public ApplicationReferenceAlarmList(String id) {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getAlarmType() {
return getDataInteger(0);
}
public void setAlarmType(Integer alarmType) {
setDataInteger(0, alarmType);
}
public Integer getSourceValue() {
return getDataInteger(1);
}
public void setSourceValue(Integer sourceValue) {
setDataInteger(1, sourceValue);
}
public Integer getFrontApplicationId() {
return getDataInteger(2);
}
public void setFrontApplicationId(Integer frontApplicationId) {
setDataInteger(2, frontApplicationId);
}
public Integer getBehindApplicationId() {
return getDataInteger(3);
}
public void setBehindApplicationId(Integer behindApplicationId) {
setDataInteger(3, behindApplicationId);
}
public Long getTimeBucket() {
return getDataLong(0);
}
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
public String getAlarmContent() {
return getDataString(1);
}
public void setAlarmContent(String alarmContent) {
setDataString(1, alarmContent);
}
}

View File

@ -0,0 +1,32 @@
/*
* 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.table.alarm;
import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceAlarmListTable extends CommonMetricTable {
public static final String TABLE = "application_reference_alarm_list";
public static final String COLUMN_FRONT_APPLICATION_ID = "front_application_id";
public static final String COLUMN_BEHIND_APPLICATION_ID = "behind_application_id";
public static final String COLUMN_ALARM_TYPE = "alarm_type";
public static final String COLUMN_ALARM_CONTENT = "alarm_content";
}

View File

@ -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.table.alarm;
import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceAlarmTable extends CommonMetricTable {
public static final String TABLE = "application_reference_alarm";
public static final String COLUMN_FRONT_APPLICATION_ID = "front_application_id";
public static final String COLUMN_BEHIND_APPLICATION_ID = "behind_application_id";
public static final String COLUMN_ALARM_TYPE = "alarm_type";
public static final String COLUMN_LAST_TIME_BUCKET = "last_time_bucket";
public static final String COLUMN_ALARM_CONTENT = "alarm_content";
}