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 7f68cf1329498e688de7d2614a69543ef4d7d0dd..968ede38a660f30c09635e92e8193f61ae8e5e1f 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 @@ -25,4 +25,6 @@ public class AlarmGraphIdDefine { public static final int SERVICE_METRIC_ALARM_GRAPH_ID = 500; 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; + } 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 9c8b648d8a44318092fc69df93be8c9e91bc8e0f..eba11d572180c50c3ec5186d0d6da8183f542187 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 @@ -42,4 +42,11 @@ public class AlarmWorkerIdDefine { public static final int APPLICATION_METRIC_ALARM_PERSISTENCE_WORKER_ID = 523; public static final int APPLICATION_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 524; public static final int APPLICATION_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 525; + + public static final int SERVICE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID = 530; + public static final int SERVICE_REFERENCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 531; + public static final int SERVICE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID = 532; + 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; } 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 46bd9dda08dbecfd35d63875c9738a36a3c16f43..22e3f0688725aa785b9c4b159ccf2e7581cb4983 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 @@ -23,6 +23,7 @@ import org.apache.skywalking.apm.collector.analysis.alarm.define.AnalysisAlarmMo 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.service.ServiceMetricAlarmGraph; +import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service.ServiceReferenceMetricAlarmGraph; import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule; import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener; import org.apache.skywalking.apm.collector.configuration.ConfigurationModule; @@ -61,6 +62,8 @@ public class AnalysisAlarmModuleProvider extends ModuleProvider { ApplicationMetricAlarmGraph applicationMetricAlarmGraph = new ApplicationMetricAlarmGraph(getManager(), workerCreateListener); applicationMetricAlarmGraph.create(); + ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener); + serviceReferenceMetricAlarmGraph.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/service/ServiceReferenceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmAssertWorker.java new file mode 100644 index 0000000000000000000000000000000000000000..cbf0cc97cb191d466daa71cdefeb9acb23bd839b --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmAssertWorker.java @@ -0,0 +1,89 @@ +/* + * 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.service; + +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.IServiceReferenceAlarmRuleConfig; +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.ServiceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker { + + private final IServiceReferenceAlarmRuleConfig serviceReferenceAlarmRuleConfig; + + public ServiceReferenceMetricAlarmAssertWorker(ModuleManager moduleManager) { + super(moduleManager); + this.serviceReferenceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IServiceReferenceAlarmRuleConfig.class); + } + + @Override public int id() { + return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID; + } + + @Override protected ServiceReferenceAlarm newAlarmObject(String id, ServiceReferenceMetric inputMetric) { + ServiceReferenceAlarm serviceReferenceAlarm = new ServiceReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontServiceId() + Const.ID_SPLIT + inputMetric.getBehindServiceId()); + serviceReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId()); + serviceReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId()); + serviceReferenceAlarm.setFrontInstanceId(inputMetric.getFrontInstanceId()); + serviceReferenceAlarm.setBehindInstanceId(inputMetric.getBehindInstanceId()); + serviceReferenceAlarm.setFrontServiceId(inputMetric.getFrontServiceId()); + serviceReferenceAlarm.setBehindServiceId(inputMetric.getBehindServiceId()); + return serviceReferenceAlarm; + } + + @Override protected Double calleeErrorRateThreshold() { + return serviceReferenceAlarmRuleConfig.calleeErrorRateThreshold(); + } + + @Override protected Double callerErrorRateThreshold() { + return serviceReferenceAlarmRuleConfig.callerErrorRateThreshold(); + } + + @Override protected Double calleeAverageResponseTimeThreshold() { + return serviceReferenceAlarmRuleConfig.calleeAverageResponseTimeThreshold(); + } + + @Override protected Double callerAverageResponseTimeThreshold() { + return serviceReferenceAlarmRuleConfig.callerAverageResponseTimeThreshold(); + } + + public static class Factory extends AlarmAssertWorkerProvider { + + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public ServiceReferenceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) { + return new ServiceReferenceMetricAlarmAssertWorker(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/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 new file mode 100644 index 0000000000000000000000000000000000000000..d4010fb759f14336b467a3987b9ed78a520d7a17 --- /dev/null +++ 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 @@ -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.service; + +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.ServiceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMetricAlarmGraph { + + private final ModuleManager moduleManager; + private final WorkerCreateListener workerCreateListener; + + public ServiceReferenceMetricAlarmGraph(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.SERVICE_REFERENCE_METRIC_ALARM_GRAPH_ID, ServiceReferenceMetric.class); + + graph.addNode(new ServiceReferenceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener)) + .addNext(new ServiceReferenceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.SERVICE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener)) + .addNext(new ServiceReferenceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + graph.toFinder().findNode(AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_REMOTE_WORKER_ID, ServiceReferenceAlarm.class) + .addNext(new ServiceReferenceMetricAlarmToListNodeProcessor()) + .addNext(new ServiceReferenceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener)); + + link(graph); + } + + private void link(Graph graph) { + GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class) + .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; + } + + @Override public void process(ServiceReferenceMetric serviceReferenceMetric, + Next next) { + graph.start(serviceReferenceMetric); + } + }); + } +} 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/ServiceReferenceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmListPersistenceWorker.java new file mode 100644 index 0000000000000000000000000000000000000000..d6e1d5fa6cdefaa66e46d5f1d78f6d4dd6420d74 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmListPersistenceWorker.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.service; + +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.IServiceReferenceAlarmListPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMetricAlarmListPersistenceWorker extends PersistenceWorker { + + public ServiceReferenceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return AlarmWorkerIdDefine.SERVICE_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(IServiceReferenceAlarmListPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public ServiceReferenceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new ServiceReferenceMetricAlarmListPersistenceWorker(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/service/ServiceReferenceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmPersistenceWorker.java new file mode 100644 index 0000000000000000000000000000000000000000..166a7419d84a7e658b9c7f10430d2aa1858db241 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmPersistenceWorker.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.service; + +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.IServiceReferenceAlarmPersistenceDAO; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMetricAlarmPersistenceWorker extends PersistenceWorker { + + public ServiceReferenceMetricAlarmPersistenceWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID; + } + + @Override protected boolean needMergeDBData() { + return true; + } + + @SuppressWarnings("unchecked") + @Override protected IPersistenceDAO persistenceDAO() { + return getModuleManager().find(StorageModule.NAME).getService(IServiceReferenceAlarmPersistenceDAO.class); + } + + public static class Factory extends PersistenceWorkerProvider { + public Factory(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public ServiceReferenceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) { + return new ServiceReferenceMetricAlarmPersistenceWorker(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/service/ServiceReferenceMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmRemoteWorker.java new file mode 100644 index 0000000000000000000000000000000000000000..7914d8b1254d0e7490b77cd751b997672c0b9502 --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmRemoteWorker.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.service; + +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.ServiceReferenceAlarm; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMetricAlarmRemoteWorker extends AbstractRemoteWorker { + + public ServiceReferenceMetricAlarmRemoteWorker(ModuleManager moduleManager) { + super(moduleManager); + } + + @Override public int id() { + return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID; + } + + @Override public Selector selector() { + return Selector.HashCode; + } + + @Override protected void onWork(ServiceReferenceAlarm 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 ServiceReferenceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) { + return new ServiceReferenceMetricAlarmRemoteWorker(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/service/ServiceReferenceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmToListNodeProcessor.java new file mode 100644 index 0000000000000000000000000000000000000000..d0338cfb89d0c805b1a43c55716ce539eb01820e --- /dev/null +++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmToListNodeProcessor.java @@ -0,0 +1,56 @@ +/* + * 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.service; + +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.ServiceReferenceAlarm; +import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceMetricAlarmToListNodeProcessor implements NodeProcessor { + + @Override public int id() { + return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID; + } + + @Override public void process(ServiceReferenceAlarm serviceReferenceAlarm, Next next) { + String id = serviceReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + serviceReferenceAlarm.getSourceValue() + + Const.ID_SPLIT + serviceReferenceAlarm.getAlarmType() + + Const.ID_SPLIT + serviceReferenceAlarm.getFrontServiceId() + + Const.ID_SPLIT + serviceReferenceAlarm.getBehindServiceId(); + + ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList(id); + serviceReferenceAlarmList.setFrontApplicationId(serviceReferenceAlarm.getFrontApplicationId()); + serviceReferenceAlarmList.setBehindApplicationId(serviceReferenceAlarm.getBehindApplicationId()); + serviceReferenceAlarmList.setFrontInstanceId(serviceReferenceAlarm.getFrontInstanceId()); + serviceReferenceAlarmList.setBehindInstanceId(serviceReferenceAlarm.getBehindInstanceId()); + serviceReferenceAlarmList.setFrontServiceId(serviceReferenceAlarm.getFrontServiceId()); + serviceReferenceAlarmList.setBehindServiceId(serviceReferenceAlarm.getBehindServiceId()); + serviceReferenceAlarmList.setSourceValue(serviceReferenceAlarm.getSourceValue()); + serviceReferenceAlarmList.setAlarmType(serviceReferenceAlarm.getAlarmType()); + serviceReferenceAlarmList.setTimeBucket(serviceReferenceAlarm.getLastTimeBucket()); + serviceReferenceAlarmList.setAlarmContent(serviceReferenceAlarm.getAlarmContent()); + next.execute(serviceReferenceAlarmList); + } +} 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 efd12b1ed4bb38e3180b1fd2023cb39207931f4f..dcd74f50d548bd92e9b24e28e8398deb293ea7f5 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 @@ -22,6 +22,7 @@ import org.apache.skywalking.apm.collector.configuration.service.IApdexThreshold 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.IServiceAlarmRuleConfig; +import org.apache.skywalking.apm.collector.configuration.service.IServiceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.core.module.Module; /** @@ -36,6 +37,9 @@ public class ConfigurationModule extends Module { } @Override public Class[] services() { - return new Class[] {IApdexThresholdService.class, IServiceAlarmRuleConfig.class, IInstanceAlarmRuleConfig.class, IApplicationAlarmRuleConfig.class}; + return new Class[] { + IApdexThresholdService.class, + IServiceAlarmRuleConfig.class, IInstanceAlarmRuleConfig.class, IApplicationAlarmRuleConfig.class, + IServiceReferenceAlarmRuleConfig.class}; } } diff --git a/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/IServiceReferenceAlarmRuleConfig.java b/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/IServiceReferenceAlarmRuleConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..97eee2144401a7fb2d378f61cbf9eea064b4d13d --- /dev/null +++ b/apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/IServiceReferenceAlarmRuleConfig.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 IServiceReferenceAlarmRuleConfig 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 a1598ad5ea4cf07dd1ac20ba0cc8584cd198cef6..465f92a7664306fc02ea07020119c24308235426 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 @@ -25,8 +25,10 @@ import org.apache.skywalking.apm.collector.configuration.service.IApdexThreshold 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.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.ServiceAlarmRuleConfig; +import org.apache.skywalking.apm.collector.configuration.service.ServiceReferenceAlarmRuleConfig; import org.apache.skywalking.apm.collector.core.module.Module; import org.apache.skywalking.apm.collector.core.module.ModuleProvider; import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedException; @@ -49,6 +51,7 @@ public class ConfigurationModuleProvider extends ModuleProvider { this.registerServiceImplementation(IServiceAlarmRuleConfig.class, new ServiceAlarmRuleConfig()); this.registerServiceImplementation(IInstanceAlarmRuleConfig.class, new InstanceAlarmRuleConfig()); this.registerServiceImplementation(IApplicationAlarmRuleConfig.class, new ApplicationAlarmRuleConfig()); + this.registerServiceImplementation(IServiceReferenceAlarmRuleConfig.class, new ServiceReferenceAlarmRuleConfig()); } @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/ServiceReferenceAlarmRuleConfig.java b/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/ServiceReferenceAlarmRuleConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d2245c4cbc10596cfe08c1ec233752f841715481 --- /dev/null +++ b/apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/ServiceReferenceAlarmRuleConfig.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 ServiceReferenceAlarmRuleConfig implements IServiceReferenceAlarmRuleConfig { + + @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/IServiceReferenceAlarmListPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IServiceReferenceAlarmListPersistenceDAO.java new file mode 100644 index 0000000000000000000000000000000000000000..8d0252da955d3e50099f3b50f5b29af54a7f85cc --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IServiceReferenceAlarmListPersistenceDAO.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.ServiceReferenceAlarmList; + +/** + * @author peng-yongsheng + */ +public interface IServiceReferenceAlarmListPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IServiceReferenceAlarmPersistenceDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IServiceReferenceAlarmPersistenceDAO.java new file mode 100644 index 0000000000000000000000000000000000000000..1566431f5fffb4ca5a1513b6fe8e68ef9af85ff7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IServiceReferenceAlarmPersistenceDAO.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.ServiceReferenceAlarm; + +/** + * @author peng-yongsheng + */ +public interface IServiceReferenceAlarmPersistenceDAO extends IPersistenceDAO { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarm.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarm.java new file mode 100644 index 0000000000000000000000000000000000000000..67ff09c1aa1607a4a4987a5fe5247b7c582b1505 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarm.java @@ -0,0 +1,148 @@ +/* + * 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 ServiceReferenceAlarm extends Data implements Alarm { + + private static final Column[] STRING_COLUMNS = { + new Column(ServiceReferenceAlarmTable.COLUMN_ID, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_ALARM_CONTENT, new CoverOperation()), + }; + + private static final Column[] LONG_COLUMNS = { + new Column(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET, new CoverOperation()), + }; + + private static final Column[] DOUBLE_COLUMNS = {}; + + private static final Column[] INTEGER_COLUMNS = { + new Column(ServiceReferenceAlarmTable.COLUMN_ALARM_TYPE, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_SOURCE_VALUE, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_FRONT_INSTANCE_ID, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_BEHIND_INSTANCE_ID, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_FRONT_SERVICE_ID, new NonOperation()), + new Column(ServiceReferenceAlarmTable.COLUMN_BEHIND_SERVICE_ID, new NonOperation()), + }; + + private static final Column[] BOOLEAN_COLUMNS = {}; + + private static final Column[] BYTE_COLUMNS = {}; + + public ServiceReferenceAlarm(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); + } + + public Integer getFrontServiceId() { + return getDataInteger(6); + } + + public void setFrontServiceId(Integer frontServiceId) { + setDataInteger(6, frontServiceId); + } + + public Integer getBehindServiceId() { + return getDataInteger(7); + } + + public void setBehindServiceId(Integer behindServiceId) { + setDataInteger(7, behindServiceId); + } + + @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/ServiceReferenceAlarmList.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarmList.java new file mode 100644 index 0000000000000000000000000000000000000000..cb173acd38f0ec4599b2bdd72b28cfbc6c962ab1 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarmList.java @@ -0,0 +1,140 @@ +/* + * 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 ServiceReferenceAlarmList extends Data { + + private static final Column[] STRING_COLUMNS = { + new Column(ServiceReferenceAlarmListTable.COLUMN_ID, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_ALARM_CONTENT, new CoverOperation()), + }; + + private static final Column[] LONG_COLUMNS = { + new Column(ServiceReferenceAlarmListTable.COLUMN_TIME_BUCKET, new NonOperation()), + }; + + private static final Column[] DOUBLE_COLUMNS = {}; + + private static final Column[] INTEGER_COLUMNS = { + new Column(ServiceReferenceAlarmListTable.COLUMN_ALARM_TYPE, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_SOURCE_VALUE, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_FRONT_SERVICE_ID, new NonOperation()), + new Column(ServiceReferenceAlarmListTable.COLUMN_BEHIND_SERVICE_ID, new NonOperation()), + }; + + private static final Column[] BOOLEAN_COLUMNS = {}; + + private static final Column[] BYTE_COLUMNS = {}; + + public ServiceReferenceAlarmList(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 Integer getFrontServiceId() { + return getDataInteger(6); + } + + public void setFrontServiceId(Integer frontServiceId) { + setDataInteger(6, frontServiceId); + } + + public Integer getBehindServiceId() { + return getDataInteger(7); + } + + public void setBehindServiceId(Integer behindServiceId) { + setDataInteger(7, behindServiceId); + } + + 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/ServiceReferenceAlarmListTable.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarmListTable.java new file mode 100644 index 0000000000000000000000000000000000000000..24674f34a2f671ab17b3bcfa77a0435e31de2651 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarmListTable.java @@ -0,0 +1,36 @@ +/* + * 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 ServiceReferenceAlarmListTable extends CommonMetricTable { + public static final String TABLE = "service_reference_alarm_list"; + public static final String COLUMN_FRONT_SERVICE_ID = "front_service_id"; + public static final String COLUMN_BEHIND_SERVICE_ID = "behind_service_id"; + 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/ServiceReferenceAlarmTable.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarmTable.java new file mode 100644 index 0000000000000000000000000000000000000000..b04227dceda057635cac09e45f03eec4eac89219 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/table/alarm/ServiceReferenceAlarmTable.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.collector.storage.table.alarm; + +import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable; + +/** + * @author peng-yongsheng + */ +public class ServiceReferenceAlarmTable extends CommonMetricTable { + public static final String TABLE = "service_reference_alarm"; + public static final String COLUMN_FRONT_SERVICE_ID = "front_service_id"; + public static final String COLUMN_BEHIND_SERVICE_ID = "behind_service_id"; + 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"; +}