未验证 提交 973ad9e3 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Support time bucket transfer for all indicators. (#1664)

* Add transfer time bucket methods.

* prepare to merge

* Support time bucket transfer.
上级 23b8d6ef
......@@ -240,6 +240,18 @@ public class RunningRuleTest {
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public int getValue() {
return value;
}
......
......@@ -78,7 +78,6 @@ public class AllDispatcher implements SourceDispatcher<All> {
indicator.combine(source.getLatency(), 10);
IndicatorProcess.INSTANCE.in(indicator);
}
private void doAllHeatmap(All source) {
AllHeatmapIndicator indicator = new AllHeatmapIndicator();
......
......@@ -99,6 +99,39 @@ public class AllHeatmapIndicator extends ThermodynamicIndicator implements Alarm
return new AlarmMeta("All_heatmap", Scope.All);
}
@Override
public Indicator toHour() {
AllHeatmapIndicator indicator = new AllHeatmapIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setStep(this.getStep());
indicator.setNumOfSteps(this.getNumOfSteps());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
AllHeatmapIndicator indicator = new AllHeatmapIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setStep(this.getStep());
indicator.setNumOfSteps(this.getNumOfSteps());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
AllHeatmapIndicator indicator = new AllHeatmapIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setStep(this.getStep());
indicator.setNumOfSteps(this.getNumOfSteps());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<AllHeatmapIndicator> {
@Override public Map<String, Object> data2Map(AllHeatmapIndicator storageData) {
......@@ -114,7 +147,7 @@ public class AllHeatmapIndicator extends ThermodynamicIndicator implements Alarm
AllHeatmapIndicator indicator = new AllHeatmapIndicator();
indicator.setStep(((Number)dbMap.get("step")).intValue());
indicator.setNumOfSteps(((Number)dbMap.get("num_of_steps")).intValue());
indicator.setDetailGroup((List)dbMap.get("detail_group"));
indicator.setDetailGroup((java.util.List)dbMap.get("detail_group"));
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
......
......@@ -99,6 +99,39 @@ public class AllP50Indicator extends P50Indicator implements AlarmSupported {
return new AlarmMeta("All_p50", Scope.All);
}
@Override
public Indicator toHour() {
AllP50Indicator indicator = new AllP50Indicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
AllP50Indicator indicator = new AllP50Indicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
AllP50Indicator indicator = new AllP50Indicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<AllP50Indicator> {
@Override public Map<String, Object> data2Map(AllP50Indicator storageData) {
......@@ -114,7 +147,7 @@ public class AllP50Indicator extends P50Indicator implements AlarmSupported {
AllP50Indicator indicator = new AllP50Indicator();
indicator.setValue(((Number)dbMap.get("value")).intValue());
indicator.setPrecision(((Number)dbMap.get("precision")).intValue());
indicator.setDetailGroup((List)dbMap.get("detail_group"));
indicator.setDetailGroup((java.util.List)dbMap.get("detail_group"));
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
......
......@@ -99,6 +99,39 @@ public class AllP75Indicator extends P75Indicator implements AlarmSupported {
return new AlarmMeta("All_p75", Scope.All);
}
@Override
public Indicator toHour() {
AllP75Indicator indicator = new AllP75Indicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
AllP75Indicator indicator = new AllP75Indicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
AllP75Indicator indicator = new AllP75Indicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<AllP75Indicator> {
@Override public Map<String, Object> data2Map(AllP75Indicator storageData) {
......@@ -114,7 +147,7 @@ public class AllP75Indicator extends P75Indicator implements AlarmSupported {
AllP75Indicator indicator = new AllP75Indicator();
indicator.setValue(((Number)dbMap.get("value")).intValue());
indicator.setPrecision(((Number)dbMap.get("precision")).intValue());
indicator.setDetailGroup((List)dbMap.get("detail_group"));
indicator.setDetailGroup((java.util.List)dbMap.get("detail_group"));
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
......
......@@ -99,6 +99,39 @@ public class AllP90Indicator extends P90Indicator implements AlarmSupported {
return new AlarmMeta("All_p90", Scope.All);
}
@Override
public Indicator toHour() {
AllP90Indicator indicator = new AllP90Indicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
AllP90Indicator indicator = new AllP90Indicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
AllP90Indicator indicator = new AllP90Indicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<AllP90Indicator> {
@Override public Map<String, Object> data2Map(AllP90Indicator storageData) {
......@@ -114,7 +147,7 @@ public class AllP90Indicator extends P90Indicator implements AlarmSupported {
AllP90Indicator indicator = new AllP90Indicator();
indicator.setValue(((Number)dbMap.get("value")).intValue());
indicator.setPrecision(((Number)dbMap.get("precision")).intValue());
indicator.setDetailGroup((List)dbMap.get("detail_group"));
indicator.setDetailGroup((java.util.List)dbMap.get("detail_group"));
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
......
......@@ -99,6 +99,39 @@ public class AllP95Indicator extends P95Indicator implements AlarmSupported {
return new AlarmMeta("All_p95", Scope.All);
}
@Override
public Indicator toHour() {
AllP95Indicator indicator = new AllP95Indicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
AllP95Indicator indicator = new AllP95Indicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
AllP95Indicator indicator = new AllP95Indicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<AllP95Indicator> {
@Override public Map<String, Object> data2Map(AllP95Indicator storageData) {
......@@ -114,7 +147,7 @@ public class AllP95Indicator extends P95Indicator implements AlarmSupported {
AllP95Indicator indicator = new AllP95Indicator();
indicator.setValue(((Number)dbMap.get("value")).intValue());
indicator.setPrecision(((Number)dbMap.get("precision")).intValue());
indicator.setDetailGroup((List)dbMap.get("detail_group"));
indicator.setDetailGroup((java.util.List)dbMap.get("detail_group"));
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
......
......@@ -99,6 +99,39 @@ public class AllP99Indicator extends P99Indicator implements AlarmSupported {
return new AlarmMeta("All_p99", Scope.All);
}
@Override
public Indicator toHour() {
AllP99Indicator indicator = new AllP99Indicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
AllP99Indicator indicator = new AllP99Indicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
AllP99Indicator indicator = new AllP99Indicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setValue(this.getValue());
indicator.setPrecision(this.getPrecision());
indicator.setDetailGroup(this.getDetailGroup());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<AllP99Indicator> {
@Override public Map<String, Object> data2Map(AllP99Indicator storageData) {
......@@ -114,7 +147,7 @@ public class AllP99Indicator extends P99Indicator implements AlarmSupported {
AllP99Indicator indicator = new AllP99Indicator();
indicator.setValue(((Number)dbMap.get("value")).intValue());
indicator.setPrecision(((Number)dbMap.get("precision")).intValue());
indicator.setDetailGroup((List)dbMap.get("detail_group"));
indicator.setDetailGroup((java.util.List)dbMap.get("detail_group"));
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
......
......@@ -103,12 +103,56 @@ public class EndpointAvgIndicator extends LongAvgIndicator implements AlarmSuppo
setServiceId(remoteData.getDataIntegers(1));
setServiceInstanceId(remoteData.getDataIntegers(2));
setCount(remoteData.getDataIntegers(3));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("endpoint_Avg", Scope.Endpoint, id, serviceId, serviceInstanceId);
}
@Override
public Indicator toHour() {
EndpointAvgIndicator indicator = new EndpointAvgIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
EndpointAvgIndicator indicator = new EndpointAvgIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
EndpointAvgIndicator indicator = new EndpointAvgIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<EndpointAvgIndicator> {
@Override public Map<String, Object> data2Map(EndpointAvgIndicator storageData) {
......
......@@ -103,12 +103,56 @@ public class EndpointPercentIndicator extends PercentIndicator implements AlarmS
setServiceId(remoteData.getDataIntegers(1));
setServiceInstanceId(remoteData.getDataIntegers(2));
setPercentage(remoteData.getDataIntegers(3));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("endpoint_percent", Scope.Endpoint, id, serviceId, serviceInstanceId);
}
@Override
public Indicator toHour() {
EndpointPercentIndicator indicator = new EndpointPercentIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setTotal(this.getTotal());
indicator.setPercentage(this.getPercentage());
indicator.setMatch(this.getMatch());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
EndpointPercentIndicator indicator = new EndpointPercentIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setTotal(this.getTotal());
indicator.setPercentage(this.getPercentage());
indicator.setMatch(this.getMatch());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
EndpointPercentIndicator indicator = new EndpointPercentIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setTotal(this.getTotal());
indicator.setPercentage(this.getPercentage());
indicator.setMatch(this.getMatch());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<EndpointPercentIndicator> {
@Override public Map<String, Object> data2Map(EndpointPercentIndicator storageData) {
......
......@@ -116,12 +116,65 @@ public class EndpointRelationAvgIndicator extends LongAvgIndicator implements Al
setServiceInstanceId(remoteData.getDataIntegers(4));
setChildServiceInstanceId(remoteData.getDataIntegers(5));
setCount(remoteData.getDataIntegers(6));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("EndpointRelation_Avg", Scope.EndpointRelation, endpointId, childEndpointId, serviceId, childServiceId, serviceInstanceId, childServiceInstanceId);
}
@Override
public Indicator toHour() {
EndpointRelationAvgIndicator indicator = new EndpointRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setEndpointId(this.getEndpointId());
indicator.setChildEndpointId(this.getChildEndpointId());
indicator.setServiceId(this.getServiceId());
indicator.setChildServiceId(this.getChildServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setChildServiceInstanceId(this.getChildServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
EndpointRelationAvgIndicator indicator = new EndpointRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setEndpointId(this.getEndpointId());
indicator.setChildEndpointId(this.getChildEndpointId());
indicator.setServiceId(this.getServiceId());
indicator.setChildServiceId(this.getChildServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setChildServiceInstanceId(this.getChildServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
EndpointRelationAvgIndicator indicator = new EndpointRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setEndpointId(this.getEndpointId());
indicator.setChildEndpointId(this.getChildEndpointId());
indicator.setServiceId(this.getServiceId());
indicator.setChildServiceId(this.getChildServiceId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setChildServiceInstanceId(this.getChildServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<EndpointRelationAvgIndicator> {
@Override public Map<String, Object> data2Map(EndpointRelationAvgIndicator storageData) {
......
......@@ -97,12 +97,50 @@ public class ServiceAvgIndicator extends LongAvgIndicator implements AlarmSuppor
setId(remoteData.getDataIntegers(0));
setCount(remoteData.getDataIntegers(1));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("Service_Avg", Scope.Service, id);
}
@Override
public Indicator toHour() {
ServiceAvgIndicator indicator = new ServiceAvgIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceAvgIndicator indicator = new ServiceAvgIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceAvgIndicator indicator = new ServiceAvgIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceAvgIndicator> {
@Override public Map<String, Object> data2Map(ServiceAvgIndicator storageData) {
......
......@@ -21,14 +21,15 @@ package org.apache.skywalking.oap.server.core.analysis.generated.service;
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.alarm.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.SumIndicator;
import org.apache.skywalking.oap.server.core.alarm.AlarmMeta;
import org.apache.skywalking.oap.server.core.alarm.AlarmSupported;
import org.apache.skywalking.oap.server.core.analysis.indicator.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.source.Scope;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.source.Scope;
/**
* This class is auto generated. Please don't change this class manually.
......@@ -92,12 +93,44 @@ public class ServiceCallsSumIndicator extends SumIndicator implements AlarmSuppo
setId(remoteData.getDataIntegers(0));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("Service_Calls_Sum", Scope.Service, id);
}
@Override
public Indicator toHour() {
ServiceCallsSumIndicator indicator = new ServiceCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceCallsSumIndicator indicator = new ServiceCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceCallsSumIndicator indicator = new ServiceCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceCallsSumIndicator> {
@Override public Map<String, Object> data2Map(ServiceCallsSumIndicator storageData) {
......
......@@ -20,7 +20,7 @@ package org.apache.skywalking.oap.server.core.analysis.generated.service;
import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher;
import org.apache.skywalking.oap.server.core.analysis.worker.IndicatorProcess;
import org.apache.skywalking.oap.server.core.source.Service;
import org.apache.skywalking.oap.server.core.source.*;
/**
* This class is auto generated. Please don't change this class manually.
......
......@@ -100,12 +100,53 @@ public class ServiceInstanceRespTimeIndicator extends LongAvgIndicator implement
setId(remoteData.getDataIntegers(0));
setServiceId(remoteData.getDataIntegers(1));
setCount(remoteData.getDataIntegers(2));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("ServiceInstance_RespTime", Scope.ServiceInstance, id, serviceId);
}
@Override
public Indicator toHour() {
ServiceInstanceRespTimeIndicator indicator = new ServiceInstanceRespTimeIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceInstanceRespTimeIndicator indicator = new ServiceInstanceRespTimeIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceInstanceRespTimeIndicator indicator = new ServiceInstanceRespTimeIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceId(this.getServiceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceInstanceRespTimeIndicator> {
@Override public Map<String, Object> data2Map(ServiceInstanceRespTimeIndicator storageData) {
......
......@@ -100,12 +100,53 @@ public class InstanceJvmCpuIndicator extends DoubleAvgIndicator implements Alarm
setId(remoteData.getDataIntegers(0));
setServiceInstanceId(remoteData.getDataIntegers(1));
setCount(remoteData.getDataIntegers(2));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("instance_jvm_cpu", Scope.ServiceInstanceJVMCPU, id, serviceInstanceId);
}
@Override
public Indicator toHour() {
InstanceJvmCpuIndicator indicator = new InstanceJvmCpuIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
InstanceJvmCpuIndicator indicator = new InstanceJvmCpuIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
InstanceJvmCpuIndicator indicator = new InstanceJvmCpuIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<InstanceJvmCpuIndicator> {
@Override public Map<String, Object> data2Map(InstanceJvmCpuIndicator storageData) {
......
......@@ -100,12 +100,53 @@ public class InstanceJvmYoungGcTimeIndicator extends LongAvgIndicator implements
setId(remoteData.getDataIntegers(0));
setServiceInstanceId(remoteData.getDataIntegers(1));
setCount(remoteData.getDataIntegers(2));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("instance_jvm_young_gc_time", Scope.ServiceInstanceJVMGC, id, serviceInstanceId);
}
@Override
public Indicator toHour() {
InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<InstanceJvmYoungGcTimeIndicator> {
@Override public Map<String, Object> data2Map(InstanceJvmYoungGcTimeIndicator storageData) {
......
......@@ -100,12 +100,53 @@ public class InstanceJvmMemoryMaxIndicator extends LongAvgIndicator implements A
setId(remoteData.getDataIntegers(0));
setServiceInstanceId(remoteData.getDataIntegers(1));
setCount(remoteData.getDataIntegers(2));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("instance_jvm_memory_max", Scope.ServiceInstanceJVMMemory, id, serviceInstanceId);
}
@Override
public Indicator toHour() {
InstanceJvmMemoryMaxIndicator indicator = new InstanceJvmMemoryMaxIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
InstanceJvmMemoryMaxIndicator indicator = new InstanceJvmMemoryMaxIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
InstanceJvmMemoryMaxIndicator indicator = new InstanceJvmMemoryMaxIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<InstanceJvmMemoryMaxIndicator> {
@Override public Map<String, Object> data2Map(InstanceJvmMemoryMaxIndicator storageData) {
......
......@@ -100,12 +100,53 @@ public class InstanceJvmMemoryPoolMaxIndicator extends LongAvgIndicator implemen
setId(remoteData.getDataIntegers(0));
setServiceInstanceId(remoteData.getDataIntegers(1));
setCount(remoteData.getDataIntegers(2));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("instance_jvm_memory_pool_max", Scope.ServiceInstanceJVMMemoryPool, id, serviceInstanceId);
}
@Override
public Indicator toHour() {
InstanceJvmMemoryPoolMaxIndicator indicator = new InstanceJvmMemoryPoolMaxIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
InstanceJvmMemoryPoolMaxIndicator indicator = new InstanceJvmMemoryPoolMaxIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
InstanceJvmMemoryPoolMaxIndicator indicator = new InstanceJvmMemoryPoolMaxIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setId(this.getId());
indicator.setServiceInstanceId(this.getServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<InstanceJvmMemoryPoolMaxIndicator> {
@Override public Map<String, Object> data2Map(InstanceJvmMemoryPoolMaxIndicator storageData) {
......
......@@ -110,12 +110,59 @@ public class ServiceInstanceRelationAvgIndicator extends LongAvgIndicator implem
setSourceServiceInstanceId(remoteData.getDataIntegers(2));
setDestServiceInstanceId(remoteData.getDataIntegers(3));
setCount(remoteData.getDataIntegers(4));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("ServiceInstanceRelation_Avg", Scope.ServiceInstanceRelation, sourceServiceId, destServiceId, sourceServiceInstanceId, destServiceInstanceId);
}
@Override
public Indicator toHour() {
ServiceInstanceRelationAvgIndicator indicator = new ServiceInstanceRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setSourceServiceInstanceId(this.getSourceServiceInstanceId());
indicator.setDestServiceInstanceId(this.getDestServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceInstanceRelationAvgIndicator indicator = new ServiceInstanceRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setSourceServiceInstanceId(this.getSourceServiceInstanceId());
indicator.setDestServiceInstanceId(this.getDestServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceInstanceRelationAvgIndicator indicator = new ServiceInstanceRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setSourceServiceInstanceId(this.getSourceServiceInstanceId());
indicator.setDestServiceInstanceId(this.getDestServiceInstanceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceInstanceRelationAvgIndicator> {
@Override public Map<String, Object> data2Map(ServiceInstanceRelationAvgIndicator storageData) {
......
......@@ -21,14 +21,15 @@ package org.apache.skywalking.oap.server.core.analysis.generated.servicerelation
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.alarm.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.LongAvgIndicator;
import org.apache.skywalking.oap.server.core.alarm.AlarmMeta;
import org.apache.skywalking.oap.server.core.alarm.AlarmSupported;
import org.apache.skywalking.oap.server.core.analysis.indicator.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.source.Scope;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.source.Scope;
/**
* This class is auto generated. Please don't change this class manually.
......@@ -103,12 +104,53 @@ public class ServiceRelationAvgIndicator extends LongAvgIndicator implements Ala
setSourceServiceId(remoteData.getDataIntegers(0));
setDestServiceId(remoteData.getDataIntegers(1));
setCount(remoteData.getDataIntegers(2));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("ServiceRelation_Avg", Scope.ServiceRelation, sourceServiceId, destServiceId);
}
@Override
public Indicator toHour() {
ServiceRelationAvgIndicator indicator = new ServiceRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceRelationAvgIndicator indicator = new ServiceRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceRelationAvgIndicator indicator = new ServiceRelationAvgIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setSummation(this.getSummation());
indicator.setCount(this.getCount());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceRelationAvgIndicator> {
@Override public Map<String, Object> data2Map(ServiceRelationAvgIndicator storageData) {
......
......@@ -21,14 +21,15 @@ package org.apache.skywalking.oap.server.core.analysis.generated.servicerelation
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.alarm.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.SumIndicator;
import org.apache.skywalking.oap.server.core.alarm.AlarmMeta;
import org.apache.skywalking.oap.server.core.alarm.AlarmSupported;
import org.apache.skywalking.oap.server.core.analysis.indicator.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.source.Scope;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.source.Scope;
/**
* This class is auto generated. Please don't change this class manually.
......@@ -99,12 +100,47 @@ public class ServiceRelationClientCallsSumIndicator extends SumIndicator impleme
setSourceServiceId(remoteData.getDataIntegers(0));
setDestServiceId(remoteData.getDataIntegers(1));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("Service_Relation_Client_Calls_Sum", Scope.ServiceRelation, sourceServiceId, destServiceId);
}
@Override
public Indicator toHour() {
ServiceRelationClientCallsSumIndicator indicator = new ServiceRelationClientCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceRelationClientCallsSumIndicator indicator = new ServiceRelationClientCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceRelationClientCallsSumIndicator indicator = new ServiceRelationClientCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceRelationClientCallsSumIndicator> {
@Override public Map<String, Object> data2Map(ServiceRelationClientCallsSumIndicator storageData) {
......
......@@ -19,8 +19,8 @@
package org.apache.skywalking.oap.server.core.analysis.generated.servicerelation;
import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher;
import org.apache.skywalking.oap.server.core.analysis.indicator.expression.EqualMatch;
import org.apache.skywalking.oap.server.core.analysis.worker.IndicatorProcess;
import org.apache.skywalking.oap.server.core.analysis.indicator.expression.*;
import org.apache.skywalking.oap.server.core.source.*;
/**
......
......@@ -21,14 +21,15 @@ package org.apache.skywalking.oap.server.core.analysis.generated.servicerelation
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.alarm.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.SumIndicator;
import org.apache.skywalking.oap.server.core.alarm.AlarmMeta;
import org.apache.skywalking.oap.server.core.alarm.AlarmSupported;
import org.apache.skywalking.oap.server.core.analysis.indicator.*;
import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.source.Scope;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.source.Scope;
/**
* This class is auto generated. Please don't change this class manually.
......@@ -99,12 +100,47 @@ public class ServiceRelationServerCallsSumIndicator extends SumIndicator impleme
setSourceServiceId(remoteData.getDataIntegers(0));
setDestServiceId(remoteData.getDataIntegers(1));
}
@Override public AlarmMeta getAlarmMeta() {
return new AlarmMeta("Service_Relation_Server_Calls_Sum", Scope.ServiceRelation, sourceServiceId, destServiceId);
}
@Override
public Indicator toHour() {
ServiceRelationServerCallsSumIndicator indicator = new ServiceRelationServerCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toDay() {
ServiceRelationServerCallsSumIndicator indicator = new ServiceRelationServerCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
@Override
public Indicator toMonth() {
ServiceRelationServerCallsSumIndicator indicator = new ServiceRelationServerCallsSumIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setSourceServiceId(this.getSourceServiceId());
indicator.setDestServiceId(this.getDestServiceId());
indicator.setValue(this.getValue());
indicator.setTimeBucket(this.getTimeBucket());
return indicator;
}
public static class Builder implements StorageBuilder<ServiceRelationServerCallsSumIndicator> {
@Override public Map<String, Object> data2Map(ServiceRelationServerCallsSumIndicator storageData) {
......
......@@ -18,7 +18,8 @@
package org.apache.skywalking.oap.server.core.analysis.indicator;
import lombok.*;
import lombok.Getter;
import lombok.Setter;
import org.apache.skywalking.oap.server.core.remote.data.StreamData;
import org.apache.skywalking.oap.server.core.storage.StorageData;
import org.apache.skywalking.oap.server.core.storage.annotation.Column;
......@@ -37,4 +38,48 @@ public abstract class Indicator extends StreamData implements StorageData {
public abstract void combine(Indicator indicator);
public abstract void calculate();
public abstract Indicator toHour();
public abstract Indicator toDay();
public abstract Indicator toMonth();
public long toTimeBucketInHour() {
/**
* timeBucket in minute
* 201809120511
* min
* 100000000000
* max
* 999999999999
*/
if (timeBucket < 999999999999L && timeBucket > 100000000000L) {
return timeBucket / 100;
} else {
throw new IllegalStateException("Current time bucket is not in minute dimensionality");
}
}
public long toTimeBucketInDay() {
if (timeBucket < 999999999999L && timeBucket > 100000000000L) {
return timeBucket / 10000;
} else if (timeBucket < 9999999999L && timeBucket > 1000000000L) {
return timeBucket / 100;
} else {
throw new IllegalStateException("Current time bucket is not in minute dimensionality");
}
}
public long toTimeBucketInMonth() {
if (timeBucket < 999999999999L && timeBucket > 100000000000L) {
return timeBucket / 1000000;
} else if (timeBucket < 9999999999L && timeBucket > 1000000000L) {
return timeBucket / 10000;
} else if (timeBucket < 99999999L && timeBucket > 10000000L) {
return timeBucket / 100;
} else {
throw new IllegalStateException("Current time bucket is not in minute dimensionality");
}
}
}
......@@ -99,6 +99,33 @@ public class ServiceComponentIndicator extends Indicator {
@Override public void calculate() {
}
@Override public Indicator toHour() {
ServiceComponentIndicator indicator = new ServiceComponentIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setServiceId(this.getServiceId());
indicator.setComponentId(this.getComponentId());
return indicator;
}
@Override public Indicator toDay() {
ServiceComponentIndicator indicator = new ServiceComponentIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setServiceId(this.getServiceId());
indicator.setComponentId(this.getComponentId());
return indicator;
}
@Override public Indicator toMonth() {
ServiceComponentIndicator indicator = new ServiceComponentIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setServiceId(this.getServiceId());
indicator.setComponentId(this.getComponentId());
return indicator;
}
@Override public final void combine(Indicator indicator) {
}
......
......@@ -18,15 +18,18 @@
package org.apache.skywalking.oap.server.core.analysis.manual.service;
import java.util.*;
import lombok.*;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.core.analysis.indicator.Indicator;
import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
import org.apache.skywalking.oap.server.core.storage.annotation.Column;
import org.apache.skywalking.oap.server.core.storage.annotation.StorageEntity;
/**
* @author peng-yongsheng
......@@ -99,6 +102,33 @@ public class ServiceMappingIndicator extends Indicator {
@Override public void calculate() {
}
@Override public Indicator toHour() {
ServiceMappingIndicator indicator = new ServiceMappingIndicator();
indicator.setTimeBucket(toTimeBucketInHour());
indicator.setServiceId(this.getServiceId());
indicator.setMappingServiceId(this.getMappingServiceId());
return indicator;
}
@Override public Indicator toDay() {
ServiceMappingIndicator indicator = new ServiceMappingIndicator();
indicator.setTimeBucket(toTimeBucketInDay());
indicator.setServiceId(this.getServiceId());
indicator.setMappingServiceId(this.getMappingServiceId());
return indicator;
}
@Override public Indicator toMonth() {
ServiceMappingIndicator indicator = new ServiceMappingIndicator();
indicator.setTimeBucket(toTimeBucketInMonth());
indicator.setServiceId(this.getServiceId());
indicator.setMappingServiceId(this.getMappingServiceId());
return indicator;
}
@Override public final void combine(Indicator indicator) {
}
......
/*
* 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.oap.server.core.analysis.indicator;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.junit.Assert;
import org.junit.Test;
/**
* @author wusheng
*/
public class IndicatorTest {
@Test
public void testTransferToTimeBucket() {
IndicatorMocker mocker = new IndicatorMocker();
mocker.setTimeBucket(201809120511L);
Assert.assertEquals(2018091205L, mocker.toTimeBucketInHour());
Assert.assertEquals(20180912L, mocker.toTimeBucketInDay());
Assert.assertEquals(201809L, mocker.toTimeBucketInMonth());
mocker = new IndicatorMocker();
mocker.setTimeBucket(2018091205L);
Assert.assertEquals(20180912L, mocker.toTimeBucketInDay());
Assert.assertEquals(201809L, mocker.toTimeBucketInMonth());
mocker = new IndicatorMocker();
mocker.setTimeBucket(20180912L);
Assert.assertEquals(201809L, mocker.toTimeBucketInMonth());
}
@Test
public void testIllegalTransferToTimeBucket() {
IndicatorMocker mocker = new IndicatorMocker();
mocker.setTimeBucket(2018091205L);
boolean status = true;
try {
mocker.toTimeBucketInHour();
} catch (IllegalStateException e) {
status = false;
}
Assert.assertFalse(status);
mocker = new IndicatorMocker();
mocker.setTimeBucket(20180912L);
status = true;
try {
mocker.toTimeBucketInHour();
} catch (IllegalStateException e) {
status = false;
}
Assert.assertFalse(status);
status = true;
try {
mocker.toTimeBucketInDay();
} catch (IllegalStateException e) {
status = false;
}
Assert.assertFalse(status);
}
public class IndicatorMocker extends Indicator {
@Override public String id() {
return null;
}
@Override public void combine(Indicator indicator) {
}
@Override public void calculate() {
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public void deserialize(RemoteData remoteData) {
}
@Override public RemoteData.Builder serialize() {
return null;
}
}
}
......@@ -58,6 +58,18 @@ public class LongAvgIndicatorTest {
return null;
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public void deserialize(RemoteData remoteData) {
}
......
......@@ -73,6 +73,18 @@ public class PercentIndicatorTest {
return null;
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public void deserialize(RemoteData remoteData) {
}
......
......@@ -103,6 +103,18 @@ public class PxxIndicatorTest {
return null;
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public void deserialize(RemoteData remoteData) {
}
......
......@@ -62,6 +62,18 @@ public class SumIndicatorTest {
return null;
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public void deserialize(RemoteData remoteData) {
}
......
......@@ -98,6 +98,18 @@ public class ThermodynamicIndicatorTest {
return null;
}
@Override public Indicator toHour() {
return null;
}
@Override public Indicator toDay() {
return null;
}
@Override public Indicator toMonth() {
return null;
}
@Override public void deserialize(RemoteData remoteData) {
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册