diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java index 968ede38a..9fd66e30c 100644 --- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java @@ -26,5 +26,5 @@ public class AlarmGraphIdDefine { public static final int INSTANCE_METRIC_ALARM_GRAPH_ID = 501; 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; } diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java index eba11d572..ae65c0a10 100644 --- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java @@ -49,4 +49,11 @@ public class AlarmWorkerIdDefine { public static final int SERVICE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 533; public static final int SERVICE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 534; public static final int SERVICE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 535; + + public static final int INSTANCE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID = 540; + public static final int INSTANCE_REFERENCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 541; + public static final int INSTANCE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID = 542; + 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; } diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java index 22e3f0688..edc2e159a 100644 --- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java @@ -22,6 +22,7 @@ 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.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; import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service.ServiceReferenceMetricAlarmGraph; import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule; @@ -64,6 +65,9 @@ public class AnalysisAlarmModuleProvider extends ModuleProvider { ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener); serviceReferenceMetricAlarmGraph.create(); + + InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener); + instanceReferenceMetricAlarmGraph.create(); } @Override public void notifyAfterCompleted() throws ServiceNotProvidedException { diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmAssertWorker.java new file mode 100644 index 000000000..7cfc99000 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmAssertWorker.java @@ -0,0 +1,87 @@ +/* + * 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.instance; + +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.IInstanceReferenceAlarmRuleConfig; +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.InstanceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker { + + private final IInstanceReferenceAlarmRuleConfig instanceReferenceAlarmRuleConfig; + + public InstanceReferenceMetricAlarmAssertWorker(ModuleManager moduleManager) { + super(moduleManager); + this.instanceReferenceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IInstanceReferenceAlarmRuleConfig.class); + } + + @Override public int id() { + return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID; + } + + @Override protected InstanceReferenceAlarm newAlarmObject(String id, InstanceReferenceMetric inputMetric) { + InstanceReferenceAlarm instanceReferenceAlarm = new InstanceReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontInstanceId() + Const.ID_SPLIT + inputMetric.getBehindInstanceId()); + instanceReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId()); + instanceReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId()); + instanceReferenceAlarm.setFrontInstanceId(inputMetric.getFrontInstanceId()); + instanceReferenceAlarm.setBehindInstanceId(inputMetric.getBehindInstanceId()); + return instanceReferenceAlarm; + } + + @Override protected Double calleeErrorRateThreshold() { + return instanceReferenceAlarmRuleConfig.calleeErrorRateThreshold(); + } + + @Override protected Double callerErrorRateThreshold() { + return instanceReferenceAlarmRuleConfig.callerErrorRateThreshold(); + } + + @Override protected Double calleeAverageResponseTimeThreshold() { + return instanceReferenceAlarmRuleConfig.calleeAverageResponseTimeThreshold(); + } + + @Override protected Double callerAverageResponseTimeThreshold() { + return instanceReferenceAlarmRuleConfig.callerAverageResponseTimeThreshold(); + } + + public static class Factory extends AlarmAssertWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public InstanceReferenceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) { + return new InstanceReferenceMetricAlarmAssertWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmGraph.java new file mode 100644 index 000000000..24cc3b368 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmGraph.java @@ -0,0 +1,79 @@ +/* + * 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.instance; + +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.InstanceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMetricAlarmGraph { + + private final ModuleManager moduleManager; + private final WorkerCreateListener workerCreateListener; + + public InstanceReferenceMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) { + this.moduleManager = moduleManager; + this.workerCreateListener = workerCreateListener; + } + + public void create() { + RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class); + + Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_ID, InstanceReferenceMetric.class); + + graph.addNode(new InstanceReferenceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener)) + .addNext(new InstanceReferenceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener)) + .addNext(new InstanceReferenceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + graph.toFinder().findNode(AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_REMOTE_WORKER_ID, InstanceReferenceAlarm.class) + .addNext(new InstanceReferenceMetricAlarmToListNodeProcessor()) + .addNext(new InstanceReferenceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + link(graph); + } + + private void link(Graph graph) { + GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class) + .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, InstanceReferenceMetric.class) + .addNext(new NodeProcessor() { + @Override public int id() { + return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID; + } + + @Override public void process(InstanceReferenceMetric instanceReferenceMetric, + Next next) { + graph.start(instanceReferenceMetric); + } + }); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java new file mode 100644 index 000000000..36dfcb030 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java @@ -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.instance; + +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.IInstanceReferenceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMetricAlarmListPersistenceWorker extends PersistenceWorker { + + public InstanceReferenceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IInstanceReferenceAlarmListPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public InstanceReferenceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new InstanceReferenceMetricAlarmListPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java new file mode 100644 index 000000000..b069cddb5 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java @@ -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.instance; + +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.IInstanceReferenceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMetricAlarmPersistenceWorker extends PersistenceWorker { + + public InstanceReferenceMetricAlarmPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IInstanceReferenceAlarmPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public InstanceReferenceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new InstanceReferenceMetricAlarmPersistenceWorker(moduleManager); + } + + @Override + public int queueSize() { + return 1024; + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmRemoteWorker.java new file mode 100644 index 000000000..24840ec79 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmRemoteWorker.java @@ -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.instance; + +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.InstanceReferenceAlarm; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMetricAlarmRemoteWorker extends AbstractRemoteWorker { + + public InstanceReferenceMetricAlarmRemoteWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID; + } + + @Override public Selector selector() { + return Selector.HashCode; + } + + @Override protected void onWork(InstanceReferenceAlarm message) throws WorkerException { + onNext(message); + } + + public static class Factory extends AbstractRemoteWorkerProvider { + + public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) { + super(moduleManager, remoteSenderService, graphId); + } + + @Override public InstanceReferenceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) { + return new InstanceReferenceMetricAlarmRemoteWorker(moduleManager); + } + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java new file mode 100644 index 000000000..7ef729fab --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java @@ -0,0 +1,55 @@ +/* + * 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.instance; + +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.InstanceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceMetricAlarmToListNodeProcessor implements NodeProcessor { + + @Override public int id() { + return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID; + } + + @Override + public void process(InstanceReferenceAlarm instanceReferenceAlarm, Next next) { + String id = instanceReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + instanceReferenceAlarm.getSourceValue() + + Const.ID_SPLIT + instanceReferenceAlarm.getAlarmType() + + Const.ID_SPLIT + instanceReferenceAlarm.getFrontInstanceId() + + Const.ID_SPLIT + instanceReferenceAlarm.getBehindInstanceId(); + + InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList(id); + instanceReferenceAlarmList.setFrontApplicationId(instanceReferenceAlarm.getFrontApplicationId()); + instanceReferenceAlarmList.setBehindApplicationId(instanceReferenceAlarm.getBehindApplicationId()); + instanceReferenceAlarmList.setFrontInstanceId(instanceReferenceAlarm.getFrontInstanceId()); + instanceReferenceAlarmList.setBehindInstanceId(instanceReferenceAlarm.getBehindInstanceId()); + instanceReferenceAlarmList.setSourceValue(instanceReferenceAlarm.getSourceValue()); + instanceReferenceAlarmList.setAlarmType(instanceReferenceAlarm.getAlarmType()); + instanceReferenceAlarmList.setTimeBucket(instanceReferenceAlarm.getLastTimeBucket()); + instanceReferenceAlarmList.setAlarmContent(instanceReferenceAlarm.getAlarmContent()); + next.execute(instanceReferenceAlarmList); + } +} diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmGraph.java index d4010fb75..4fb7ba01b 100644 --- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmGraph.java +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmGraph.java @@ -67,7 +67,7 @@ public class ServiceReferenceMetricAlarmGraph { .toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, ServiceReferenceMetric.class) .addNext(new NodeProcessor() { @Override public int id() { - return AlarmWorkerIdDefine.SERVICE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID; + return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID; } @Override public void process(ServiceReferenceMetric serviceReferenceMetric, diff --git a/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModule.java b/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModule.java index dcd74f50d..3a9f12ade 100644 --- a/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModule.java +++ b/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModule.java @@ -21,6 +21,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.IInstanceAlarmRuleConfig; +import org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.IServiceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.core.module.Module; @@ -40,6 +41,6 @@ public class ConfigurationModule extends Module { return new Class[] { IApdexThresholdService.class, IServiceAlarmRuleConfig.class, IInstanceAlarmRuleConfig.class, IApplicationAlarmRuleConfig.class, - IServiceReferenceAlarmRuleConfig.class}; + IServiceReferenceAlarmRuleConfig.class, IInstanceReferenceAlarmRuleConfig.class}; } } diff --git a/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/IInstanceReferenceAlarmRuleConfig.java b/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/IInstanceReferenceAlarmRuleConfig.java new file mode 100644 index 000000000..e59c7aed8 --- /dev/null +++ b/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/IInstanceReferenceAlarmRuleConfig.java @@ -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 IInstanceReferenceAlarmRuleConfig extends Service { + double calleeErrorRateThreshold(); + + double calleeAverageResponseTimeThreshold(); + + double callerErrorRateThreshold(); + + double callerAverageResponseTimeThreshold(); +} diff --git a/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModuleProvider.java b/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModuleProvider.java index 465f92a76..22227b606 100644 --- a/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModuleProvider.java +++ b/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModuleProvider.java @@ -24,9 +24,11 @@ import org.apache.skywalking.apm.collector.configuration.service.ApplicationAlar 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.IInstanceAlarmRuleConfig; +import org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.IServiceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.InstanceAlarmRuleConfig; +import org.apache.skywalking.apm.collector.configuration.service.InstanceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.ServiceAlarmRuleConfig; import org.apache.skywalking.apm.collector.configuration.service.ServiceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.core.module.Module; @@ -52,6 +54,7 @@ public class ConfigurationModuleProvider extends ModuleProvider { this.registerServiceImplementation(IInstanceAlarmRuleConfig.class, new InstanceAlarmRuleConfig()); this.registerServiceImplementation(IApplicationAlarmRuleConfig.class, new ApplicationAlarmRuleConfig()); this.registerServiceImplementation(IServiceReferenceAlarmRuleConfig.class, new ServiceReferenceAlarmRuleConfig()); + this.registerServiceImplementation(IInstanceReferenceAlarmRuleConfig.class, new InstanceReferenceAlarmRuleConfig()); } @Override public void start(Properties config) throws ServiceNotProvidedException { diff --git a/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/InstanceReferenceAlarmRuleConfig.java b/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/InstanceReferenceAlarmRuleConfig.java new file mode 100644 index 000000000..51a9de425 --- /dev/null +++ b/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/InstanceReferenceAlarmRuleConfig.java @@ -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 InstanceReferenceAlarmRuleConfig implements IInstanceReferenceAlarmRuleConfig { + + @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; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceReferenceAlarmListPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceReferenceAlarmListPersistenceDAO.java new file mode 100644 index 000000000..7c68fe5f1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceReferenceAlarmListPersistenceDAO.java @@ -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.InstanceReferenceAlarmList; + +/** + * @author peng-yongsheng + */ +public interface IInstanceReferenceAlarmListPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceReferenceAlarmPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceReferenceAlarmPersistenceDAO.java new file mode 100644 index 000000000..5fdb0a51d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceReferenceAlarmPersistenceDAO.java @@ -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.InstanceReferenceAlarm; + +/** + * @author peng-yongsheng + */ +public interface IInstanceReferenceAlarmPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarm.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarm.java new file mode 100644 index 000000000..18c0fb8d0 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarm.java @@ -0,0 +1,130 @@ +/* + * 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 InstanceReferenceAlarm extends Data implements Alarm { + + private static final Column[] STRING_COLUMNS = { + new Column(InstanceReferenceAlarmTable.COLUMN_ID, new NonOperation()), + new Column(InstanceReferenceAlarmTable.COLUMN_ALARM_CONTENT, new CoverOperation()), + }; + + private static final Column[] LONG_COLUMNS = { + new Column(InstanceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, new CoverOperation()), + }; + + private static final Column[] DOUBLE_COLUMNS = {}; + + private static final Column[] INTEGER_COLUMNS = { + new Column(InstanceReferenceAlarmTable.COLUMN_ALARM_TYPE, new NonOperation()), + new Column(InstanceReferenceAlarmTable.COLUMN_SOURCE_VALUE, new NonOperation()), + new Column(InstanceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()), + new Column(InstanceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()), + new Column(InstanceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID, new NonOperation()), + new Column(InstanceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID, new NonOperation()), + }; + + private static final Column[] BOOLEAN_COLUMNS = {}; + + private static final Column[] BYTE_COLUMNS = {}; + + public InstanceReferenceAlarm(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); + } + + public Integer getFrontInstanceId() { + return getDataInteger(4); + } + + public void setFrontInstanceId(Integer frontInstanceId) { + setDataInteger(4, frontInstanceId); + } + + public Integer getBehindInstanceId() { + return getDataInteger(5); + } + + public void setBehindInstanceId(Integer behindInstanceId) { + setDataInteger(5, behindInstanceId); + } + + @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); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmList.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmList.java new file mode 100644 index 000000000..38b85bbca --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmList.java @@ -0,0 +1,122 @@ +/* + * 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 InstanceReferenceAlarmList extends Data { + + private static final Column[] STRING_COLUMNS = { + new Column(InstanceReferenceAlarmListTable.COLUMN_ID, new NonOperation()), + new Column(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT, new CoverOperation()), + }; + + private static final Column[] LONG_COLUMNS = { + new Column(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET, new NonOperation()), + }; + + private static final Column[] DOUBLE_COLUMNS = {}; + + private static final Column[] INTEGER_COLUMNS = { + new Column(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE, new NonOperation()), + new Column(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE, new NonOperation()), + new Column(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()), + new Column(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()), + new Column(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID, new NonOperation()), + new Column(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID, new NonOperation()), + }; + + private static final Column[] BOOLEAN_COLUMNS = {}; + + private static final Column[] BYTE_COLUMNS = {}; + + public InstanceReferenceAlarmList(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 Integer getFrontInstanceId() { + return getDataInteger(4); + } + + public void setFrontInstanceId(Integer frontInstanceId) { + setDataInteger(4, frontInstanceId); + } + + public Integer getBehindInstanceId() { + return getDataInteger(5); + } + + public void setBehindInstanceId(Integer behindInstanceId) { + setDataInteger(5, behindInstanceId); + } + + 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); + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmListTable.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmListTable.java new file mode 100644 index 000000000..509b701ed --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmListTable.java @@ -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.storage.table.alarm; + +import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable; + +/** + * @author peng-yongsheng + */ +public class InstanceReferenceAlarmListTable extends CommonMetricTable { + public static final String TABLE = "service_reference_alarm_list"; + public static final String COLUMN_FRONT_INSTANCE_ID = "front_instance_id"; + public static final String COLUMN_BEHIND_INSTANCE_ID = "behind_instance_id"; + 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"; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmTable.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmTable.java new file mode 100644 index 000000000..a68db82a2 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/InstanceReferenceAlarmTable.java @@ -0,0 +1,35 @@ +/* + * 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 InstanceReferenceAlarmTable extends CommonMetricTable { + public static final String TABLE = "instance_reference_alarm"; + public static final String COLUMN_FRONT_INSTANCE_ID = "front_instance_id"; + public static final String COLUMN_BEHIND_INSTANCE_ID = "behind_instance_id"; + 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"; +}