Service metric alarm.

This commit is contained in:
peng-yongsheng 2018-01-01 14:10:08 +08:00
parent 89c601ba38
commit 2d44d8a419
103 changed files with 2068 additions and 418 deletions

View File

@ -0,0 +1,29 @@
/*
* 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.define.graph;
/**
* @author peng-yongsheng
*/
public class AlarmGraphIdDefine {
public static final int SERVICE_METRIC_TRANSFORM_GRAPH_ID = 500;
public static final int INSTANCE_METRIC_TRANSFORM_GRAPH_ID = 501;
public static final int APPLICATION_METRIC_TRANSFORM_GRAPH_ID = 502;
public static final int ALARM_METRIC_AGGREGATION_GRAPH_ID = 503;
}

View File

@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.define.graph;
/**
* @author peng-yongsheng
*/
public class AlarmWorkerIdDefine {
public static final int SERVICE_METRIC_ALARM_ASSERT_WORKER_ID = 500;
public static final int SERVICE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 501;
public static final int SERVICE_METRIC_ALARM_REMOTE_WORKER_ID = 500;
public static final int SERVICE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 500;
public static final int SERVICE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 500;
public static final int SERVICE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 500;
public static final int INSTANCE_METRIC_TRANSFORM_WORKER_ID = 502;
public static final int INSTANCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 503;
public static final int APPLICATION_METRIC_TRANSFORM_WORKER_ID = 504;
public static final int APPLICATION_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 505;
public static final int ALARM_METRIC_REMOTE_WORKER_ID = 506;
public static final int ALARM_METRIC_APPLICATION_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 507;
public static final int ALARM_METRIC_INSTANCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 508;
public static final int ALARM_METRIC_SERVICE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID = 509;
public static final int ALARM_METRIC_AGGREGATION_WORKER_ID = 510;
}

View File

@ -36,6 +36,16 @@
<artifactId>alarm-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>metric-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>collector-configuration-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>collector-storage-define</artifactId>

View File

@ -20,14 +20,21 @@ package org.apache.skywalking.apm.collector.analysis.alarm.provider;
import java.util.Properties;
import org.apache.skywalking.apm.collector.analysis.alarm.define.AnalysisAlarmModule;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.ApplicationMetricTransformGraph;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.InstanceMetricTransformGraph;
import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service.ServiceMetricAlarmGraph;
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;
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;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
/**
* @author peng-yongsheng
*/
public class AlertingModuleProvider extends ModuleProvider {
public class AnalysisAlarmModuleProvider extends ModuleProvider {
@Override public String name() {
return "default";
@ -42,6 +49,16 @@ public class AlertingModuleProvider extends ModuleProvider {
}
@Override public void start(Properties config) throws ServiceNotProvidedException {
WorkerCreateListener workerCreateListener = new WorkerCreateListener();
ServiceMetricAlarmGraph serviceMetricAlarmGraph = new ServiceMetricAlarmGraph(getManager(), workerCreateListener);
serviceMetricAlarmGraph.create();
InstanceMetricTransformGraph instanceMetricTransformGraph = new InstanceMetricTransformGraph(getManager(), workerCreateListener);
instanceMetricTransformGraph.create();
ApplicationMetricTransformGraph applicationMetricTransformGraph = new ApplicationMetricTransformGraph(getManager(), workerCreateListener);
applicationMetricTransformGraph.create();
}
@ -50,6 +67,6 @@ public class AlertingModuleProvider extends ModuleProvider {
}
@Override public String[] requiredModules() {
return new String[0];
return new String[] {RemoteModule.NAME, AnalysisMetricModule.NAME, ConfigurationModule.NAME};
}
}

View File

@ -0,0 +1,124 @@
/*
* 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;
import org.apache.skywalking.apm.collector.analysis.metric.define.MetricSource;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.core.util.NumberFormatUtils;
import org.apache.skywalking.apm.collector.storage.table.Metric;
import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
import org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author peng-yongsheng
*/
public abstract class AlarmAssertWorker<INPUT extends Data & Metric, OUTPUT extends Data & Alarm> extends AbstractLocalAsyncWorker<INPUT, OUTPUT> {
private final Logger logger = LoggerFactory.getLogger(AlarmAssertWorker.class);
public AlarmAssertWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override protected final void onWork(INPUT inputMetric) throws WorkerException {
errorRateAlarmAssert(inputMetric);
averageResponseTimeAlarmAssert(inputMetric);
}
protected abstract OUTPUT newAlarmObject(String id, INPUT inputMetric);
protected abstract Double calleeErrorRateThreshold();
protected abstract Double callerErrorRateThreshold();
private void errorRateAlarmAssert(INPUT inputMetric) {
Double errorRate = Double.valueOf(inputMetric.getTransactionErrorCalls()) / Double.valueOf(inputMetric.getTransactionCalls());
errorRate = NumberFormatUtils.rateNumberFormat(errorRate);
if (inputMetric.getSourceValue().equals(MetricSource.Callee.getValue())) {
if (errorRate >= calleeErrorRateThreshold()) {
String id = String.valueOf(MetricSource.Callee.getValue()) + Const.ID_SPLIT + AlarmType.ERROR_RATE.getValue();
OUTPUT alarm = newAlarmObject(id, inputMetric);
alarm.setAlarmType(AlarmType.ERROR_RATE.getValue());
alarm.setLastTimeBucket(inputMetric.getTimeBucket());
alarm.setSourceValue(MetricSource.Callee.getValue());
alarm.setAlarmContent("");
onNext(alarm);
}
} else if (inputMetric.getSourceValue().equals(MetricSource.Caller.getValue())) {
if (errorRate >= callerErrorRateThreshold()) {
String id = String.valueOf(MetricSource.Caller.getValue()) + Const.ID_SPLIT + AlarmType.ERROR_RATE.getValue();
OUTPUT alarm = newAlarmObject(id, inputMetric);
alarm.setAlarmType(AlarmType.ERROR_RATE.getValue());
alarm.setLastTimeBucket(inputMetric.getTimeBucket());
alarm.setSourceValue(MetricSource.Caller.getValue());
alarm.setAlarmContent("");
onNext(alarm);
}
} else {
logger.error("Please check the metric source, the value must be {} or {}", MetricSource.Caller.getValue(), MetricSource.Callee.getValue());
}
}
protected abstract Double calleeAverageResponseTimeThreshold();
protected abstract Double callerAverageResponseTimeThreshold();
private void averageResponseTimeAlarmAssert(INPUT inputMetric) {
Long transactionSuccessDurationSum = inputMetric.getTransactionDurationSum() - inputMetric.getTransactionErrorDurationSum();
Long transactionSuccessCalls = inputMetric.getTransactionCalls() - inputMetric.getTransactionErrorCalls();
Double averageResponseTime = Double.valueOf(transactionSuccessDurationSum) / Double.valueOf(transactionSuccessCalls);
averageResponseTime = NumberFormatUtils.rateNumberFormat(averageResponseTime);
if (inputMetric.getSourceValue().equals(MetricSource.Callee.getValue())) {
if (averageResponseTime >= calleeAverageResponseTimeThreshold()) {
String id = String.valueOf(MetricSource.Callee.getValue()) + Const.ID_SPLIT + AlarmType.SLOW_RTT.getValue();
OUTPUT alarm = newAlarmObject(id, inputMetric);
alarm.setAlarmType(AlarmType.SLOW_RTT.getValue());
alarm.setLastTimeBucket(inputMetric.getTimeBucket());
alarm.setSourceValue(MetricSource.Callee.getValue());
alarm.setAlarmContent("");
onNext(alarm);
} else if (inputMetric.getSourceValue().equals(MetricSource.Caller.getValue())) {
if (averageResponseTime >= callerAverageResponseTimeThreshold()) {
String id = String.valueOf(MetricSource.Caller.getValue()) + Const.ID_SPLIT + AlarmType.SLOW_RTT.getValue();
OUTPUT alarm = newAlarmObject(id, inputMetric);
alarm.setAlarmType(AlarmType.SLOW_RTT.getValue());
alarm.setLastTimeBucket(inputMetric.getTimeBucket());
alarm.setSourceValue(MetricSource.Caller.getValue());
alarm.setAlarmContent("");
onNext(alarm);
}
} else {
logger.error("Please check the metric source, the value must be {} or {}", MetricSource.Caller.getValue(), MetricSource.Callee.getValue());
}
}
}
}

View File

@ -18,25 +18,18 @@
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.alerting.AlertingList;
import org.apache.skywalking.apm.collector.storage.table.Metric;
import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
/**
* @author peng-yongsheng
*/
public class AlertingListAggregationWorker extends AbstractLocalAsyncWorker<AlertingList, AlertingList> {
public abstract class AlarmAssertWorkerProvider<INPUT extends Data & Metric, OUTPUT extends Data & Alarm, WORKER_TYPE extends AlarmAssertWorker<INPUT, OUTPUT>> extends AbstractLocalAsyncWorkerProvider<INPUT, OUTPUT, WORKER_TYPE> {
public AlertingListAggregationWorker(ModuleManager moduleManager) {
public AlarmAssertWorkerProvider(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return 0;
}
@Override protected void onWork(AlertingList message) throws WorkerException {
}
}

View File

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
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.storage.table.application.ApplicationMetric;
/**
* @author peng-yongsheng
*/
public class ApplicationMetricTransformGraph {
private final ModuleManager moduleManager;
private final WorkerCreateListener workerCreateListener;
public ApplicationMetricTransformGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
this.moduleManager = moduleManager;
this.workerCreateListener = workerCreateListener;
}
public void create() {
Graph<ApplicationMetric> graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.APPLICATION_METRIC_TRANSFORM_GRAPH_ID, ApplicationMetric.class);
graph.addNode(new ApplicationMetricTransformWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<ApplicationMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.APPLICATION_MAPPING_AGGREGATION_WORKER_ID, ApplicationMetric.class)
.addNext(new NodeProcessor<ApplicationMetric, ApplicationMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID;
}
@Override public void process(ApplicationMetric applicationMetric,
Next<ApplicationMetric> next) {
graph.start(applicationMetric);
}
});
}
}

View File

@ -0,0 +1,83 @@
/*
* 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;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.alarm.AlarmMetric;
import org.apache.skywalking.apm.collector.storage.table.alarm.Layer;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
/**
* @author peng-yongsheng
*/
public class ApplicationMetricTransformWorker extends AggregationWorker<ApplicationMetric, AlarmMetric> {
public ApplicationMetricTransformWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_METRIC_TRANSFORM_WORKER_ID;
}
@Override protected AlarmMetric transform(ApplicationMetric applicationMetric) {
AlarmMetric alarmMetric = new AlarmMetric(String.valueOf(applicationMetric.getApplicationId()));
alarmMetric.setLayer(Layer.APPLICATION.getValue());
alarmMetric.setObjectId(applicationMetric.getApplicationId());
alarmMetric.setApplicationId(applicationMetric.getApplicationId());
alarmMetric.setSourceValue(applicationMetric.getSourceValue());
alarmMetric.setTransactionCalls(applicationMetric.getTransactionCalls());
alarmMetric.setTransactionDurationSum(applicationMetric.getTransactionDurationSum());
alarmMetric.setTransactionErrorCalls(applicationMetric.getTransactionErrorCalls());
alarmMetric.setTransactionErrorDurationSum(applicationMetric.getTransactionErrorDurationSum());
alarmMetric.setBusinessTransactionCalls(applicationMetric.getBusinessTransactionCalls());
alarmMetric.setBusinessTransactionDurationSum(applicationMetric.getBusinessTransactionDurationSum());
alarmMetric.setBusinessTransactionErrorCalls(applicationMetric.getBusinessTransactionErrorCalls());
alarmMetric.setBusinessTransactionErrorDurationSum(applicationMetric.getBusinessTransactionErrorDurationSum());
alarmMetric.setMqTransactionCalls(applicationMetric.getMqTransactionCalls());
alarmMetric.setMqTransactionDurationSum(applicationMetric.getMqTransactionDurationSum());
alarmMetric.setMqTransactionErrorCalls(applicationMetric.getMqTransactionErrorCalls());
alarmMetric.setMqTransactionErrorDurationSum(applicationMetric.getMqTransactionErrorDurationSum());
alarmMetric.setTimeBucket(applicationMetric.getTimeBucket());
return alarmMetric;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationMetric, AlarmMetric, ApplicationMetricTransformWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ApplicationMetricTransformWorker workerInstance(ModuleManager moduleManager) {
return new ApplicationMetricTransformWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -0,0 +1,68 @@
/*
* 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;
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.storage.table.instance.InstanceMetric;
/**
* @author peng-yongsheng
*/
public class InstanceMetricTransformGraph {
private final ModuleManager moduleManager;
private final WorkerCreateListener workerCreateListener;
public InstanceMetricTransformGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
this.moduleManager = moduleManager;
this.workerCreateListener = workerCreateListener;
}
public void create() {
Graph<InstanceMetric> graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.INSTANCE_METRIC_TRANSFORM_GRAPH_ID, InstanceMetric.class);
graph.addNode(new InstanceMetricTransformWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<InstanceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_METRIC_GRAPH_ID, InstanceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_METRIC_AGGREGATION_WORKER_ID, InstanceMetric.class)
.addNext(new NodeProcessor<InstanceMetric, InstanceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.INSTANCE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID;
}
@Override public void process(InstanceMetric instanceMetric,
Next<InstanceMetric> next) {
graph.start(instanceMetric);
}
});
}
}

View File

@ -0,0 +1,84 @@
/*
* 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;
import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.alarm.AlarmMetric;
import org.apache.skywalking.apm.collector.storage.table.alarm.Layer;
import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric;
/**
* @author peng-yongsheng
*/
public class InstanceMetricTransformWorker extends AggregationWorker<InstanceMetric, AlarmMetric> {
public InstanceMetricTransformWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return AlarmWorkerIdDefine.INSTANCE_METRIC_TRANSFORM_WORKER_ID;
}
@Override protected AlarmMetric transform(InstanceMetric instanceMetric) {
AlarmMetric alarmMetric = new AlarmMetric(String.valueOf(instanceMetric.getApplicationId()));
alarmMetric.setLayer(Layer.INSTANCE.getValue());
alarmMetric.setObjectId(instanceMetric.getApplicationId());
alarmMetric.setApplicationId(instanceMetric.getApplicationId());
alarmMetric.setSourceValue(instanceMetric.getSourceValue());
alarmMetric.setTransactionCalls(instanceMetric.getTransactionCalls());
alarmMetric.setTransactionDurationSum(instanceMetric.getTransactionDurationSum());
alarmMetric.setTransactionErrorCalls(instanceMetric.getTransactionErrorCalls());
alarmMetric.setTransactionErrorDurationSum(instanceMetric.getTransactionErrorDurationSum());
alarmMetric.setBusinessTransactionCalls(instanceMetric.getBusinessTransactionCalls());
alarmMetric.setBusinessTransactionDurationSum(instanceMetric.getBusinessTransactionDurationSum());
alarmMetric.setBusinessTransactionErrorCalls(instanceMetric.getBusinessTransactionErrorCalls());
alarmMetric.setBusinessTransactionErrorDurationSum(instanceMetric.getBusinessTransactionErrorDurationSum());
alarmMetric.setMqTransactionCalls(instanceMetric.getMqTransactionCalls());
alarmMetric.setMqTransactionDurationSum(instanceMetric.getMqTransactionDurationSum());
alarmMetric.setMqTransactionErrorCalls(instanceMetric.getMqTransactionErrorCalls());
alarmMetric.setMqTransactionErrorDurationSum(instanceMetric.getMqTransactionErrorDurationSum());
alarmMetric.setTimeBucket(instanceMetric.getTimeBucket());
return alarmMetric;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<InstanceMetric, AlarmMetric, InstanceMetricTransformWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public InstanceMetricTransformWorker workerInstance(ModuleManager moduleManager) {
return new InstanceMetricTransformWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -0,0 +1,86 @@
/*
* 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.IServiceAlarmRuleConfig;
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.ServiceAlarm;
import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric;
/**
* @author peng-yongsheng
*/
public class ServiceMetricAlarmAssertWorker extends AlarmAssertWorker<ServiceMetric, ServiceAlarm> {
private final IServiceAlarmRuleConfig serviceAlarmRuleConfig;
public ServiceMetricAlarmAssertWorker(ModuleManager moduleManager) {
super(moduleManager);
this.serviceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IServiceAlarmRuleConfig.class);
}
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_ASSERT_WORKER_ID;
}
@Override protected ServiceAlarm newAlarmObject(String id, ServiceMetric inputMetric) {
ServiceAlarm serviceAlarm = new ServiceAlarm(id + Const.ID_SPLIT + inputMetric.getServiceId());
serviceAlarm.setApplicationId(inputMetric.getApplicationId());
serviceAlarm.setInstanceId(inputMetric.getInstanceId());
serviceAlarm.setServiceId(inputMetric.getServiceId());
return serviceAlarm;
}
@Override protected Double calleeErrorRateThreshold() {
return serviceAlarmRuleConfig.calleeErrorRateThreshold();
}
@Override protected Double callerErrorRateThreshold() {
return serviceAlarmRuleConfig.callerErrorRateThreshold();
}
@Override protected Double calleeAverageResponseTimeThreshold() {
return serviceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
}
@Override protected Double callerAverageResponseTimeThreshold() {
return serviceAlarmRuleConfig.callerAverageResponseTimeThreshold();
}
public static class Factory extends AlarmAssertWorkerProvider<ServiceMetric, ServiceAlarm, ServiceMetricAlarmAssertWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public ServiceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
return new ServiceMetricAlarmAssertWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}

View File

@ -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.ServiceAlarm;
import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric;
/**
* @author peng-yongsheng
*/
public class ServiceMetricAlarmGraph {
private final ModuleManager moduleManager;
private final WorkerCreateListener workerCreateListener;
public ServiceMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
this.moduleManager = moduleManager;
this.workerCreateListener = workerCreateListener;
}
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
Graph<ServiceMetric> graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.SERVICE_METRIC_TRANSFORM_GRAPH_ID, ServiceMetric.class);
graph.addNode(new ServiceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ServiceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.SERVICE_METRIC_TRANSFORM_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
graph.toFinder().findNode(AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_REMOTE_WORKER_ID, ServiceAlarm.class)
.addNext(new ServiceMetricAlarmToListNodeProcessor())
.addNext(new ServiceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<ServiceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_METRIC_GRAPH_ID, ServiceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_METRIC_PERSISTENCE_WORKER_ID, ServiceMetric.class)
.addNext(new NodeProcessor<ServiceMetric, ServiceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_METRIC_TRANSFORM_GRAPH_BRIDGE_WORKER_ID;
}
@Override public void process(ServiceMetric serviceMetric,
Next<ServiceMetric> next) {
graph.start(serviceMetric);
}
});
}
}

View File

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

View File

@ -16,45 +16,46 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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.IAlertingListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alerting.AlertingList;
import org.apache.skywalking.apm.collector.storage.dao.IServiceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm;
/**
* @author peng-yongsheng
*/
public class AlertingListPersistenceWorker extends PersistenceWorker<AlertingList, AlertingList> {
public class ServiceMetricAlarmPersistenceWorker extends PersistenceWorker<ServiceAlarm> {
public AlertingListPersistenceWorker(ModuleManager moduleManager) {
public ServiceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return 114;
return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IAlertingListPersistenceDAO.class);
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ServiceAlarm> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IServiceAlarmPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<AlertingList, AlertingList, AlertingListPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ServiceAlarm, ServiceMetricAlarmPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public AlertingListPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new AlertingListPersistenceWorker(moduleManager);
@Override public ServiceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new ServiceMetricAlarmPersistenceWorker(moduleManager);
}
@Override

View File

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

View File

@ -0,0 +1,52 @@
/*
* 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.ServiceAlarm;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList;
/**
* @author peng-yongsheng
*/
public class ServiceMetricAlarmToListNodeProcessor implements NodeProcessor<ServiceAlarm, ServiceAlarmList> {
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
}
@Override public void process(ServiceAlarm serviceAlarm, Next<ServiceAlarmList> next) {
String id = serviceAlarm.getLastTimeBucket() + Const.ID_SPLIT + serviceAlarm.getSourceValue()
+ Const.ID_SPLIT + serviceAlarm.getAlarmType()
+ Const.ID_SPLIT + serviceAlarm.getServiceId();
ServiceAlarmList serviceAlarmList = new ServiceAlarmList(id);
serviceAlarmList.setApplicationId(serviceAlarm.getApplicationId());
serviceAlarmList.setInstanceId(serviceAlarm.getInstanceId());
serviceAlarmList.setServiceId(serviceAlarm.getServiceId());
serviceAlarmList.setSourceValue(serviceAlarm.getSourceValue());
serviceAlarmList.setAlarmType(serviceAlarm.getAlarmType());
serviceAlarmList.setTimeBucket(serviceAlarm.getLastTimeBucket());
serviceAlarmList.setAlarmContent(serviceAlarm.getAlarmContent());
next.execute(serviceAlarmList);
}
}

View File

@ -16,23 +16,4 @@
#
#
#
# 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.
#
#
org.apache.skywalking.apm.collector.analysis.alarm.provider.AlertingModuleProvider
org.apache.skywalking.apm.collector.analysis.alarm.provider.AnalysisAlarmModuleProvider

View File

@ -19,8 +19,8 @@
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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;
@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
/**
* @author peng-yongsheng
*/
public class CpuMetricPersistenceWorker extends PersistenceWorker<CpuMetric, CpuMetric> {
public class CpuMetricPersistenceWorker extends PersistenceWorker<CpuMetric> {
public CpuMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
@ -44,11 +44,12 @@ public class CpuMetricPersistenceWorker extends PersistenceWorker<CpuMetric, Cpu
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, CpuMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(ICpuMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<CpuMetric, CpuMetric, CpuMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<CpuMetric, CpuMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -19,8 +19,8 @@
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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;
@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
/**
* @author peng-yongsheng
*/
public class GCMetricPersistenceWorker extends PersistenceWorker<GCMetric, GCMetric> {
public class GCMetricPersistenceWorker extends PersistenceWorker<GCMetric> {
public GCMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
@ -44,11 +44,12 @@ public class GCMetricPersistenceWorker extends PersistenceWorker<GCMetric, GCMet
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, GCMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IGCMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<GCMetric, GCMetric, GCMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<GCMetric, GCMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -19,8 +19,8 @@
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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;
@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.table.register.Instance;
/**
* @author peng-yongsheng
*/
public class InstHeartBeatPersistenceWorker extends PersistenceWorker<Instance, Instance> {
public class InstHeartBeatPersistenceWorker extends PersistenceWorker<Instance> {
public InstHeartBeatPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
@ -44,11 +44,12 @@ public class InstHeartBeatPersistenceWorker extends PersistenceWorker<Instance,
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, Instance> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IInstanceHeartBeatPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<Instance, Instance, InstHeartBeatPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<Instance, InstHeartBeatPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -19,8 +19,8 @@
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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;
@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
/**
* @author peng-yongsheng
*/
public class MemoryMetricPersistenceWorker extends PersistenceWorker<MemoryMetric, MemoryMetric> {
public class MemoryMetricPersistenceWorker extends PersistenceWorker<MemoryMetric> {
public MemoryMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
@ -44,11 +44,12 @@ public class MemoryMetricPersistenceWorker extends PersistenceWorker<MemoryMetri
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, MemoryMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IMemoryMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<MemoryMetric, MemoryMetric, MemoryMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<MemoryMetric, MemoryMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -19,8 +19,8 @@
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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;
@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
/**
* @author peng-yongsheng
*/
public class MemoryPoolMetricPersistenceWorker extends PersistenceWorker<MemoryPoolMetric, MemoryPoolMetric> {
public class MemoryPoolMetricPersistenceWorker extends PersistenceWorker<MemoryPoolMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_METRIC_PERSISTENCE_WORKER_ID;
@ -44,11 +44,12 @@ public class MemoryPoolMetricPersistenceWorker extends PersistenceWorker<MemoryP
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, MemoryPoolMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<MemoryPoolMetric, MemoryPoolMetric, MemoryPoolMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<MemoryPoolMetric, MemoryPoolMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -16,12 +16,21 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker;
package org.apache.skywalking.apm.collector.analysis.metric.define;
/**
* @author peng-yongsheng
*/
public enum MetricSource {
Exit, Entry
Caller(0), Callee(1);
private final int value;
private MetricSource(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@ -21,7 +21,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.define.graph;
/**
* @author peng-yongsheng
*/
public class GraphIdDefine {
public class MetricGraphIdDefine {
public static final int SERVICE_REFERENCE_METRIC_GRAPH_ID = 400;
public static final int INSTANCE_REFERENCE_METRIC_GRAPH_ID = 401;
public static final int APPLICATION_REFERENCE_METRIC_GRAPH_ID = 402;

View File

@ -21,7 +21,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.define.graph;
/**
* @author peng-yongsheng
*/
public class WorkerIdDefine {
public class MetricWorkerIdDefine {
public static final int SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID = 400;
public static final int SERVICE_REFERENCE_METRIC_REMOTE_WORKER_ID = 401;
public static final int SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID = 402;

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -34,7 +34,7 @@ public class ApplicationComponentAggregationWorker extends AggregationWorker<App
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_COMPONENT_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_COMPONENT_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationComponent, ApplicationComponent, ApplicationComponentAggregationWorker> {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -42,9 +42,9 @@ public class ApplicationComponentGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class)
.addNode(new ApplicationComponentAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationComponentRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationComponentRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationComponentPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public class ApplicationComponentPersistenceWorker extends PersistenceWorker<ApplicationComponent, ApplicationComponent> {
public class ApplicationComponentPersistenceWorker extends PersistenceWorker<ApplicationComponent> {
public ApplicationComponentPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationComponent> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationComponent, ApplicationComponent, ApplicationComponentPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ApplicationComponent, ApplicationComponentPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ApplicationComponentRemoteWorker extends AbstractRemoteWorker<Appli
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_COMPONENT_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_COMPONENT_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationComponent applicationComponent) throws WorkerException {

View File

@ -20,7 +20,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.appl
import java.util.ArrayList;
import java.util.List;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.ExitSpanListener;
@ -73,7 +73,7 @@ public class ApplicationComponentSpanListener implements EntrySpanListener, Exit
}
@Override public void build() {
Graph<ApplicationComponent> graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class);
Graph<ApplicationComponent> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class);
applicationComponents.forEach(applicationComponent -> {
applicationComponent.setId(timeBucket + Const.ID_SPLIT + applicationComponent.getId());

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -34,7 +34,7 @@ public class ApplicationMappingAggregationWorker extends AggregationWorker<Appli
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_MAPPING_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_MAPPING_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationMapping, ApplicationMapping, ApplicationMappingAggregationWorker> {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -42,9 +42,9 @@ public class ApplicationMappingGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
.addNode(new ApplicationMappingAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationMappingRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.APPLICATION_MAPPING_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationMappingRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationMappingPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public class ApplicationMappingPersistenceWorker extends PersistenceWorker<ApplicationMapping, ApplicationMapping> {
public class ApplicationMappingPersistenceWorker extends PersistenceWorker<ApplicationMapping> {
ApplicationMappingPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_MAPPING_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_MAPPING_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationMapping> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationMapping, ApplicationMapping, ApplicationMappingPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ApplicationMapping, ApplicationMappingPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ApplicationMappingRemoteWorker extends AbstractRemoteWorker<Applica
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_MAPPING_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_MAPPING_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationMapping applicationMapping) throws WorkerException {

View File

@ -20,7 +20,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.appl
import java.util.LinkedList;
import java.util.List;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.FirstSpanListener;
@ -65,7 +65,7 @@ public class ApplicationMappingSpanListener implements FirstSpanListener, EntryS
@Override public void build() {
logger.debug("node mapping listener build");
Graph<ApplicationMapping> graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class);
Graph<ApplicationMapping> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class);
applicationMappings.forEach(applicationMapping -> {
applicationMapping.setId(timeBucket + Const.ID_SPLIT + applicationMapping.getId());
applicationMapping.setTimeBucket(timeBucket);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -36,7 +36,7 @@ public class ApplicationMetricAggregationWorker extends AggregationWorker<Applic
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_METRIC_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected ApplicationMetric transform(ApplicationReferenceMetric applicationReferenceMetric) {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -42,9 +42,9 @@ public class ApplicationMetricGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationReferenceMetric.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationReferenceMetric.class)
.addNode(new ApplicationMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationMetricRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.APPLICATION_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,17 +30,18 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public class ApplicationMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric, ApplicationMetric> {
public class ApplicationMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
public ApplicationMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_METRIC_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMetricPersistenceDAO.class);
}
@ -48,7 +49,7 @@ public class ApplicationMetricPersistenceWorker extends PersistenceWorker<Applic
return true;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationMetric, ApplicationMetric, ApplicationMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ApplicationMetricRemoteWorker extends AbstractRemoteWorker<Applicat
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_METRIC_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_METRIC_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationMetric applicationMetric) throws WorkerException {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.cache.CacheModule;
@ -46,7 +46,7 @@ public class ApplicationReferenceMetricAggregationWorker extends AggregationWork
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected ApplicationReferenceMetric transform(InstanceReferenceMetric instanceReferenceMetric) {

View File

@ -18,8 +18,8 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
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;
@ -46,21 +46,21 @@ public class ApplicationReferenceMetricGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
Graph<InstanceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class);
Graph<InstanceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class);
graph.addNode(new ApplicationReferenceMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ApplicationReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ApplicationReferenceMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<InstanceReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(GraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
.toFinder().findNode(WorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, InstanceReferenceMetric.class)
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, InstanceReferenceMetric.class)
.addNext(new NodeProcessor<InstanceReferenceMetric, InstanceReferenceMetric>() {
@Override public int id() {
return WorkerIdDefine.APPLICATION_REFERENCE_GRAPH_BRIDGE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_REFERENCE_GRAPH_BRIDGE_WORKER_ID;
}
@Override public void process(InstanceReferenceMetric instanceReferenceMetric,

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetricPersistenceWorker extends PersistenceWorker<ApplicationReferenceMetric, ApplicationReferenceMetric> {
public class ApplicationReferenceMetricPersistenceWorker extends PersistenceWorker<ApplicationReferenceMetric> {
public ApplicationReferenceMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ApplicationReferenceMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ApplicationReferenceMetric, ApplicationReferenceMetric, ApplicationReferenceMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ApplicationReferenceMetric, ApplicationReferenceMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ApplicationReferenceMetricRemoteWorker extends AbstractRemoteWorker
}
@Override public int id() {
return WorkerIdDefine.APPLICATION_REFERENCE_METRIC_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationReferenceMetric applicationReferenceMetric) throws WorkerException {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -38,7 +38,7 @@ public class GlobalTraceGraph {
}
public void create() {
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.GLOBAL_TRACE_GRAPH_ID, GlobalTrace.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.GLOBAL_TRACE_GRAPH_ID, GlobalTrace.class)
.addNode(new GlobalTracePersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.global.GlobalTrace;
/**
* @author peng-yongsheng
*/
public class GlobalTracePersistenceWorker extends PersistenceWorker<GlobalTrace, GlobalTrace> {
public class GlobalTracePersistenceWorker extends PersistenceWorker<GlobalTrace> {
public GlobalTracePersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.GLOBAL_TRACE_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.GLOBAL_TRACE_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, GlobalTrace> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IGlobalTracePersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<GlobalTrace, GlobalTrace, GlobalTracePersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<GlobalTrace, GlobalTracePersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -20,7 +20,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.glob
import java.util.ArrayList;
import java.util.List;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.FirstSpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.GlobalTraceIdsListener;
@ -69,7 +69,7 @@ public class GlobalTraceSpanListener implements FirstSpanListener, GlobalTraceId
@Override public void build() {
logger.debug("global trace listener build");
Graph<GlobalTrace> graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.GLOBAL_TRACE_GRAPH_ID, GlobalTrace.class);
Graph<GlobalTrace> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.GLOBAL_TRACE_GRAPH_ID, GlobalTrace.class);
for (String globalTraceId : globalTraceIds) {
GlobalTrace globalTrace = new GlobalTrace(segmentId + Const.ID_SPLIT + globalTraceId);
globalTrace.setGlobalTraceId(globalTraceId);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -36,7 +36,7 @@ public class InstanceMetricAggregationWorker extends AggregationWorker<InstanceR
}
@Override public int id() {
return WorkerIdDefine.INSTANCE_METRIC_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected InstanceMetric transform(InstanceReferenceMetric instanceReferenceMetric) {

View File

@ -18,8 +18,8 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
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;
@ -46,22 +46,22 @@ public class InstanceMetricGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
Graph<InstanceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.INSTANCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class);
Graph<InstanceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.INSTANCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class);
graph.addNode(new InstanceMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new InstanceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.INSTANCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new InstanceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.INSTANCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new InstanceMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<InstanceReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(GraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
.toFinder().findNode(WorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, InstanceReferenceMetric.class)
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, InstanceReferenceMetric.class)
.addNext(new NodeProcessor<InstanceReferenceMetric, InstanceReferenceMetric>() {
@Override public int id() {
return WorkerIdDefine.INSTANCE_METRIC_GRAPH_BRIDGE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_METRIC_GRAPH_BRIDGE_WORKER_ID;
}
@Override

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric
/**
* @author peng-yongsheng
*/
public class InstanceMetricPersistenceWorker extends PersistenceWorker<InstanceMetric, InstanceMetric> {
public class InstanceMetricPersistenceWorker extends PersistenceWorker<InstanceMetric> {
public InstanceMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.INSTANCE_METRIC_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, InstanceMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IInstanceMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<InstanceMetric, InstanceMetric, InstanceMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<InstanceMetric, InstanceMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class InstanceMetricRemoteWorker extends AbstractRemoteWorker<InstanceMet
}
@Override public int id() {
return WorkerIdDefine.INSTANCE_METRIC_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_METRIC_REMOTE_WORKER_ID;
}
@Override public Selector selector() {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -36,7 +36,7 @@ public class InstanceReferenceMetricAggregationWorker extends AggregationWorker<
}
@Override public int id() {
return WorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected InstanceReferenceMetric transform(ServiceReferenceMetric serviceReferenceMetric) {

View File

@ -18,8 +18,8 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
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;
@ -46,21 +46,21 @@ public class InstanceReferenceMetricGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
graph.addNode(new InstanceReferenceMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new InstanceReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new InstanceReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new InstanceReferencePersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<ServiceReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(GraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
.toFinder().findNode(WorkerIdDefine.SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, ServiceReferenceMetric.class)
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, ServiceReferenceMetric.class)
.addNext(new NodeProcessor<ServiceReferenceMetric, ServiceReferenceMetric>() {
@Override public int id() {
return WorkerIdDefine.INSTANCE_REFERENCE_GRAPH_BRIDGE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_REFERENCE_GRAPH_BRIDGE_WORKER_ID;
}
@Override

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class InstanceReferenceMetricRemoteWorker extends AbstractRemoteWorker<In
}
@Override public int id() {
return WorkerIdDefine.INSTANCE_REFERENCE_METRIC_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_REMOTE_WORKER_ID;
}
@Override public Selector selector() {

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,17 +30,18 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceRefere
/**
* @author peng-yongsheng
*/
public class InstanceReferencePersistenceWorker extends PersistenceWorker<InstanceReferenceMetric, InstanceReferenceMetric> {
public class InstanceReferencePersistenceWorker extends PersistenceWorker<InstanceReferenceMetric> {
public InstanceReferencePersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, InstanceReferenceMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IInstanceReferenceMetricPersistenceDAO.class);
}
@ -48,7 +49,7 @@ public class InstanceReferencePersistenceWorker extends PersistenceWorker<Instan
return true;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<InstanceReferenceMetric, InstanceReferenceMetric, InstanceReferencePersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<InstanceReferenceMetric, InstanceReferencePersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -38,7 +38,7 @@ public class SegmentCostGraph {
}
public void create() {
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.SEGMENT_COST_GRAPH_ID, SegmentCost.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.SEGMENT_COST_GRAPH_ID, SegmentCost.class)
.addNode(new SegmentCostPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.segment.SegmentCost;
/**
* @author peng-yongsheng
*/
public class SegmentCostPersistenceWorker extends PersistenceWorker<SegmentCost, SegmentCost> {
public class SegmentCostPersistenceWorker extends PersistenceWorker<SegmentCost> {
public SegmentCostPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.SEGMENT_COST_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.SEGMENT_COST_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, SegmentCost> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(ISegmentCostPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<SegmentCost, SegmentCost, SegmentCostPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<SegmentCost, SegmentCostPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -20,7 +20,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segm
import java.util.ArrayList;
import java.util.List;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.ExitSpanListener;
@ -96,7 +96,7 @@ public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListe
}
@Override public void build() {
Graph<SegmentCost> graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.SEGMENT_COST_GRAPH_ID, SegmentCost.class);
Graph<SegmentCost> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SEGMENT_COST_GRAPH_ID, SegmentCost.class);
logger.debug("segment cost listener build");
for (SegmentCost segmentCost : segmentCosts) {
segmentCost.setIsError(isError);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -34,7 +34,7 @@ public class ServiceEntryAggregationWorker extends AggregationWorker<ServiceEntr
}
@Override public int id() {
return WorkerIdDefine.SERVICE_ENTRY_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_ENTRY_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ServiceEntry, ServiceEntry, ServiceEntryAggregationWorker> {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -42,9 +42,9 @@ public class ServiceEntryGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.SERVICE_ENTRY_GRAPH_ID, ServiceEntry.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.SERVICE_ENTRY_GRAPH_ID, ServiceEntry.class)
.addNode(new ServiceEntryAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ServiceEntryRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.SERVICE_ENTRY_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceEntryRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.SERVICE_ENTRY_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceEntryPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.service.ServiceEntry;
/**
* @author peng-yongsheng
*/
public class ServiceEntryPersistenceWorker extends PersistenceWorker<ServiceEntry, ServiceEntry> {
public class ServiceEntryPersistenceWorker extends PersistenceWorker<ServiceEntry> {
public ServiceEntryPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.SERVICE_ENTRY_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_ENTRY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ServiceEntry> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IServiceEntryPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ServiceEntry, ServiceEntry, ServiceEntryPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ServiceEntry, ServiceEntryPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ServiceEntryRemoteWorker extends AbstractRemoteWorker<ServiceEntry,
}
@Override public int id() {
return WorkerIdDefine.SERVICE_ENTRY_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_ENTRY_REMOTE_WORKER_ID;
}
@Override protected void onWork(ServiceEntry serviceEntry) throws WorkerException {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.FirstSpanListener;
@ -83,7 +83,7 @@ public class ServiceEntrySpanListener implements FirstSpanListener, EntrySpanLis
serviceEntry.setNewestTime(timeBucket);
logger.debug("push to service entry aggregation worker, id: {}", serviceEntry.getId());
Graph<ServiceEntry> graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.SERVICE_ENTRY_GRAPH_ID, ServiceEntry.class);
Graph<ServiceEntry> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_ENTRY_GRAPH_ID, ServiceEntry.class);
graph.start(serviceEntry);
}
}

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -36,7 +36,7 @@ public class ServiceMetricAggregationWorker extends AggregationWorker<ServiceRef
}
@Override public int id() {
return WorkerIdDefine.SERVICE_METRIC_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected ServiceMetric transform(ServiceReferenceMetric serviceReferenceMetric) {

View File

@ -18,8 +18,8 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
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;
@ -46,21 +46,21 @@ public class ServiceMetricGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.SERVICE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.SERVICE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
graph.addNode(new ServiceMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ServiceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.SERVICE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.SERVICE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph<ServiceReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(GraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
.toFinder().findNode(WorkerIdDefine.SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, ServiceReferenceMetric.class)
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, ServiceReferenceMetric.class)
.addNext(new NodeProcessor<ServiceReferenceMetric, ServiceReferenceMetric>() {
@Override public int id() {
return WorkerIdDefine.SERVICE_METRIC_GRAPH_BRIDGE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_METRIC_GRAPH_BRIDGE_WORKER_ID;
}
@Override

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,17 +30,18 @@ import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric;
/**
* @author peng-yongsheng
*/
public class ServiceMetricPersistenceWorker extends PersistenceWorker<ServiceMetric, ServiceMetric> {
public class ServiceMetricPersistenceWorker extends PersistenceWorker<ServiceMetric> {
public ServiceMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.SERVICE_METRIC_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ServiceMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IServiceMetricPersistenceDAO.class);
}
@ -48,7 +49,7 @@ public class ServiceMetricPersistenceWorker extends PersistenceWorker<ServiceMet
return true;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ServiceMetric, ServiceMetric, ServiceMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ServiceMetric, ServiceMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ServiceMetricRemoteWorker extends AbstractRemoteWorker<ServiceMetri
}
@Override public int id() {
return WorkerIdDefine.SERVICE_METRIC_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_METRIC_REMOTE_WORKER_ID;
}
@Override protected void onWork(ServiceMetric serviceMetric) throws WorkerException {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -34,7 +34,7 @@ public class ServiceReferenceMetricAggregationWorker extends AggregationWorker<S
}
@Override public int id() {
return WorkerIdDefine.SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ServiceReferenceMetric, ServiceReferenceMetric, ServiceReferenceMetricAggregationWorker> {

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@ -42,9 +42,9 @@ public class ServiceReferenceMetricGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
.addNode(new ServiceReferenceMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
.addNext(new ServiceReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
.addNext(new ServiceReferenceMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}

View File

@ -18,9 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -30,25 +30,26 @@ import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenc
/**
* @author peng-yongsheng
*/
public class ServiceReferenceMetricPersistenceWorker extends PersistenceWorker<ServiceReferenceMetric, ServiceReferenceMetric> {
public class ServiceReferenceMetricPersistenceWorker extends PersistenceWorker<ServiceReferenceMetric> {
public ServiceReferenceMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, ServiceReferenceMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IServiceReferenceMetricPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<ServiceReferenceMetric, ServiceReferenceMetric, ServiceReferenceMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<ServiceReferenceMetric, ServiceReferenceMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);

View File

@ -18,7 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
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;
@ -37,7 +37,7 @@ public class ServiceReferenceMetricRemoteWorker extends AbstractRemoteWorker<Ser
}
@Override public int id() {
return WorkerIdDefine.SERVICE_REFERENCE_METRIC_REMOTE_WORKER_ID;
return MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_REMOTE_WORKER_ID;
}
@Override protected void onWork(ServiceReferenceMetric serviceReferenceMetric) throws WorkerException {

View File

@ -20,8 +20,8 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.serv
import java.util.LinkedList;
import java.util.List;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.MetricSource;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.MetricSource;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.ReferenceDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
@ -71,8 +71,8 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
serviceReferenceMetric.setFrontInstanceId(reference.getParentApplicationInstanceId());
serviceReferenceMetric.setBehindServiceId(spanDecorator.getOperationNameId());
serviceReferenceMetric.setBehindInstanceId(instanceId);
serviceReferenceMetric.setSourceValue(MetricSource.Entry.ordinal());
calculateCost(serviceReferenceMetric, spanDecorator, true);
serviceReferenceMetric.setSourceValue(MetricSource.Callee.getValue());
calculateDuration(serviceReferenceMetric, spanDecorator, true);
entryReferenceMetric.add(serviceReferenceMetric);
}
} else {
@ -83,9 +83,9 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
serviceReferenceMetric.setFrontInstanceId(instanceId);
serviceReferenceMetric.setBehindServiceId(spanDecorator.getOperationNameId());
serviceReferenceMetric.setBehindInstanceId(instanceId);
serviceReferenceMetric.setSourceValue(MetricSource.Entry.ordinal());
serviceReferenceMetric.setSourceValue(MetricSource.Callee.getValue());
calculateCost(serviceReferenceMetric, spanDecorator, false);
calculateDuration(serviceReferenceMetric, spanDecorator, false);
entryReferenceMetric.add(serviceReferenceMetric);
}
this.entrySpanDecorator = spanDecorator;
@ -96,47 +96,44 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
serviceReferenceMetric.setFrontInstanceId(instanceId);
serviceReferenceMetric.setBehindServiceId(spanDecorator.getOperationNameId());
serviceReferenceMetric.setSourceValue(MetricSource.Exit.ordinal());
calculateCost(serviceReferenceMetric, spanDecorator, true);
serviceReferenceMetric.setSourceValue(MetricSource.Caller.getValue());
calculateDuration(serviceReferenceMetric, spanDecorator, true);
exitReferenceMetric.add(serviceReferenceMetric);
}
private void calculateCost(ServiceReferenceMetric serviceReferenceMetric, SpanDecorator spanDecorator,
private void calculateDuration(ServiceReferenceMetric serviceReferenceMetric, SpanDecorator spanDecorator,
boolean hasReference) {
long duration = spanDecorator.getEndTime() - spanDecorator.getStartTime();
if (spanDecorator.getIsError()) {
serviceReferenceMetric.setTransactionErrorCalls(1L);
serviceReferenceMetric.setTransactionErrorDurationSum(duration);
} else {
serviceReferenceMetric.setTransactionCalls(1L);
serviceReferenceMetric.setTransactionDurationSum(duration);
}
serviceReferenceMetric.setTransactionCalls(1L);
serviceReferenceMetric.setTransactionDurationSum(duration);
if (hasReference) {
if (spanDecorator.getIsError()) {
serviceReferenceMetric.setBusinessTransactionErrorCalls(1L);
serviceReferenceMetric.setBusinessTransactionErrorDurationSum(duration);
} else {
serviceReferenceMetric.setBusinessTransactionCalls(1L);
serviceReferenceMetric.setBusinessTransactionDurationSum(duration);
}
serviceReferenceMetric.setBusinessTransactionCalls(1L);
serviceReferenceMetric.setBusinessTransactionDurationSum(duration);
}
if (SpanLayer.MQ.equals(spanDecorator.getSpanLayer())) {
if (spanDecorator.getIsError()) {
serviceReferenceMetric.setMqTransactionErrorCalls(1L);
serviceReferenceMetric.setMqTransactionErrorDurationSum(duration);
} else {
serviceReferenceMetric.setMqTransactionCalls(1L);
serviceReferenceMetric.setMqTransactionDurationSum(duration);
}
serviceReferenceMetric.setMqTransactionCalls(1L);
serviceReferenceMetric.setMqTransactionDurationSum(duration);
}
}
@Override public void build() {
logger.debug("service reference listener build");
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
Graph<ServiceReferenceMetric> graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class);
entryReferenceMetric.forEach(serviceReferenceMetric -> {
String id = timeBucket + Const.ID_SPLIT + serviceReferenceMetric.getEntryServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getFrontServiceId() + Const.ID_SPLIT + serviceReferenceMetric.getBehindServiceId();

View File

@ -19,8 +19,8 @@
package org.apache.skywalking.apm.collector.analysis.segment.parser.provider.parser;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
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;
@ -30,7 +30,7 @@ import org.apache.skywalking.apm.collector.storage.table.segment.Segment;
/**
* @author peng-yongsheng
*/
public class SegmentPersistenceWorker extends PersistenceWorker<Segment, Segment> {
public class SegmentPersistenceWorker extends PersistenceWorker<Segment> {
public SegmentPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
@ -44,11 +44,12 @@ public class SegmentPersistenceWorker extends PersistenceWorker<Segment, Segment
return false;
}
@Override protected IPersistenceDAO persistenceDAO() {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, Segment> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(ISegmentPersistenceDAO.class);
}
public static class Factory extends AbstractLocalAsyncWorkerProvider<Segment, Segment, SegmentPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<Segment, SegmentPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}

View File

@ -36,11 +36,11 @@ import org.slf4j.LoggerFactory;
/**
* @author peng-yongsheng
*/
public abstract class PersistenceWorker<INPUT extends Data, OUTPUT extends Data> extends AbstractLocalAsyncWorker<INPUT, OUTPUT> {
public abstract class PersistenceWorker<INPUT_AND_OUTPUT extends Data> extends AbstractLocalAsyncWorker<INPUT_AND_OUTPUT, INPUT_AND_OUTPUT> {
private final Logger logger = LoggerFactory.getLogger(PersistenceWorker.class);
private final DataCache<OUTPUT> dataCache;
private final DataCache<INPUT_AND_OUTPUT> dataCache;
private final IBatchDAO batchDAO;
public PersistenceWorker(ModuleManager moduleManager) {
@ -59,7 +59,7 @@ public abstract class PersistenceWorker<INPUT extends Data, OUTPUT extends Data>
}
}
@Override protected final void onWork(INPUT message) throws WorkerException {
@Override protected final void onWork(INPUT_AND_OUTPUT input) throws WorkerException {
if (dataCache.currentCollectionSize() >= 5000) {
try {
if (dataCache.trySwitchPointer()) {
@ -72,7 +72,7 @@ public abstract class PersistenceWorker<INPUT extends Data, OUTPUT extends Data>
dataCache.trySwitchPointerFinally();
}
}
aggregate(message);
aggregate(input);
}
public final List<?> buildBatchCollection() throws WorkerException {
@ -95,22 +95,24 @@ public abstract class PersistenceWorker<INPUT extends Data, OUTPUT extends Data>
return batchCollection;
}
protected final List<Object> prepareBatch(Map<String, OUTPUT> dataMap) {
private List<Object> prepareBatch(Map<String, INPUT_AND_OUTPUT> dataMap) {
List<Object> insertBatchCollection = new LinkedList<>();
List<Object> updateBatchCollection = new LinkedList<>();
dataMap.forEach((id, data) -> {
if (needMergeDBData()) {
Data dbData = persistenceDAO().get(id);
INPUT_AND_OUTPUT dbData = persistenceDAO().get(id);
if (ObjectUtils.isNotEmpty(dbData)) {
dbData.mergeData(data);
try {
updateBatchCollection.add(persistenceDAO().prepareBatchUpdate(dbData));
onNext(dbData);
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
} else {
try {
insertBatchCollection.add(persistenceDAO().prepareBatchInsert(data));
onNext(data);
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
@ -118,6 +120,7 @@ public abstract class PersistenceWorker<INPUT extends Data, OUTPUT extends Data>
} else {
try {
insertBatchCollection.add(persistenceDAO().prepareBatchInsert(data));
onNext(data);
} catch (Throwable t) {
logger.error(t.getMessage(), t);
}
@ -128,20 +131,18 @@ public abstract class PersistenceWorker<INPUT extends Data, OUTPUT extends Data>
return insertBatchCollection;
}
private void aggregate(Object message) {
private void aggregate(INPUT_AND_OUTPUT input) {
dataCache.writing();
OUTPUT newData = (OUTPUT)message;
if (dataCache.containsKey(newData.getId())) {
dataCache.get(newData.getId()).mergeData(newData);
if (dataCache.containsKey(input.getId())) {
dataCache.get(input.getId()).mergeData(input);
} else {
dataCache.put(newData.getId(), newData);
dataCache.put(input.getId(), input);
}
dataCache.finishWriting();
}
protected abstract IPersistenceDAO persistenceDAO();
protected abstract IPersistenceDAO<?, ?, INPUT_AND_OUTPUT> persistenceDAO();
protected abstract boolean needMergeDBData();
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.worker.model.impl;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
/**
* @author peng-yongsheng
*/
public abstract class PersistenceWorkerProvider<INPUT_AND_OUTPUT extends Data, WORKER_TYPE extends PersistenceWorker<INPUT_AND_OUTPUT>> extends AbstractLocalAsyncWorkerProvider<INPUT_AND_OUTPUT, INPUT_AND_OUTPUT, WORKER_TYPE> {
public PersistenceWorkerProvider(ModuleManager moduleManager) {
super(moduleManager);
}
}

View File

@ -16,10 +16,10 @@
*
*/
package org.apache.skywalking.apm.collector.configuration;
import org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService;
import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.core.module.Module;
/**
@ -34,6 +34,6 @@ public class ConfigurationModule extends Module {
}
@Override public Class[] services() {
return new Class[] {IApdexThresholdService.class};
return new Class[] {IApdexThresholdService.class, IServiceAlarmRuleConfig.class};
}
}

View File

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

View File

@ -16,15 +16,16 @@
*
*/
package org.apache.skywalking.apm.collector.configuration;
import java.util.Properties;
import org.apache.skywalking.apm.collector.configuration.service.ApdexThresholdService;
import org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService;
import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig;
import org.apache.skywalking.apm.collector.configuration.service.ServiceAlarmRuleConfig;
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;
import org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService;
import org.apache.skywalking.apm.collector.core.module.Module;
/**
* @author peng-yongsheng
@ -41,6 +42,7 @@ public class ConfigurationModuleProvider extends ModuleProvider {
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
this.registerServiceImplementation(IApdexThresholdService.class, new ApdexThresholdService());
this.registerServiceImplementation(IServiceAlarmRuleConfig.class, new ServiceAlarmRuleConfig());
}
@Override public void start(Properties config) throws ServiceNotProvidedException {

View File

@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.configuration.service;
/**
* @author peng-yongsheng
*/
public class ServiceAlarmRuleConfig implements IServiceAlarmRuleConfig {
@Override public double calleeErrorRateThreshold() {
return 10.00;
}
@Override public double calleeAverageResponseTimeThreshold() {
return 2000;
}
@Override public double callerErrorRateThreshold() {
return 10.00;
}
@Override public double callerAverageResponseTimeThreshold() {
return 3000;
}
}

View File

@ -0,0 +1,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.core.util;
import java.math.RoundingMode;
import java.text.NumberFormat;
/**
* @author peng-yongsheng
*/
public class NumberFormatUtils {
public static Double rateNumberFormat(Double rate) {
NumberFormat rateNumberFormat = NumberFormat.getNumberInstance();
rateNumberFormat.setMaximumFractionDigits(2);
rateNumberFormat.setMinimumFractionDigits(2);
rateNumberFormat.setRoundingMode(RoundingMode.HALF_UP);
Double formattedRate = Double.valueOf(rateNumberFormat.format(rate));
return Double.valueOf(formattedRate);
}
}

View File

@ -0,0 +1,40 @@
/*
* 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.core.util;
import org.junit.Assert;
import org.junit.Test;
/**
* @author peng-yongsheng
*/
public class NumberFormatUtilsTest {
@Test
public void testRateNumberFormat() {
Double rate = NumberFormatUtils.rateNumberFormat(12.1111);
Assert.assertEquals(rate, Double.valueOf(12.11));
rate = NumberFormatUtils.rateNumberFormat(12.1151);
Assert.assertEquals(rate, Double.valueOf(12.12));
rate = NumberFormatUtils.rateNumberFormat(12.1);
Assert.assertEquals(rate, Double.valueOf(12.1));
}
}

View File

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

View File

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

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table;
import org.apache.skywalking.apm.collector.core.data.CommonTable;
@ -25,6 +24,9 @@ import org.apache.skywalking.apm.collector.core.data.CommonTable;
* @author peng-yongsheng
*/
public abstract class CommonMetricTable extends CommonTable {
public static final String COLUMN_APPLICATION_ID = "application_id";
public static final String COLUMN_INSTANCE_ID = "instance_id";
public static final String COLUMN_SERVICE_ID = "service_id";
public static final String COLUMN_TRANSACTION_CALLS = "transaction_calls";
public static final String COLUMN_TRANSACTION_ERROR_CALLS = "transaction_error_calls";
public static final String COLUMN_TRANSACTION_DURATION_SUM = "transaction_duration_sum";

View File

@ -0,0 +1,81 @@
/*
* 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;
/**
* @author peng-yongsheng
*/
public interface Metric {
Integer getSourceValue();
void setSourceValue(Integer sourceValue);
Long getTimeBucket();
void setTimeBucket(Long timeBucket);
Long getTransactionCalls();
void setTransactionCalls(Long transactionCalls);
Long getTransactionErrorCalls();
void setTransactionErrorCalls(Long transactionErrorCalls);
Long getTransactionDurationSum();
void setTransactionDurationSum(Long transactionDurationSum);
Long getTransactionErrorDurationSum();
void setTransactionErrorDurationSum(Long transactionErrorDurationSum);
Long getBusinessTransactionCalls();
void setBusinessTransactionCalls(Long businessTransactionCalls);
Long getBusinessTransactionErrorCalls();
void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls);
Long getBusinessTransactionDurationSum();
void setBusinessTransactionDurationSum(Long businessTransactionDurationSum);
Long getBusinessTransactionErrorDurationSum();
void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum);
Long getMqTransactionCalls();
void setMqTransactionCalls(Long mqTransactionCalls);
Long getMqTransactionErrorCalls();
void setMqTransactionErrorCalls(Long mqTransactionErrorCalls);
Long getMqTransactionDurationSum();
void setMqTransactionDurationSum(Long mqTransactionDurationSum);
Long getMqTransactionErrorDurationSum();
void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum);
}

View File

@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.storage.table.alarm;
/**
* @author peng-yongsheng
*/
public interface Alarm {
Integer getAlarmType();
void setAlarmType(Integer alarmType);
Integer getSourceValue();
void setSourceValue(Integer sourceValue);
Long getLastTimeBucket();
void setLastTimeBucket(Long lastTimeBucket);
String getAlarmContent();
void setAlarmContent(String alarmContent);
}

View File

@ -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;
/**
* @author peng-yongsheng
*/
public enum AlarmType {
ERROR_RATE(0), SLOW_RTT(1);
private final int value;
private AlarmType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@ -16,8 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.alerting;
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;
@ -27,88 +26,96 @@ import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
/**
* @author peng-yongsheng
*/
public class AlertingList extends Data {
public class ServiceAlarm extends Data implements Alarm {
private static final Column[] STRING_COLUMNS = {
new Column(AlertingListTable.COLUMN_ID, new NonOperation()),
new Column(ServiceAlarmTable.COLUMN_ID, new NonOperation()),
new Column(ServiceAlarmTable.COLUMN_ALARM_CONTENT, new CoverOperation()),
};
private static final Column[] LONG_COLUMNS = {
new Column(AlertingListTable.COLUMN_FIRST_TIME_BUCKET, new NonOperation()),
new Column(AlertingListTable.COLUMN_LAST_TIME_BUCKET, new CoverOperation()),
new Column(ServiceAlarmTable.COLUMN_LAST_TIME_BUCKET, new CoverOperation()),
};
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(AlertingListTable.COLUMN_LAYER, new CoverOperation()),
new Column(AlertingListTable.COLUMN_LAYER_ID, new CoverOperation()),
new Column(AlertingListTable.COLUMN_EXPECTED, new CoverOperation()),
new Column(AlertingListTable.COLUMN_ACTUAL, new CoverOperation()),
new Column(ServiceAlarmTable.COLUMN_ALARM_TYPE, new NonOperation()),
new Column(ServiceAlarmTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ServiceAlarmTable.COLUMN_APPLICATION_ID, new NonOperation()),
new Column(ServiceAlarmTable.COLUMN_INSTANCE_ID, new NonOperation()),
new Column(ServiceAlarmTable.COLUMN_SERVICE_ID, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {
new Column(AlertingListTable.COLUMN_VALID, new CoverOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
private static final Column[] BYTE_COLUMNS = {};
public AlertingList(String id) {
public ServiceAlarm(String id) {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getLayer() {
@Override
public Integer getAlarmType() {
return getDataInteger(0);
}
public void setLayer(Integer layer) {
setDataInteger(0, layer);
@Override
public void setAlarmType(Integer alarmType) {
setDataInteger(0, alarmType);
}
public Integer getLayerId() {
@Override
public Integer getSourceValue() {
return getDataInteger(1);
}
public void setLayerId(Integer layerId) {
setDataInteger(1, layerId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(1, sourceValue);
}
public Integer getExpected() {
public Integer getApplicationId() {
return getDataInteger(2);
}
public void setExpected(Integer expected) {
setDataInteger(2, expected);
public void setApplicationId(Integer applicationId) {
setDataInteger(2, applicationId);
}
public Integer getActual() {
public Integer getInstanceId() {
return getDataInteger(3);
}
public void setActual(Integer actual) {
setDataInteger(3, actual);
public void setInstanceId(Integer instanceId) {
setDataInteger(3, instanceId);
}
public Long getFirstTimeBucket() {
public Integer getServiceId() {
return getDataInteger(4);
}
public void setServiceId(Integer serviceId) {
setDataInteger(4, serviceId);
}
@Override
public Long getLastTimeBucket() {
return getDataLong(0);
}
public void setFirstTimeBucket(Long firstTimeBucket) {
setDataLong(0, firstTimeBucket);
}
public Long getLastTimeBucket() {
return getDataLong(1);
}
@Override
public void setLastTimeBucket(Long lastTimeBucket) {
setDataLong(1, lastTimeBucket);
setDataLong(0, lastTimeBucket);
}
public Boolean getValid() {
return getDataBoolean(0);
@Override
public String getAlarmContent() {
return getDataString(1);
}
public void setValid(Boolean valid) {
setDataBoolean(0, valid);
@Override
public void setAlarmContent(String alarmContent) {
setDataString(1, alarmContent);
}
}

View File

@ -0,0 +1,113 @@
/*
* 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 ServiceAlarmList extends Data {
private static final Column[] STRING_COLUMNS = {
new Column(ServiceAlarmListTable.COLUMN_ID, new NonOperation()),
new Column(ServiceAlarmListTable.COLUMN_ALARM_CONTENT, new CoverOperation()),
};
private static final Column[] LONG_COLUMNS = {
new Column(ServiceAlarmListTable.COLUMN_TIME_BUCKET, new NonOperation()),
};
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ServiceAlarmListTable.COLUMN_ALARM_TYPE, new NonOperation()),
new Column(ServiceAlarmListTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ServiceAlarmListTable.COLUMN_APPLICATION_ID, new NonOperation()),
new Column(ServiceAlarmListTable.COLUMN_INSTANCE_ID, new NonOperation()),
new Column(ServiceAlarmListTable.COLUMN_SERVICE_ID, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
private static final Column[] BYTE_COLUMNS = {};
public ServiceAlarmList(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 getApplicationId() {
return getDataInteger(2);
}
public void setApplicationId(Integer applicationId) {
setDataInteger(2, applicationId);
}
public Integer getInstanceId() {
return getDataInteger(3);
}
public void setInstanceId(Integer instanceId) {
setDataInteger(3, instanceId);
}
public Integer getServiceId() {
return getDataInteger(4);
}
public void setServiceId(Integer serviceId) {
setDataInteger(4, serviceId);
}
public Long getTimeBucket() {
return getDataLong(0);
}
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
public String getAlarmContent() {
return getDataString(1);
}
public void setAlarmContent(String alarmContent) {
setDataString(1, alarmContent);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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 ServiceAlarmListTable extends CommonMetricTable {
public static final String TABLE = "service_alarm";
public static final String COLUMN_ALARM_TYPE = "alarm_type";
public static final String COLUMN_ALARM_CONTENT = "alarm_content";
}

View File

@ -16,21 +16,16 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.alarm;
package org.apache.skywalking.apm.collector.storage.table.alerting;
import org.apache.skywalking.apm.collector.core.data.CommonTable;
import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
/**
* @author peng-yongsheng
*/
public class AlertingListTable extends CommonTable {
public static final String TABLE = "alerting_list";
public static final String COLUMN_LAYER = "layer";
public static final String COLUMN_LAYER_ID = "layer_id";
public static final String COLUMN_FIRST_TIME_BUCKET = "first_time_bucket";
public class ServiceAlarmTable extends CommonMetricTable {
public static final String TABLE = "service_alarm";
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_EXPECTED = "expected";
public static final String COLUMN_ACTUAL = "actual";
public static final String COLUMN_VALID = "valid";
public static final String COLUMN_ALARM_CONTENT = "alarm_content";
}

View File

@ -16,19 +16,18 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.application;
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;
import org.apache.skywalking.apm.collector.core.data.operator.AddOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
import org.apache.skywalking.apm.collector.storage.table.Metric;
/**
* @author peng-yongsheng
*/
public class ApplicationMetric extends Data {
public class ApplicationMetric extends Data implements Metric {
private static final Column[] STRING_COLUMNS = {
new Column(ApplicationMetricTable.COLUMN_ID, new NonOperation()),
@ -57,7 +56,8 @@ public class ApplicationMetric extends Data {
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ApplicationMetricTable.COLUMN_APPLICATION_ID, new CoverOperation()),
new Column(ApplicationMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ApplicationMetricTable.COLUMN_APPLICATION_ID, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
@ -68,114 +68,150 @@ public class ApplicationMetric extends Data {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public int getApplicationId() {
@Override
public Integer getSourceValue() {
return getDataInteger(0);
}
public void setApplicationId(int applicationId) {
setDataInteger(0, applicationId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(0, sourceValue);
}
public int getApplicationId() {
return getDataInteger(1);
}
public void setApplicationId(int applicationId) {
setDataInteger(1, applicationId);
}
@Override
public Long getTimeBucket() {
return getDataLong(0);
}
@Override
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
@Override
public Long getTransactionCalls() {
return getDataLong(1);
}
@Override
public void setTransactionCalls(Long transactionCalls) {
setDataLong(1, transactionCalls);
}
@Override
public Long getTransactionErrorCalls() {
return getDataLong(2);
}
@Override
public void setTransactionErrorCalls(Long transactionErrorCalls) {
setDataLong(2, transactionErrorCalls);
}
@Override
public Long getTransactionDurationSum() {
return getDataLong(3);
}
@Override
public void setTransactionDurationSum(Long transactionDurationSum) {
setDataLong(3, transactionDurationSum);
}
@Override
public Long getTransactionErrorDurationSum() {
return getDataLong(4);
}
@Override
public void setTransactionErrorDurationSum(Long transactionErrorDurationSum) {
setDataLong(4, transactionErrorDurationSum);
}
@Override
public Long getBusinessTransactionCalls() {
return getDataLong(5);
}
@Override
public void setBusinessTransactionCalls(Long businessTransactionCalls) {
setDataLong(5, businessTransactionCalls);
}
@Override
public Long getBusinessTransactionErrorCalls() {
return getDataLong(6);
}
@Override
public void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls) {
setDataLong(6, businessTransactionErrorCalls);
}
@Override
public Long getBusinessTransactionDurationSum() {
return getDataLong(7);
}
@Override
public void setBusinessTransactionDurationSum(Long businessTransactionDurationSum) {
setDataLong(7, businessTransactionDurationSum);
}
@Override
public Long getBusinessTransactionErrorDurationSum() {
return getDataLong(8);
}
@Override
public void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum) {
setDataLong(8, businessTransactionErrorDurationSum);
}
@Override
public Long getMqTransactionCalls() {
return getDataLong(9);
}
@Override
public void setMqTransactionCalls(Long mqTransactionCalls) {
setDataLong(9, mqTransactionCalls);
}
@Override
public Long getMqTransactionErrorCalls() {
return getDataLong(10);
}
@Override
public void setMqTransactionErrorCalls(Long mqTransactionErrorCalls) {
setDataLong(10, mqTransactionErrorCalls);
}
@Override
public Long getMqTransactionDurationSum() {
return getDataLong(11);
}
@Override
public void setMqTransactionDurationSum(Long mqTransactionDurationSum) {
setDataLong(11, mqTransactionDurationSum);
}
@Override
public Long getMqTransactionErrorDurationSum() {
return getDataLong(12);
}
@Override
public void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum) {
setDataLong(12, mqTransactionErrorDurationSum);
}

View File

@ -16,39 +16,38 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.application;
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.NonOperation;
import org.apache.skywalking.apm.collector.core.data.operator.AddOperation;
import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
import org.apache.skywalking.apm.collector.storage.table.Metric;
/**
* @author peng-yongsheng
*/
public class ApplicationReferenceMetric extends Data {
public class ApplicationReferenceMetric extends Data implements Metric {
private static final Column[] STRING_COLUMNS = {
new Column(ApplicationReferenceMetricTable.COLUMN_ID, new NonOperation()),
};
private static final Column[] LONG_COLUMNS = {
new Column(InstanceMetricTable.COLUMN_TIME_BUCKET, new NonOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET, new NonOperation()),
new Column(InstanceMetricTable.COLUMN_TRANSACTION_CALLS, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, new AddOperation()),
new Column(InstanceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_CALLS, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_CALLS, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_SATISFIED_COUNT, new AddOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_TOLERATING_COUNT, new AddOperation()),
@ -57,6 +56,7 @@ public class ApplicationReferenceMetric extends Data {
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ApplicationReferenceMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()),
new Column(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()),
};
@ -69,122 +69,158 @@ public class ApplicationReferenceMetric extends Data {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getFrontApplicationId() {
@Override
public Integer getSourceValue() {
return getDataInteger(0);
}
public void setFrontApplicationId(Integer frontApplicationId) {
setDataInteger(0, frontApplicationId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(0, sourceValue);
}
public Integer getBehindApplicationId() {
public Integer getFrontApplicationId() {
return getDataInteger(1);
}
public void setBehindApplicationId(Integer behindApplicationId) {
setDataInteger(1, behindApplicationId);
public void setFrontApplicationId(Integer frontApplicationId) {
setDataInteger(1, frontApplicationId);
}
public Integer getBehindApplicationId() {
return getDataInteger(2);
}
public void setBehindApplicationId(Integer behindApplicationId) {
setDataInteger(2, behindApplicationId);
}
@Override
public Long getTimeBucket() {
return getDataLong(0);
}
@Override
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
@Override
public Long getTransactionCalls() {
return getDataLong(1);
}
@Override
public void setTransactionCalls(Long transactionCalls) {
setDataLong(1, transactionCalls);
}
@Override
public Long getTransactionErrorCalls() {
return getDataLong(2);
}
@Override
public void setTransactionErrorCalls(Long transactionErrorCalls) {
setDataLong(2, transactionErrorCalls);
}
@Override
public Long getTransactionDurationSum() {
return getDataLong(3);
}
@Override
public void setTransactionDurationSum(Long transactionDurationSum) {
setDataLong(3, transactionDurationSum);
}
@Override
public Long getTransactionErrorDurationSum() {
return getDataLong(4);
}
@Override
public void setTransactionErrorDurationSum(Long transactionErrorDurationSum) {
setDataLong(4, transactionErrorDurationSum);
}
@Override
public Long getBusinessTransactionCalls() {
return getDataLong(5);
}
@Override
public void setBusinessTransactionCalls(Long businessTransactionCalls) {
setDataLong(5, businessTransactionCalls);
}
@Override
public Long getBusinessTransactionErrorCalls() {
return getDataLong(6);
}
@Override
public void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls) {
setDataLong(6, businessTransactionErrorCalls);
}
@Override
public Long getBusinessTransactionDurationSum() {
return getDataLong(7);
}
@Override
public void setBusinessTransactionDurationSum(Long businessTransactionDurationSum) {
setDataLong(7, businessTransactionDurationSum);
}
@Override
public Long getBusinessTransactionErrorDurationSum() {
return getDataLong(8);
}
@Override
public void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum) {
setDataLong(8, businessTransactionErrorDurationSum);
}
@Override
public Long getMqTransactionCalls() {
return getDataLong(9);
}
@Override
public void setMqTransactionCalls(Long mqTransactionCalls) {
setDataLong(9, mqTransactionCalls);
}
@Override
public Long getMqTransactionErrorCalls() {
return getDataLong(10);
}
@Override
public void setMqTransactionErrorCalls(Long mqTransactionErrorCalls) {
setDataLong(10, mqTransactionErrorCalls);
}
@Override
public Long getMqTransactionDurationSum() {
return getDataLong(11);
}
@Override
public void setMqTransactionDurationSum(Long mqTransactionDurationSum) {
setDataLong(11, mqTransactionDurationSum);
}
@Override
public Long getMqTransactionErrorDurationSum() {
return getDataLong(12);
}
@Override
public void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum) {
setDataLong(12, mqTransactionErrorDurationSum);
}

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.instance;
import org.apache.skywalking.apm.collector.core.data.Column;
@ -24,11 +23,12 @@ import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.data.operator.AddOperation;
import org.apache.skywalking.apm.collector.core.data.operator.CoverOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
import org.apache.skywalking.apm.collector.storage.table.Metric;
/**
* @author peng-yongsheng
*/
public class InstanceMetric extends Data {
public class InstanceMetric extends Data implements Metric {
private static final Column[] STRING_COLUMNS = {
new Column(InstanceMetricTable.COLUMN_ID, new NonOperation()),
@ -54,6 +54,7 @@ public class InstanceMetric extends Data {
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(InstanceMetricTable.COLUMN_SOURCE_VALUE, new CoverOperation()),
new Column(InstanceMetricTable.COLUMN_APPLICATION_ID, new CoverOperation()),
new Column(InstanceMetricTable.COLUMN_INSTANCE_ID, new CoverOperation()),
};
@ -65,122 +66,158 @@ public class InstanceMetric extends Data {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getApplicationId() {
@Override
public Integer getSourceValue() {
return getDataInteger(0);
}
public void setApplicationId(Integer applicationId) {
setDataInteger(0, applicationId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(0, sourceValue);
}
public Integer getInstanceId() {
public Integer getApplicationId() {
return getDataInteger(1);
}
public void setInstanceId(Integer instanceId) {
setDataInteger(1, instanceId);
public void setApplicationId(Integer applicationId) {
setDataInteger(1, applicationId);
}
public Integer getInstanceId() {
return getDataInteger(2);
}
public void setInstanceId(Integer instanceId) {
setDataInteger(2, instanceId);
}
@Override
public Long getTimeBucket() {
return getDataLong(0);
}
@Override
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
@Override
public Long getTransactionCalls() {
return getDataLong(1);
}
@Override
public void setTransactionCalls(Long transactionCalls) {
setDataLong(1, transactionCalls);
}
@Override
public Long getTransactionErrorCalls() {
return getDataLong(2);
}
@Override
public void setTransactionErrorCalls(Long transactionErrorCalls) {
setDataLong(2, transactionErrorCalls);
}
@Override
public Long getTransactionDurationSum() {
return getDataLong(3);
}
@Override
public void setTransactionDurationSum(Long transactionDurationSum) {
setDataLong(3, transactionDurationSum);
}
@Override
public Long getTransactionErrorDurationSum() {
return getDataLong(4);
}
@Override
public void setTransactionErrorDurationSum(Long transactionErrorDurationSum) {
setDataLong(4, transactionErrorDurationSum);
}
@Override
public Long getBusinessTransactionCalls() {
return getDataLong(5);
}
@Override
public void setBusinessTransactionCalls(Long businessTransactionCalls) {
setDataLong(5, businessTransactionCalls);
}
@Override
public Long getBusinessTransactionErrorCalls() {
return getDataLong(6);
}
@Override
public void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls) {
setDataLong(6, businessTransactionErrorCalls);
}
@Override
public Long getBusinessTransactionDurationSum() {
return getDataLong(7);
}
@Override
public void setBusinessTransactionDurationSum(Long businessTransactionDurationSum) {
setDataLong(7, businessTransactionDurationSum);
}
@Override
public Long getBusinessTransactionErrorDurationSum() {
return getDataLong(8);
}
@Override
public void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum) {
setDataLong(8, businessTransactionErrorDurationSum);
}
@Override
public Long getMqTransactionCalls() {
return getDataLong(9);
}
@Override
public void setMqTransactionCalls(Long mqTransactionCalls) {
setDataLong(9, mqTransactionCalls);
}
@Override
public Long getMqTransactionErrorCalls() {
return getDataLong(10);
}
@Override
public void setMqTransactionErrorCalls(Long mqTransactionErrorCalls) {
setDataLong(10, mqTransactionErrorCalls);
}
@Override
public Long getMqTransactionDurationSum() {
return getDataLong(11);
}
@Override
public void setMqTransactionDurationSum(Long mqTransactionDurationSum) {
setDataLong(11, mqTransactionDurationSum);
}
@Override
public Long getMqTransactionErrorDurationSum() {
return getDataLong(12);
}
@Override
public void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum) {
setDataLong(12, mqTransactionErrorDurationSum);
}

View File

@ -16,18 +16,18 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.instance;
import org.apache.skywalking.apm.collector.core.data.Data;
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.AddOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
import org.apache.skywalking.apm.collector.storage.table.Metric;
/**
* @author peng-yongsheng
*/
public class InstanceReferenceMetric extends Data {
public class InstanceReferenceMetric extends Data implements Metric {
private static final Column[] STRING_COLUMNS = {
new Column(InstanceReferenceMetricTable.COLUMN_ID, new NonOperation()),
@ -53,9 +53,11 @@ public class InstanceReferenceMetric extends Data {
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(InstanceReferenceMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(InstanceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()),
new Column(InstanceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()),
new Column(InstanceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, new NonOperation()),
new Column(InstanceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, new NonOperation()),
new Column(InstanceReferenceMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
@ -66,130 +68,174 @@ public class InstanceReferenceMetric extends Data {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getFrontInstanceId() {
@Override
public Integer getSourceValue() {
return getDataInteger(0);
}
public void setFrontInstanceId(Integer frontInstanceId) {
setDataInteger(0, frontInstanceId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(0, sourceValue);
}
public Integer getBehindInstanceId() {
public Integer getFrontApplicationId() {
return getDataInteger(1);
}
public void setBehindInstanceId(Integer behindInstanceId) {
setDataInteger(1, behindInstanceId);
public void setFrontApplicationId(Integer frontApplicationId) {
setDataInteger(1, frontApplicationId);
}
public Integer getSourceValue() {
public Integer getBehindApplicationId() {
return getDataInteger(2);
}
public void setSourceValue(Integer sourceValue) {
setDataInteger(2, sourceValue);
public void setBehindApplicationId(Integer behindApplicationId) {
setDataInteger(2, behindApplicationId);
}
public Integer getFrontInstanceId() {
return getDataInteger(3);
}
public void setFrontInstanceId(Integer frontInstanceId) {
setDataInteger(3, frontInstanceId);
}
public Integer getBehindInstanceId() {
return getDataInteger(4);
}
public void setBehindInstanceId(Integer behindInstanceId) {
setDataInteger(4, behindInstanceId);
}
@Override
public Long getTimeBucket() {
return getDataLong(0);
}
@Override
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
@Override
public Long getTransactionCalls() {
return getDataLong(1);
}
@Override
public void setTransactionCalls(Long transactionCalls) {
setDataLong(1, transactionCalls);
}
@Override
public Long getTransactionErrorCalls() {
return getDataLong(2);
}
@Override
public void setTransactionErrorCalls(Long transactionErrorCalls) {
setDataLong(2, transactionErrorCalls);
}
@Override
public Long getTransactionDurationSum() {
return getDataLong(3);
}
@Override
public void setTransactionDurationSum(Long transactionDurationSum) {
setDataLong(3, transactionDurationSum);
}
@Override
public Long getTransactionErrorDurationSum() {
return getDataLong(4);
}
@Override
public void setTransactionErrorDurationSum(Long transactionErrorDurationSum) {
setDataLong(4, transactionErrorDurationSum);
}
@Override
public Long getBusinessTransactionCalls() {
return getDataLong(5);
}
@Override
public void setBusinessTransactionCalls(Long businessTransactionCalls) {
setDataLong(5, businessTransactionCalls);
}
@Override
public Long getBusinessTransactionErrorCalls() {
return getDataLong(6);
}
@Override
public void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls) {
setDataLong(6, businessTransactionErrorCalls);
}
@Override
public Long getBusinessTransactionDurationSum() {
return getDataLong(7);
}
@Override
public void setBusinessTransactionDurationSum(Long businessTransactionDurationSum) {
setDataLong(7, businessTransactionDurationSum);
}
@Override
public Long getBusinessTransactionErrorDurationSum() {
return getDataLong(8);
}
@Override
public void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum) {
setDataLong(8, businessTransactionErrorDurationSum);
}
@Override
public Long getMqTransactionCalls() {
return getDataLong(9);
}
@Override
public void setMqTransactionCalls(Long mqTransactionCalls) {
setDataLong(9, mqTransactionCalls);
}
@Override
public Long getMqTransactionErrorCalls() {
return getDataLong(10);
}
@Override
public void setMqTransactionErrorCalls(Long mqTransactionErrorCalls) {
setDataLong(10, mqTransactionErrorCalls);
}
@Override
public Long getMqTransactionDurationSum() {
return getDataLong(11);
}
@Override
public void setMqTransactionDurationSum(Long mqTransactionDurationSum) {
setDataLong(11, mqTransactionDurationSum);
}
@Override
public Long getMqTransactionErrorDurationSum() {
return getDataLong(12);
}
@Override
public void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum) {
setDataLong(12, mqTransactionErrorDurationSum);
}

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.instance;
import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
@ -28,4 +27,6 @@ public class InstanceReferenceMetricTable extends CommonMetricTable {
public static final String TABLE = "instance_reference_metric";
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";
}

View File

@ -16,18 +16,18 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.service;
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.NonOperation;
import org.apache.skywalking.apm.collector.core.data.operator.AddOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
import org.apache.skywalking.apm.collector.storage.table.Metric;
/**
* @author peng-yongsheng
*/
public class ServiceMetric extends Data {
public class ServiceMetric extends Data implements Metric {
private static final Column[] STRING_COLUMNS = {
new Column(ServiceMetricTable.COLUMN_ID, new NonOperation()),
@ -53,6 +53,9 @@ public class ServiceMetric extends Data {
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ServiceMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ServiceMetricTable.COLUMN_APPLICATION_ID, new NonOperation()),
new Column(ServiceMetricTable.COLUMN_INSTANCE_ID, new NonOperation()),
new Column(ServiceMetricTable.COLUMN_SERVICE_ID, new NonOperation()),
};
@ -64,114 +67,166 @@ public class ServiceMetric extends Data {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getServiceId() {
@Override
public Integer getSourceValue() {
return getDataInteger(0);
}
public void setServiceId(Integer serviceId) {
setDataInteger(0, serviceId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(0, sourceValue);
}
public Integer getApplicationId() {
return getDataInteger(1);
}
public void setApplicationId(Integer applicationId) {
setDataInteger(1, applicationId);
}
public Integer getInstanceId() {
return getDataInteger(2);
}
public void setInstanceId(Integer instanceId) {
setDataInteger(2, instanceId);
}
public Integer getServiceId() {
return getDataInteger(3);
}
public void setServiceId(Integer serviceId) {
setDataInteger(3, serviceId);
}
@Override
public Long getTimeBucket() {
return getDataLong(0);
}
@Override
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
@Override
public Long getTransactionCalls() {
return getDataLong(1);
}
@Override
public void setTransactionCalls(Long transactionCalls) {
setDataLong(1, transactionCalls);
}
@Override
public Long getTransactionErrorCalls() {
return getDataLong(2);
}
@Override
public void setTransactionErrorCalls(Long transactionErrorCalls) {
setDataLong(2, transactionErrorCalls);
}
@Override
public Long getTransactionDurationSum() {
return getDataLong(3);
}
@Override
public void setTransactionDurationSum(Long transactionDurationSum) {
setDataLong(3, transactionDurationSum);
}
@Override
public Long getTransactionErrorDurationSum() {
return getDataLong(4);
}
@Override
public void setTransactionErrorDurationSum(Long transactionErrorDurationSum) {
setDataLong(4, transactionErrorDurationSum);
}
@Override
public Long getBusinessTransactionCalls() {
return getDataLong(5);
}
@Override
public void setBusinessTransactionCalls(Long businessTransactionCalls) {
setDataLong(5, businessTransactionCalls);
}
@Override
public Long getBusinessTransactionErrorCalls() {
return getDataLong(6);
}
@Override
public void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls) {
setDataLong(6, businessTransactionErrorCalls);
}
@Override
public Long getBusinessTransactionDurationSum() {
return getDataLong(7);
}
@Override
public void setBusinessTransactionDurationSum(Long businessTransactionDurationSum) {
setDataLong(7, businessTransactionDurationSum);
}
@Override
public Long getBusinessTransactionErrorDurationSum() {
return getDataLong(8);
}
@Override
public void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum) {
setDataLong(8, businessTransactionErrorDurationSum);
}
@Override
public Long getMqTransactionCalls() {
return getDataLong(9);
}
@Override
public void setMqTransactionCalls(Long mqTransactionCalls) {
setDataLong(9, mqTransactionCalls);
}
@Override
public Long getMqTransactionErrorCalls() {
return getDataLong(10);
}
@Override
public void setMqTransactionErrorCalls(Long mqTransactionErrorCalls) {
setDataLong(10, mqTransactionErrorCalls);
}
@Override
public Long getMqTransactionDurationSum() {
return getDataLong(11);
}
@Override
public void setMqTransactionDurationSum(Long mqTransactionDurationSum) {
setDataLong(11, mqTransactionDurationSum);
}
@Override
public Long getMqTransactionErrorDurationSum() {
return getDataLong(12);
}
@Override
public void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum) {
setDataLong(12, mqTransactionErrorDurationSum);
}

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.service;
import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
@ -26,5 +25,4 @@ import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
*/
public class ServiceMetricTable extends CommonMetricTable {
public static final String TABLE = "service_metric";
public static final String COLUMN_SERVICE_ID = "service_id";
}

View File

@ -16,18 +16,18 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.service;
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.AddOperation;
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
import org.apache.skywalking.apm.collector.storage.table.Metric;
/**
* @author peng-yongsheng
*/
public class ServiceReferenceMetric extends Data {
public class ServiceReferenceMetric extends Data implements Metric {
private static final Column[] STRING_COLUMNS = {
new Column(ServiceReferenceMetricTable.COLUMN_ID, new NonOperation()),
@ -53,15 +53,16 @@ public class ServiceReferenceMetric extends Data {
private static final Column[] DOUBLE_COLUMNS = {};
private static final Column[] INTEGER_COLUMNS = {
new Column(ServiceReferenceMetricTable.COLUMN_ENTRY_SERVICE_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_FRONT_SERVICE_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_BEHIND_SERVICE_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_ENTRY_INSTANCE_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_FRONT_INSTANCE_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_BEHIND_INSTANCE_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_SOURCE_VALUE, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID, new NonOperation()),
new Column(ServiceReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID, new NonOperation()),
};
private static final Column[] BOOLEAN_COLUMNS = {};
@ -72,12 +73,14 @@ public class ServiceReferenceMetric extends Data {
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
}
public Integer getEntryServiceId() {
@Override
public Integer getSourceValue() {
return getDataInteger(0);
}
public void setEntryServiceId(Integer entryServiceId) {
setDataInteger(0, entryServiceId);
@Override
public void setSourceValue(Integer sourceValue) {
setDataInteger(0, sourceValue);
}
public Integer getFrontServiceId() {
@ -96,138 +99,164 @@ public class ServiceReferenceMetric extends Data {
setDataInteger(2, behindServiceId);
}
public Integer getEntryInstanceId() {
public Integer getFrontInstanceId() {
return getDataInteger(3);
}
public void setEntryInstanceId(Integer entryInstanceId) {
setDataInteger(3, entryInstanceId);
}
public Integer getFrontInstanceId() {
return getDataInteger(4);
}
public void setFrontInstanceId(Integer frontInstanceId) {
setDataInteger(4, frontInstanceId);
setDataInteger(3, frontInstanceId);
}
public Integer getBehindInstanceId() {
return getDataInteger(5);
return getDataInteger(4);
}
public void setBehindInstanceId(Integer behindInstanceId) {
setDataInteger(5, behindInstanceId);
setDataInteger(4, behindInstanceId);
}
public Integer getSourceValue() {
public Integer getFrontApplicationId() {
return getDataInteger(5);
}
public void setFrontApplicationId(Integer frontApplicationId) {
setDataInteger(5, frontApplicationId);
}
public Integer getBehindApplicationId() {
return getDataInteger(6);
}
public void setSourceValue(Integer sourceValue) {
setDataInteger(6, sourceValue);
public void setBehindApplicationId(Integer behindApplicationId) {
setDataInteger(6, behindApplicationId);
}
@Override
public Long getTimeBucket() {
return getDataLong(0);
}
@Override
public void setTimeBucket(Long timeBucket) {
setDataLong(0, timeBucket);
}
@Override
public Long getTransactionCalls() {
return getDataLong(1);
}
@Override
public void setTransactionCalls(Long transactionCalls) {
setDataLong(1, transactionCalls);
}
@Override
public Long getTransactionErrorCalls() {
return getDataLong(2);
}
@Override
public void setTransactionErrorCalls(Long transactionErrorCalls) {
setDataLong(2, transactionErrorCalls);
}
@Override
public Long getTransactionDurationSum() {
return getDataLong(3);
}
@Override
public void setTransactionDurationSum(Long transactionDurationSum) {
setDataLong(3, transactionDurationSum);
}
@Override
public Long getTransactionErrorDurationSum() {
return getDataLong(4);
}
@Override
public void setTransactionErrorDurationSum(Long transactionErrorDurationSum) {
setDataLong(4, transactionErrorDurationSum);
}
@Override
public Long getBusinessTransactionCalls() {
return getDataLong(5);
}
@Override
public void setBusinessTransactionCalls(Long businessTransactionCalls) {
setDataLong(5, businessTransactionCalls);
}
@Override
public Long getBusinessTransactionErrorCalls() {
return getDataLong(6);
}
@Override
public void setBusinessTransactionErrorCalls(Long businessTransactionErrorCalls) {
setDataLong(6, businessTransactionErrorCalls);
}
@Override
public Long getBusinessTransactionDurationSum() {
return getDataLong(7);
}
@Override
public void setBusinessTransactionDurationSum(Long businessTransactionDurationSum) {
setDataLong(7, businessTransactionDurationSum);
}
@Override
public Long getBusinessTransactionErrorDurationSum() {
return getDataLong(8);
}
@Override
public void setBusinessTransactionErrorDurationSum(Long businessTransactionErrorDurationSum) {
setDataLong(8, businessTransactionErrorDurationSum);
}
@Override
public Long getMqTransactionCalls() {
return getDataLong(9);
}
@Override
public void setMqTransactionCalls(Long mqTransactionCalls) {
setDataLong(9, mqTransactionCalls);
}
@Override
public Long getMqTransactionErrorCalls() {
return getDataLong(10);
}
@Override
public void setMqTransactionErrorCalls(Long mqTransactionErrorCalls) {
setDataLong(10, mqTransactionErrorCalls);
}
@Override
public Long getMqTransactionDurationSum() {
return getDataLong(11);
}
@Override
public void setMqTransactionDurationSum(Long mqTransactionDurationSum) {
setDataLong(11, mqTransactionDurationSum);
}
@Override
public Long getMqTransactionErrorDurationSum() {
return getDataLong(12);
}
@Override
public void setMqTransactionErrorDurationSum(Long mqTransactionErrorDurationSum) {
setDataLong(12, mqTransactionErrorDurationSum);
}

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.collector.storage.table.service;
import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
@ -26,10 +25,10 @@ import org.apache.skywalking.apm.collector.storage.table.CommonMetricTable;
*/
public class ServiceReferenceMetricTable extends CommonMetricTable {
public static final String TABLE = "service_reference_metric";
public static final String COLUMN_ENTRY_SERVICE_ID = "entry_service_id";
public static final String COLUMN_ENTRY_INSTANCE_ID = "entry_instance_id";
public static final String COLUMN_FRONT_SERVICE_ID = "front_service_id";
public static final String COLUMN_FRONT_INSTANCE_ID = "front_instance_id";
public static final String COLUMN_FRONT_APPLICATION_ID = "front_application_id";
public static final String COLUMN_BEHIND_SERVICE_ID = "behind_service_id";
public static final String COLUMN_BEHIND_INSTANCE_ID = "behind_instance_id";
public static final String COLUMN_BEHIND_APPLICATION_ID = "behind_application_id";
}

View File

@ -30,8 +30,8 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
import org.apache.skywalking.apm.collector.storage.dao.IAlertingListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alerting.AlertingList;
import org.apache.skywalking.apm.collector.storage.table.alerting.AlertingListTable;
import org.apache.skywalking.apm.collector.storage.table.alarm.AlertingList;
import org.apache.skywalking.apm.collector.storage.table.alarm.AlertingListTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Some files were not shown because too many files have changed in this diff Show More