提交 86452fd2 编写于 作者: wu-sheng's avatar wu-sheng 提交者: 彭勇升 pengys

Fix all sources and sourceDispatchers. (#1620)

上级 e93b3f0d
......@@ -20,10 +20,15 @@ package org.apache.skywalking.oap.server.core.analysis;
import java.util.*;
import org.apache.skywalking.oap.server.core.analysis.generated.endpoint.EndpointDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.endpointrelation.EndpointRelationDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.service.ServiceDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.serviceinstance.ServiceInstanceDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmcpu.ServiceInstanceJVMCPUDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmgc.ServiceInstanceJVMGCDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmmemory.ServiceInstanceJVMMemoryDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmmemorypool.ServiceInstanceJVMMemoryPoolDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancerelation.ServiceInstanceRelationDispatcher;
import org.apache.skywalking.oap.server.core.analysis.generated.servicerelation.ServiceRelationDispatcher;
import org.apache.skywalking.oap.server.core.source.Scope;
import org.slf4j.*;
......@@ -38,8 +43,15 @@ public class DispatcherManager {
public DispatcherManager() {
this.dispatcherMap = new HashMap<>();
this.dispatcherMap.put(Scope.Service, new ServiceDispatcher());
this.dispatcherMap.put(Scope.ServiceInstance, new ServiceInstanceDispatcher());
this.dispatcherMap.put(Scope.Endpoint, new EndpointDispatcher());
this.dispatcherMap.put(Scope.ServiceRelation, new ServiceRelationDispatcher());
this.dispatcherMap.put(Scope.ServiceInstanceRelation, new ServiceInstanceRelationDispatcher());
this.dispatcherMap.put(Scope.EndpointRelation, new EndpointRelationDispatcher());
this.dispatcherMap.put(Scope.ServiceInstanceJVMCPU, new ServiceInstanceJVMCPUDispatcher());
this.dispatcherMap.put(Scope.ServiceInstanceJVMGC, new ServiceInstanceJVMGCDispatcher());
this.dispatcherMap.put(Scope.ServiceInstanceJVMMemory, new ServiceInstanceJVMMemoryDispatcher());
......
......@@ -69,6 +69,7 @@ public class EndpointAvgIndicator extends LongAvgIndicator implements AlarmSuppo
EndpointAvgIndicator indicator = (EndpointAvgIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
......@@ -69,6 +69,7 @@ public class EndpointPercentIndicator extends PercentIndicator implements AlarmS
EndpointPercentIndicator indicator = (EndpointPercentIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
/*
* 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.generated.endpointrelation;
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
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.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.
*
* @author Observability Analysis Language code generator
*/
@IndicatorType
@StreamData
@StorageEntity(name = "endpointrelation_avg", builder = EndpointRelationAvgIndicator.Builder.class)
public class EndpointRelationAvgIndicator extends LongAvgIndicator implements AlarmSupported {
@Setter @Getter @Column(columnName = "endpoint_id") private int endpointId;
@Setter @Getter @Column(columnName = "child_endpoint_id") private int childEndpointId;
@Setter @Getter @Column(columnName = "service_id") private int serviceId;
@Setter @Getter @Column(columnName = "child_service_id") private int childServiceId;
@Setter @Getter @Column(columnName = "service_instance_id") private int serviceInstanceId;
@Setter @Getter @Column(columnName = "child_service_instance_id") private int childServiceInstanceId;
@Override public String id() {
String splitJointId = String.valueOf(getTimeBucket());
splitJointId += Const.ID_SPLIT + String.valueOf(endpointId);
splitJointId += Const.ID_SPLIT + String.valueOf(childEndpointId);
return splitJointId;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + endpointId;
result = 31 * result + childEndpointId;
result = 31 * result + (int)getTimeBucket();
return result;
}
@Override public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EndpointRelationAvgIndicator indicator = (EndpointRelationAvgIndicator)obj;
if (endpointId != indicator.endpointId)
return false;
if (childEndpointId != indicator.childEndpointId)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
return true;
}
@Override public RemoteData.Builder serialize() {
RemoteData.Builder remoteBuilder = RemoteData.newBuilder();
remoteBuilder.setDataLongs(0, getSummation());
remoteBuilder.setDataLongs(1, getValue());
remoteBuilder.setDataLongs(2, getTimeBucket());
remoteBuilder.setDataIntegers(0, getEndpointId());
remoteBuilder.setDataIntegers(1, getChildEndpointId());
remoteBuilder.setDataIntegers(2, getServiceId());
remoteBuilder.setDataIntegers(3, getChildServiceId());
remoteBuilder.setDataIntegers(4, getServiceInstanceId());
remoteBuilder.setDataIntegers(5, getChildServiceInstanceId());
remoteBuilder.setDataIntegers(6, getCount());
return remoteBuilder;
}
@Override public void deserialize(RemoteData remoteData) {
setSummation(remoteData.getDataLongs(0));
setValue(remoteData.getDataLongs(1));
setTimeBucket(remoteData.getDataLongs(2));
setEndpointId(remoteData.getDataIntegers(0));
setChildEndpointId(remoteData.getDataIntegers(1));
setServiceId(remoteData.getDataIntegers(2));
setChildServiceId(remoteData.getDataIntegers(3));
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);
}
public static class Builder implements StorageBuilder<EndpointRelationAvgIndicator> {
@Override public Map<String, Object> data2Map(EndpointRelationAvgIndicator storageData) {
Map<String, Object> map = new HashMap<>();
map.put("endpoint_id", storageData.getEndpointId());
map.put("child_endpoint_id", storageData.getChildEndpointId());
map.put("service_id", storageData.getServiceId());
map.put("child_service_id", storageData.getChildServiceId());
map.put("service_instance_id", storageData.getServiceInstanceId());
map.put("child_service_instance_id", storageData.getChildServiceInstanceId());
map.put("summation", storageData.getSummation());
map.put("count", storageData.getCount());
map.put("value", storageData.getValue());
map.put("time_bucket", storageData.getTimeBucket());
return map;
}
@Override public EndpointRelationAvgIndicator map2Data(Map<String, Object> dbMap) {
EndpointRelationAvgIndicator indicator = new EndpointRelationAvgIndicator();
indicator.setEndpointId(((Number)dbMap.get("endpoint_id")).intValue());
indicator.setChildEndpointId(((Number)dbMap.get("child_endpoint_id")).intValue());
indicator.setServiceId(((Number)dbMap.get("service_id")).intValue());
indicator.setChildServiceId(((Number)dbMap.get("child_service_id")).intValue());
indicator.setServiceInstanceId(((Number)dbMap.get("service_instance_id")).intValue());
indicator.setChildServiceInstanceId(((Number)dbMap.get("child_service_instance_id")).intValue());
indicator.setSummation(((Number)dbMap.get("summation")).longValue());
indicator.setCount(((Number)dbMap.get("count")).intValue());
indicator.setValue(((Number)dbMap.get("value")).longValue());
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return 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.generated.endpointrelation;
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.*;
/**
* This class is auto generated. Please don't change this class manually.
*
* @author Observability Analysis Language code generator
*/
public class EndpointRelationDispatcher implements SourceDispatcher<EndpointRelation> {
@Override public void dispatch(EndpointRelation source) {
doEndpointRelationAvg(source);
}
private void doEndpointRelationAvg(EndpointRelation source) {
EndpointRelationAvgIndicator indicator = new EndpointRelationAvgIndicator();
indicator.setTimeBucket(source.getTimeBucket());
indicator.setEndpointId(source.getEndpointId());
indicator.setChildEndpointId(source.getChildEndpointId());
indicator.setServiceId(source.getServiceId());
indicator.setChildServiceId(source.getChildServiceId());
indicator.setServiceInstanceId(source.getServiceInstanceId());
indicator.setChildServiceInstanceId(source.getChildServiceInstanceId());
indicator.combine(source.getRpcLatency(), 1);
IndicatorProcess.INSTANCE.in(indicator);
}
}
......@@ -67,6 +67,7 @@ public class ServiceAvgIndicator extends LongAvgIndicator implements AlarmSuppor
ServiceAvgIndicator indicator = (ServiceAvgIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
/*
* 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.generated.serviceinstance;
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.*;
/**
* This class is auto generated. Please don't change this class manually.
*
* @author Observability Analysis Language code generator
*/
public class ServiceInstanceDispatcher implements SourceDispatcher<ServiceInstance> {
@Override public void dispatch(ServiceInstance source) {
doServiceInstanceRespTime(source);
}
private void doServiceInstanceRespTime(ServiceInstance source) {
ServiceInstanceRespTimeIndicator indicator = new ServiceInstanceRespTimeIndicator();
indicator.setTimeBucket(source.getTimeBucket());
indicator.setId(source.getId());
indicator.setServiceId(source.getServiceId());
indicator.combine(source.getLatency(), 1);
IndicatorProcess.INSTANCE.in(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.generated.serviceinstance;
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
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.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.
*
* @author Observability Analysis Language code generator
*/
@IndicatorType
@StreamData
@StorageEntity(name = "serviceinstance_resptime", builder = ServiceInstanceRespTimeIndicator.Builder.class)
public class ServiceInstanceRespTimeIndicator extends LongAvgIndicator implements AlarmSupported {
@Setter @Getter @Column(columnName = "id") private int id;
@Setter @Getter @Column(columnName = "service_id") private int serviceId;
@Override public String id() {
String splitJointId = String.valueOf(getTimeBucket());
splitJointId += Const.ID_SPLIT + String.valueOf(id);
return splitJointId;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + id;
result = 31 * result + (int)getTimeBucket();
return result;
}
@Override public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServiceInstanceRespTimeIndicator indicator = (ServiceInstanceRespTimeIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
return true;
}
@Override public RemoteData.Builder serialize() {
RemoteData.Builder remoteBuilder = RemoteData.newBuilder();
remoteBuilder.setDataLongs(0, getSummation());
remoteBuilder.setDataLongs(1, getValue());
remoteBuilder.setDataLongs(2, getTimeBucket());
remoteBuilder.setDataIntegers(0, getId());
remoteBuilder.setDataIntegers(1, getServiceId());
remoteBuilder.setDataIntegers(2, getCount());
return remoteBuilder;
}
@Override public void deserialize(RemoteData remoteData) {
setSummation(remoteData.getDataLongs(0));
setValue(remoteData.getDataLongs(1));
setTimeBucket(remoteData.getDataLongs(2));
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);
}
public static class Builder implements StorageBuilder<ServiceInstanceRespTimeIndicator> {
@Override public Map<String, Object> data2Map(ServiceInstanceRespTimeIndicator storageData) {
Map<String, Object> map = new HashMap<>();
map.put("id", storageData.getId());
map.put("service_id", storageData.getServiceId());
map.put("summation", storageData.getSummation());
map.put("count", storageData.getCount());
map.put("value", storageData.getValue());
map.put("time_bucket", storageData.getTimeBucket());
return map;
}
@Override public ServiceInstanceRespTimeIndicator map2Data(Map<String, Object> dbMap) {
ServiceInstanceRespTimeIndicator indicator = new ServiceInstanceRespTimeIndicator();
indicator.setId(((Number)dbMap.get("id")).intValue());
indicator.setServiceId(((Number)dbMap.get("service_id")).intValue());
indicator.setSummation(((Number)dbMap.get("summation")).longValue());
indicator.setCount(((Number)dbMap.get("count")).intValue());
indicator.setValue(((Number)dbMap.get("value")).longValue());
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return indicator;
}
}
}
......@@ -68,6 +68,7 @@ public class InstanceJvmCpuIndicator extends DoubleAvgIndicator implements Alarm
InstanceJvmCpuIndicator indicator = (InstanceJvmCpuIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
......@@ -68,6 +68,7 @@ public class InstanceJvmYoungGcTimeIndicator extends LongAvgIndicator implements
InstanceJvmYoungGcTimeIndicator indicator = (InstanceJvmYoungGcTimeIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
......@@ -68,6 +68,7 @@ public class InstanceJvmMemoryMaxIndicator extends LongAvgIndicator implements A
InstanceJvmMemoryMaxIndicator indicator = (InstanceJvmMemoryMaxIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
......@@ -68,6 +68,7 @@ public class InstanceJvmMemoryPoolMaxIndicator extends LongAvgIndicator implemen
InstanceJvmMemoryPoolMaxIndicator indicator = (InstanceJvmMemoryPoolMaxIndicator)obj;
if (id != indicator.id)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
......
/*
* 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.generated.serviceinstancerelation;
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
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.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.
*
* @author Observability Analysis Language code generator
*/
@IndicatorType
@StreamData
@StorageEntity(name = "serviceinstancerelation_avg", builder = ServiceInstanceRelationAvgIndicator.Builder.class)
public class ServiceInstanceRelationAvgIndicator extends LongAvgIndicator implements AlarmSupported {
@Setter @Getter @Column(columnName = "source_service_id") private int sourceServiceId;
@Setter @Getter @Column(columnName = "dest_service_id") private int destServiceId;
@Setter @Getter @Column(columnName = "source_service_instance_id") private int sourceServiceInstanceId;
@Setter @Getter @Column(columnName = "dest_service_instance_id") private int destServiceInstanceId;
@Override public String id() {
String splitJointId = String.valueOf(getTimeBucket());
splitJointId += Const.ID_SPLIT + String.valueOf(sourceServiceInstanceId);
splitJointId += Const.ID_SPLIT + String.valueOf(destServiceInstanceId);
return splitJointId;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + sourceServiceInstanceId;
result = 31 * result + destServiceInstanceId;
result = 31 * result + (int)getTimeBucket();
return result;
}
@Override public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServiceInstanceRelationAvgIndicator indicator = (ServiceInstanceRelationAvgIndicator)obj;
if (sourceServiceInstanceId != indicator.sourceServiceInstanceId)
return false;
if (destServiceInstanceId != indicator.destServiceInstanceId)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
return true;
}
@Override public RemoteData.Builder serialize() {
RemoteData.Builder remoteBuilder = RemoteData.newBuilder();
remoteBuilder.setDataLongs(0, getSummation());
remoteBuilder.setDataLongs(1, getValue());
remoteBuilder.setDataLongs(2, getTimeBucket());
remoteBuilder.setDataIntegers(0, getSourceServiceId());
remoteBuilder.setDataIntegers(1, getDestServiceId());
remoteBuilder.setDataIntegers(2, getSourceServiceInstanceId());
remoteBuilder.setDataIntegers(3, getDestServiceInstanceId());
remoteBuilder.setDataIntegers(4, getCount());
return remoteBuilder;
}
@Override public void deserialize(RemoteData remoteData) {
setSummation(remoteData.getDataLongs(0));
setValue(remoteData.getDataLongs(1));
setTimeBucket(remoteData.getDataLongs(2));
setSourceServiceId(remoteData.getDataIntegers(0));
setDestServiceId(remoteData.getDataIntegers(1));
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);
}
public static class Builder implements StorageBuilder<ServiceInstanceRelationAvgIndicator> {
@Override public Map<String, Object> data2Map(ServiceInstanceRelationAvgIndicator storageData) {
Map<String, Object> map = new HashMap<>();
map.put("source_service_id", storageData.getSourceServiceId());
map.put("dest_service_id", storageData.getDestServiceId());
map.put("source_service_instance_id", storageData.getSourceServiceInstanceId());
map.put("dest_service_instance_id", storageData.getDestServiceInstanceId());
map.put("summation", storageData.getSummation());
map.put("count", storageData.getCount());
map.put("value", storageData.getValue());
map.put("time_bucket", storageData.getTimeBucket());
return map;
}
@Override public ServiceInstanceRelationAvgIndicator map2Data(Map<String, Object> dbMap) {
ServiceInstanceRelationAvgIndicator indicator = new ServiceInstanceRelationAvgIndicator();
indicator.setSourceServiceId(((Number)dbMap.get("source_service_id")).intValue());
indicator.setDestServiceId(((Number)dbMap.get("dest_service_id")).intValue());
indicator.setSourceServiceInstanceId(((Number)dbMap.get("source_service_instance_id")).intValue());
indicator.setDestServiceInstanceId(((Number)dbMap.get("dest_service_instance_id")).intValue());
indicator.setSummation(((Number)dbMap.get("summation")).longValue());
indicator.setCount(((Number)dbMap.get("count")).intValue());
indicator.setValue(((Number)dbMap.get("value")).longValue());
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return 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.generated.serviceinstancerelation;
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.*;
/**
* This class is auto generated. Please don't change this class manually.
*
* @author Observability Analysis Language code generator
*/
public class ServiceInstanceRelationDispatcher implements SourceDispatcher<ServiceInstanceRelation> {
@Override public void dispatch(ServiceInstanceRelation source) {
doServiceInstanceRelationAvg(source);
}
private void doServiceInstanceRelationAvg(ServiceInstanceRelation source) {
ServiceInstanceRelationAvgIndicator indicator = new ServiceInstanceRelationAvgIndicator();
indicator.setTimeBucket(source.getTimeBucket());
indicator.setSourceServiceId(source.getSourceServiceId());
indicator.setDestServiceId(source.getDestServiceId());
indicator.setSourceServiceInstanceId(source.getSourceServiceInstanceId());
indicator.setDestServiceInstanceId(source.getDestServiceInstanceId());
indicator.combine(source.getLatency(), 1);
IndicatorProcess.INSTANCE.in(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.generated.servicerelation;
import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
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.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.
*
* @author Observability Analysis Language code generator
*/
@IndicatorType
@StreamData
@StorageEntity(name = "servicerelation_avg", builder = ServiceRelationAvgIndicator.Builder.class)
public class ServiceRelationAvgIndicator extends LongAvgIndicator implements AlarmSupported {
@Setter @Getter @Column(columnName = "source_service_id") private int sourceServiceId;
@Setter @Getter @Column(columnName = "dest_service_id") private int destServiceId;
@Override public String id() {
String splitJointId = String.valueOf(getTimeBucket());
splitJointId += Const.ID_SPLIT + String.valueOf(sourceServiceId);
splitJointId += Const.ID_SPLIT + String.valueOf(destServiceId);
return splitJointId;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + sourceServiceId;
result = 31 * result + destServiceId;
result = 31 * result + (int)getTimeBucket();
return result;
}
@Override public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ServiceRelationAvgIndicator indicator = (ServiceRelationAvgIndicator)obj;
if (sourceServiceId != indicator.sourceServiceId)
return false;
if (destServiceId != indicator.destServiceId)
return false;
if (getTimeBucket() != indicator.getTimeBucket())
return false;
return true;
}
@Override public RemoteData.Builder serialize() {
RemoteData.Builder remoteBuilder = RemoteData.newBuilder();
remoteBuilder.setDataLongs(0, getSummation());
remoteBuilder.setDataLongs(1, getValue());
remoteBuilder.setDataLongs(2, getTimeBucket());
remoteBuilder.setDataIntegers(0, getSourceServiceId());
remoteBuilder.setDataIntegers(1, getDestServiceId());
remoteBuilder.setDataIntegers(2, getCount());
return remoteBuilder;
}
@Override public void deserialize(RemoteData remoteData) {
setSummation(remoteData.getDataLongs(0));
setValue(remoteData.getDataLongs(1));
setTimeBucket(remoteData.getDataLongs(2));
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);
}
public static class Builder implements StorageBuilder<ServiceRelationAvgIndicator> {
@Override public Map<String, Object> data2Map(ServiceRelationAvgIndicator storageData) {
Map<String, Object> map = new HashMap<>();
map.put("source_service_id", storageData.getSourceServiceId());
map.put("dest_service_id", storageData.getDestServiceId());
map.put("summation", storageData.getSummation());
map.put("count", storageData.getCount());
map.put("value", storageData.getValue());
map.put("time_bucket", storageData.getTimeBucket());
return map;
}
@Override public ServiceRelationAvgIndicator map2Data(Map<String, Object> dbMap) {
ServiceRelationAvgIndicator indicator = new ServiceRelationAvgIndicator();
indicator.setSourceServiceId(((Number)dbMap.get("source_service_id")).intValue());
indicator.setDestServiceId(((Number)dbMap.get("dest_service_id")).intValue());
indicator.setSummation(((Number)dbMap.get("summation")).longValue());
indicator.setCount(((Number)dbMap.get("count")).intValue());
indicator.setValue(((Number)dbMap.get("value")).longValue());
indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
return 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.generated.servicerelation;
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.*;
/**
* This class is auto generated. Please don't change this class manually.
*
* @author Observability Analysis Language code generator
*/
public class ServiceRelationDispatcher implements SourceDispatcher<ServiceRelation> {
@Override public void dispatch(ServiceRelation source) {
doServiceRelationAvg(source);
}
private void doServiceRelationAvg(ServiceRelation source) {
ServiceRelationAvgIndicator indicator = new ServiceRelationAvgIndicator();
indicator.setTimeBucket(source.getTimeBucket());
indicator.setSourceServiceId(source.getSourceServiceId());
indicator.setDestServiceId(source.getDestServiceId());
indicator.combine(source.getLatency(), 1);
IndicatorProcess.INSTANCE.in(indicator);
}
}
......@@ -31,8 +31,18 @@ public class EndpointRelation extends Source {
@Getter @Setter private int endpointId;
@Getter @Setter private String endpoint;
@Getter @Setter private int serviceId;
@Getter @Setter private String serviceName;
@Getter @Setter private int serviceInstanceId;
@Getter @Setter private String serviceInstanceName;
@Getter @Setter private int childEndpointId;
@Getter @Setter private String childEndpoint;
@Getter @Setter private int childServiceId;
@Getter @Setter private String childServiceName;
@Getter @Setter private int childServiceInstanceId;
@Getter @Setter private String childServiceInstanceName;
@Getter @Setter private int rpcLatency;
@Getter @Setter private boolean status;
@Getter @Setter private int responseCode;
......
......@@ -31,6 +31,7 @@ public class ServiceInstance extends Source {
}
@Getter @Setter private int id;
@Getter @Setter private int serviceId;
@Getter @Setter private String name;
@Getter @Setter private String serviceName;
@Getter @Setter private String endpointName;
......
......@@ -30,9 +30,11 @@ public class ServiceInstanceRelation extends Source {
}
@Getter @Setter private int sourceServiceInstanceId;
@Getter @Setter private int sourceServiceId;
@Getter @Setter private String sourceServiceName;
@Getter @Setter private String sourceServiceInstanceName;
@Getter @Setter private int destServiceInstanceId;
@Getter @Setter private int destServiceId;
@Getter @Setter private String destServiceName;
@Getter @Setter private String destServiceInstanceName;
@Getter @Setter private String endpoint;
......
......@@ -31,7 +31,16 @@ import org.slf4j.*;
import static java.util.Objects.nonNull;
/**
* @author peng-yongsheng
*
* Notice, in here, there are following concepts match
*
* v5 | v6
*
* 1. Application == Service
* 2. Server == Service Instance
* 3. Service == Endpoint
*
* @author peng-yongsheng, wusheng
*/
public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListener {
......
......@@ -80,6 +80,7 @@ class SourceBuilder {
ServiceInstance toServiceInstance() {
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setId(destServiceInstanceId);
serviceInstance.setServiceId(destServiceId);
serviceInstance.setName(destServiceInstanceName);
serviceInstance.setServiceName(destServiceName);
serviceInstance.setEndpointName(destEndpointName);
......@@ -94,8 +95,10 @@ class SourceBuilder {
ServiceInstanceRelation toServiceInstanceRelation() {
ServiceInstanceRelation serviceInstanceRelation = new ServiceInstanceRelation();
serviceInstanceRelation.setSourceServiceInstanceId(sourceServiceInstanceId);
serviceInstanceRelation.setSourceServiceId(sourceServiceId);
serviceInstanceRelation.setSourceServiceName(sourceServiceName);
serviceInstanceRelation.setSourceServiceInstanceName(sourceServiceInstanceName);
serviceInstanceRelation.setSourceServiceId(destServiceId);
serviceInstanceRelation.setDestServiceInstanceId(destServiceInstanceId);
serviceInstanceRelation.setDestServiceName(destServiceName);
serviceInstanceRelation.setDestServiceInstanceName(destServiceInstanceName);
......@@ -129,8 +132,16 @@ class SourceBuilder {
EndpointRelation endpointRelation = new EndpointRelation();
endpointRelation.setEndpointId(sourceEndpointId);
endpointRelation.setEndpoint(sourceEndpointName);
endpointRelation.setServiceId(sourceServiceId);
endpointRelation.setServiceName(sourceServiceName);
endpointRelation.setServiceInstanceId(sourceServiceInstanceId);
endpointRelation.setServiceInstanceName(sourceServiceInstanceName);
endpointRelation.setChildEndpointId(destEndpointId);
endpointRelation.setChildEndpoint(destEndpointName);
endpointRelation.setChildServiceId(destServiceId);
endpointRelation.setChildServiceName(destServiceName);
endpointRelation.setChildServiceInstanceId(destServiceInstanceId);
endpointRelation.setChildServiceInstanceName(destServiceInstanceName);
endpointRelation.setRpcLatency(latency);
endpointRelation.setStatus(status);
endpointRelation.setResponseCode(responseCode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册