提交 40eeb873 编写于 作者: P peng-yongsheng

1. Get the service id only when agent register service name.

2. Setting the src span type when agent register service name.
3. Revert the topology build logic.
上级 09f9c120
...@@ -54,7 +54,7 @@ public class ServiceNameDiscoveryServiceHandler extends ServiceNameDiscoveryServ ...@@ -54,7 +54,7 @@ public class ServiceNameDiscoveryServiceHandler extends ServiceNameDiscoveryServ
int applicationId = serviceNameElement.getApplicationId(); int applicationId = serviceNameElement.getApplicationId();
String serviceName = serviceNameElement.getServiceName(); String serviceName = serviceNameElement.getServiceName();
int srcSpanType = serviceNameElement.getSrcSpanTypeValue(); int srcSpanType = serviceNameElement.getSrcSpanTypeValue();
int serviceId = serviceNameService.getOrCreate(applicationId, srcSpanType, serviceName); int serviceId = serviceNameService.get(applicationId, srcSpanType, serviceName);
if (serviceId != 0) { if (serviceId != 0) {
ServiceNameMappingElement.Builder mappingElement = ServiceNameMappingElement.newBuilder(); ServiceNameMappingElement.Builder mappingElement = ServiceNameMappingElement.newBuilder();
......
...@@ -24,5 +24,8 @@ import org.apache.skywalking.apm.collector.core.module.Service; ...@@ -24,5 +24,8 @@ import org.apache.skywalking.apm.collector.core.module.Service;
* @author peng-yongsheng * @author peng-yongsheng
*/ */
public interface IServiceNameService extends Service { public interface IServiceNameService extends Service {
int getOrCreate(int applicationId, int srcSpanType, String serviceName); int getOrCreate(int applicationId, int srcSpanType, String serviceName);
int get(int applicationId, int srcSpanType, String serviceName);
} }
...@@ -74,4 +74,8 @@ public class ServiceNameService implements IServiceNameService { ...@@ -74,4 +74,8 @@ public class ServiceNameService implements IServiceNameService {
} }
return serviceId; return serviceId;
} }
@Override public int get(int applicationId, int srcSpanType, String serviceName) {
return getServiceIdCacheService().get(applicationId, srcSpanType, serviceName);
}
} }
...@@ -27,6 +27,7 @@ import org.apache.skywalking.apm.network.proto.UniqueId; ...@@ -27,6 +27,7 @@ import org.apache.skywalking.apm.network.proto.UniqueId;
* @author peng-yongsheng * @author peng-yongsheng
*/ */
public class ReferenceDecorator implements StandardBuilder { public class ReferenceDecorator implements StandardBuilder {
private boolean isOrigin = true; private boolean isOrigin = true;
private StandardBuilder standardBuilder; private StandardBuilder standardBuilder;
private TraceSegmentReference referenceObject; private TraceSegmentReference referenceObject;
......
...@@ -65,7 +65,7 @@ public class SpanIdExchanger implements IdExchanger<SpanDecorator> { ...@@ -65,7 +65,7 @@ public class SpanIdExchanger implements IdExchanger<SpanDecorator> {
standardBuilder.setPeer(Const.EMPTY_STRING); standardBuilder.setPeer(Const.EMPTY_STRING);
int spanLayer = standardBuilder.getSpanLayerValue(); int spanLayer = standardBuilder.getSpanLayerValue();
int serverType = ServerTypeDefine.getInstance().getServerTypeByComponentId(standardBuilder.getComponentId()).getId(); int serverType = ServerTypeDefine.getInstance().getServerTypeId(standardBuilder.getComponentId());
networkAddressIDService.update(peerId, spanLayer, serverType); networkAddressIDService.update(peerId, spanLayer, serverType);
} }
} }
......
...@@ -22,25 +22,25 @@ package org.apache.skywalking.apm.collector.storage.table.register; ...@@ -22,25 +22,25 @@ package org.apache.skywalking.apm.collector.storage.table.register;
* @author peng-yongsheng * @author peng-yongsheng
*/ */
public class ServerType { public class ServerType {
private int id;
private int componentId; private int componentId;
private int id;
private String name; private String name;
public ServerType(int id, String name) { public ServerType(int componentId, int id, String name) {
this.componentId = componentId;
this.id = id; this.id = id;
this.name = name; this.name = name;
this.componentId = id;
} }
public int getId() { public int getId() {
return id; return id;
} }
public int getComponentId() {
return componentId;
}
public String getName() { public String getName() {
return name; return name;
} }
public int getComponentId() {
return componentId;
}
} }
...@@ -28,46 +28,41 @@ public class ServerTypeDefine { ...@@ -28,46 +28,41 @@ public class ServerTypeDefine {
private static ServerTypeDefine INSTANCE = new ServerTypeDefine(); private static ServerTypeDefine INSTANCE = new ServerTypeDefine();
private String[] serverTypeNames;
private ServerType[] serverTypes; private ServerType[] serverTypes;
private static final String HTTP = "http";
private static final String GRPC = "gRPC";
private static final String DUBBO = "dubbo";
private static final String MOTAN = "motan";
private static final String CLIENT = "client";
private static final String JDBC_DRIVER = "JDBC driver";
private ServerTypeDefine() { private ServerTypeDefine() {
this.serverTypes = new ServerType[30]; this.serverTypes = new ServerType[30];
addServerType(new ServerType(ComponentsDefine.TOMCAT.getId(), Const.EMPTY_STRING)); this.serverTypeNames = new String[11];
addServerType(new ServerType(ComponentsDefine.HTTPCLIENT.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.TOMCAT.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.DUBBO.getId(), DUBBO)); addServerType(new ServerType(ComponentsDefine.HTTPCLIENT.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.H2.getId(), JDBC_DRIVER)); addServerType(new ServerType(ComponentsDefine.DUBBO.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.MYSQL.getId(), JDBC_DRIVER)); addServerType(new ServerType(ComponentsDefine.H2.getId(), 1, ComponentsDefine.H2.getName()));
addServerType(new ServerType(ComponentsDefine.ORACLE.getId(), JDBC_DRIVER)); addServerType(new ServerType(ComponentsDefine.MYSQL.getId(), 2, ComponentsDefine.MYSQL.getName()));
addServerType(new ServerType(ComponentsDefine.REDIS.getId(), CLIENT)); addServerType(new ServerType(ComponentsDefine.ORACLE.getId(), 3, ComponentsDefine.ORACLE.getName()));
addServerType(new ServerType(ComponentsDefine.MOTAN.getId(), MOTAN)); addServerType(new ServerType(ComponentsDefine.REDIS.getId(), 4, ComponentsDefine.REDIS.getName()));
addServerType(new ServerType(ComponentsDefine.MONGODB.getId(), CLIENT)); addServerType(new ServerType(ComponentsDefine.MOTAN.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.RESIN.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.MONGODB.getId(), 5, ComponentsDefine.MONGODB.getName()));
addServerType(new ServerType(ComponentsDefine.FEIGN.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.RESIN.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.OKHTTP.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.FEIGN.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.SPRING_REST_TEMPLATE.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.OKHTTP.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.SPRING_MVC_ANNOTATION.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.SPRING_REST_TEMPLATE.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.STRUTS2.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.SPRING_MVC_ANNOTATION.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.NUTZ_MVC_ANNOTATION.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.STRUTS2.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.NUTZ_HTTP.getId(), HTTP)); addServerType(new ServerType(ComponentsDefine.NUTZ_MVC_ANNOTATION.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.JETTY_CLIENT.getId(), HTTP)); addServerType(new ServerType(ComponentsDefine.NUTZ_HTTP.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.JETTY_SERVER.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.JETTY_CLIENT.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.MEMCACHED.getId(), CLIENT)); addServerType(new ServerType(ComponentsDefine.JETTY_SERVER.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.SHARDING_JDBC.getId(), JDBC_DRIVER)); addServerType(new ServerType(ComponentsDefine.MEMCACHED.getId(), 6, ComponentsDefine.MEMCACHED.getName()));
addServerType(new ServerType(ComponentsDefine.POSTGRESQL.getId(), JDBC_DRIVER)); addServerType(new ServerType(ComponentsDefine.SHARDING_JDBC.getId(), 7, ComponentsDefine.SHARDING_JDBC.getName()));
addServerType(new ServerType(ComponentsDefine.GRPC.getId(), GRPC)); addServerType(new ServerType(ComponentsDefine.POSTGRESQL.getId(), 8, ComponentsDefine.POSTGRESQL.getName()));
addServerType(new ServerType(ComponentsDefine.ELASTIC_JOB.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.GRPC.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.ROCKET_MQ.getId(), CLIENT)); addServerType(new ServerType(ComponentsDefine.ELASTIC_JOB.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.HTTP_ASYNC_CLIENT.getId(), HTTP)); addServerType(new ServerType(ComponentsDefine.ROCKET_MQ.getId(), 9, ComponentsDefine.ROCKET_MQ.getName()));
addServerType(new ServerType(ComponentsDefine.KAFKA.getId(), CLIENT)); addServerType(new ServerType(ComponentsDefine.HTTP_ASYNC_CLIENT.getId(), Const.NONE, Const.EMPTY_STRING));
addServerType(new ServerType(ComponentsDefine.SERVICECOMB.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.KAFKA.getId(), 10, ComponentsDefine.KAFKA.getName()));
addServerType(new ServerType(ComponentsDefine.HYSTRIX.getId(), Const.EMPTY_STRING)); addServerType(new ServerType(ComponentsDefine.SERVICECOMB.getId(), Const.NONE, ComponentsDefine.SERVICECOMB.getName()));
addServerType(new ServerType(ComponentsDefine.HYSTRIX.getId(), Const.NONE, ComponentsDefine.HYSTRIX.getName()));
} }
public static ServerTypeDefine getInstance() { public static ServerTypeDefine getInstance() {
...@@ -75,14 +70,15 @@ public class ServerTypeDefine { ...@@ -75,14 +70,15 @@ public class ServerTypeDefine {
} }
private void addServerType(ServerType serverType) { private void addServerType(ServerType serverType) {
serverTypes[serverType.getId()] = serverType; serverTypeNames[serverType.getId()] = serverType.getName();
serverTypes[serverType.getComponentId()] = serverType;
} }
public ServerType getServerTypeByComponentId(int componentId) { public int getServerTypeId(int componentId) {
return serverTypes[componentId]; return serverTypes[componentId].getId();
} }
public ServerType getServerType(int serverTypeId) { public String getServerType(int serverTypeId) {
return serverTypes[serverTypeId]; return serverTypeNames[serverTypeId];
} }
} }
...@@ -35,7 +35,7 @@ public class ServerTypeDefineTestCase { ...@@ -35,7 +35,7 @@ public class ServerTypeDefineTestCase {
for (Field field : fields) { for (Field field : fields) {
if (field.getType().equals(OfficialComponent.class)) { if (field.getType().equals(OfficialComponent.class)) {
OfficialComponent component = (OfficialComponent)field.get(ComponentsDefine.getInstance()); OfficialComponent component = (OfficialComponent)field.get(ComponentsDefine.getInstance());
ServerTypeDefine.getInstance().getServerTypeByComponentId(component.getId()); ServerTypeDefine.getInstance().getServerTypeId(component.getId());
} }
} }
} }
......
...@@ -40,7 +40,6 @@ import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp; ...@@ -40,7 +40,6 @@ import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp;
import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief; import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief;
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric; import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
import org.apache.skywalking.apm.collector.ui.utils.DurationUtils; import org.apache.skywalking.apm.collector.ui.utils.DurationUtils;
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -118,8 +117,8 @@ public class ApplicationService { ...@@ -118,8 +117,8 @@ public class ApplicationService {
long endSecondTimeBucket) throws ParseException { long endSecondTimeBucket) throws ParseException {
List<ConjecturalApp> conjecturalApps = networkAddressUIDAO.getConjecturalApps(); List<ConjecturalApp> conjecturalApps = networkAddressUIDAO.getConjecturalApps();
conjecturalApps.forEach(conjecturalApp -> { conjecturalApps.forEach(conjecturalApp -> {
int componentId = ServerTypeDefine.getInstance().getServerType(conjecturalApp.getId()).getComponentId(); String serverType = ServerTypeDefine.getInstance().getServerType(conjecturalApp.getId());
conjecturalApp.setName(ComponentsDefine.getInstance().getComponentName(componentId)); conjecturalApp.setName(serverType);
}); });
ConjecturalAppBrief conjecturalAppBrief = new ConjecturalAppBrief(); ConjecturalAppBrief conjecturalAppBrief = new ConjecturalAppBrief();
......
...@@ -73,8 +73,8 @@ public class ServiceTopologyService { ...@@ -73,8 +73,8 @@ public class ServiceTopologyService {
Map<Integer, String> components = new HashMap<>(); Map<Integer, String> components = new HashMap<>();
applicationComponents.forEach(component -> components.put(component.getApplicationId(), ComponentsDefine.getInstance().getComponentName(component.getComponentId()))); applicationComponents.forEach(component -> components.put(component.getApplicationId(), ComponentsDefine.getInstance().getComponentName(component.getComponentId())));
List<IServiceReferenceMetricUIDAO.ServiceReferenceMetric> referenceMetrics = serviceReferenceMetricUIDAO.getFrontServices(step, startTimeBucket, endTimeBucket, MetricSource.Callee, serviceId); List<IServiceReferenceMetricUIDAO.ServiceReferenceMetric> referenceMetrics = serviceReferenceMetricUIDAO.getFrontServices(step, startTimeBucket, endTimeBucket, MetricSource.Caller, serviceId);
referenceMetrics.addAll(serviceReferenceMetricUIDAO.getBehindServices(step, startTimeBucket, endTimeBucket, MetricSource.Caller, serviceId)); referenceMetrics.addAll(serviceReferenceMetricUIDAO.getBehindServices(step, startTimeBucket, endTimeBucket, MetricSource.Callee, serviceId));
Set<Integer> nodeIds = new HashSet<>(); Set<Integer> nodeIds = new HashSet<>();
......
...@@ -33,7 +33,6 @@ import org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUID ...@@ -33,7 +33,6 @@ import org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUID
import org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMetricUIDAO; import org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMetricUIDAO;
import org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationReferenceMetricUIDAO; import org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationReferenceMetricUIDAO;
import org.apache.skywalking.apm.collector.storage.table.register.Application; import org.apache.skywalking.apm.collector.storage.table.register.Application;
import org.apache.skywalking.apm.collector.storage.table.register.ServerTypeDefine;
import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm; import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
import org.apache.skywalking.apm.collector.storage.ui.application.ApplicationNode; import org.apache.skywalking.apm.collector.storage.ui.application.ApplicationNode;
import org.apache.skywalking.apm.collector.storage.ui.application.ConjecturalNode; import org.apache.skywalking.apm.collector.storage.ui.application.ConjecturalNode;
...@@ -72,8 +71,7 @@ class TopologyBuilder { ...@@ -72,8 +71,7 @@ class TopologyBuilder {
List<IApplicationReferenceMetricUIDAO.ApplicationReferenceMetric> callerReferenceMetric, List<IApplicationReferenceMetricUIDAO.ApplicationReferenceMetric> callerReferenceMetric,
List<IApplicationReferenceMetricUIDAO.ApplicationReferenceMetric> calleeReferenceMetric, List<IApplicationReferenceMetricUIDAO.ApplicationReferenceMetric> calleeReferenceMetric,
long startTimeBucket, long endTimeBucket, long startSecondTimeBucket, long endSecondTimeBucket) { long startTimeBucket, long endTimeBucket, long startSecondTimeBucket, long endSecondTimeBucket) {
Map<Integer, String> componentNames = changeNodeCompName2Map(applicationComponents); Map<Integer, String> components = changeNodeComp2Map(applicationComponents);
Map<Integer, Integer> componentIds = changeNodeCompId2Map(applicationComponents);
Map<Integer, Integer> mappings = changeMapping2Map(applicationMappings); Map<Integer, Integer> mappings = changeMapping2Map(applicationMappings);
calleeReferenceMetric = calleeReferenceMetricFilter(calleeReferenceMetric); calleeReferenceMetric = calleeReferenceMetricFilter(calleeReferenceMetric);
...@@ -85,7 +83,7 @@ class TopologyBuilder { ...@@ -85,7 +83,7 @@ class TopologyBuilder {
ApplicationNode applicationNode = new ApplicationNode(); ApplicationNode applicationNode = new ApplicationNode();
applicationNode.setId(applicationId); applicationNode.setId(applicationId);
applicationNode.setName(application.getApplicationCode()); applicationNode.setName(application.getApplicationCode());
applicationNode.setType(componentNames.getOrDefault(application.getApplicationId(), Const.UNKNOWN)); applicationNode.setType(components.getOrDefault(application.getApplicationId(), Const.UNKNOWN));
applicationNode.setSla(SLACalculator.INSTANCE.calculate(applicationMetric.getErrorCalls(), applicationMetric.getCalls())); applicationNode.setSla(SLACalculator.INSTANCE.calculate(applicationMetric.getErrorCalls(), applicationMetric.getCalls()));
try { try {
...@@ -131,7 +129,7 @@ class TopologyBuilder { ...@@ -131,7 +129,7 @@ class TopologyBuilder {
ConjecturalNode conjecturalNode = new ConjecturalNode(); ConjecturalNode conjecturalNode = new ConjecturalNode();
conjecturalNode.setId(target.getApplicationId()); conjecturalNode.setId(target.getApplicationId());
conjecturalNode.setName(target.getApplicationCode()); conjecturalNode.setName(target.getApplicationCode());
conjecturalNode.setType(componentNames.getOrDefault(target.getApplicationId(), Const.UNKNOWN)); conjecturalNode.setType(components.getOrDefault(target.getApplicationId(), Const.UNKNOWN));
nodes.add(conjecturalNode); nodes.add(conjecturalNode);
} }
...@@ -143,7 +141,7 @@ class TopologyBuilder { ...@@ -143,7 +141,7 @@ class TopologyBuilder {
call.setTarget(actualTargetId); call.setTarget(actualTargetId);
call.setTargetName(applicationCacheService.getApplicationById(actualTargetId).getApplicationCode()); call.setTargetName(applicationCacheService.getApplicationById(actualTargetId).getApplicationCode());
call.setAlert(false); call.setAlert(false);
call.setCallType(ServerTypeDefine.getInstance().getServerTypeByComponentId(componentIds.get(referenceMetric.getTarget())).getName()); call.setCallType(components.get(referenceMetric.getTarget()));
try { try {
call.setCallsPerSec(referenceMetric.getCalls() / secondBetweenService.calculate(source.getApplicationId(), startSecondTimeBucket, endSecondTimeBucket)); call.setCallsPerSec(referenceMetric.getCalls() / secondBetweenService.calculate(source.getApplicationId(), startSecondTimeBucket, endSecondTimeBucket));
} catch (ParseException e) { } catch (ParseException e) {
...@@ -169,7 +167,7 @@ class TopologyBuilder { ...@@ -169,7 +167,7 @@ class TopologyBuilder {
ConjecturalNode conjecturalNode = new ConjecturalNode(); ConjecturalNode conjecturalNode = new ConjecturalNode();
conjecturalNode.setId(source.getApplicationId()); conjecturalNode.setId(source.getApplicationId());
conjecturalNode.setName(source.getApplicationCode()); conjecturalNode.setName(source.getApplicationCode());
conjecturalNode.setType(componentNames.getOrDefault(source.getApplicationId(), Const.UNKNOWN)); conjecturalNode.setType(components.getOrDefault(source.getApplicationId(), Const.UNKNOWN));
nodes.add(conjecturalNode); nodes.add(conjecturalNode);
} }
...@@ -183,7 +181,7 @@ class TopologyBuilder { ...@@ -183,7 +181,7 @@ class TopologyBuilder {
if (source.getApplicationId() == Const.NONE_APPLICATION_ID) { if (source.getApplicationId() == Const.NONE_APPLICATION_ID) {
call.setCallType(Const.EMPTY_STRING); call.setCallType(Const.EMPTY_STRING);
} else { } else {
call.setCallType(ServerTypeDefine.getInstance().getServerTypeByComponentId(componentIds.get(referenceMetric.getTarget())).getName()); call.setCallType(components.get(referenceMetric.getTarget()));
} }
try { try {
call.setCallsPerSec(referenceMetric.getCalls() / secondBetweenService.calculate(target.getApplicationId(), startSecondTimeBucket, endSecondTimeBucket)); call.setCallsPerSec(referenceMetric.getCalls() / secondBetweenService.calculate(target.getApplicationId(), startSecondTimeBucket, endSecondTimeBucket));
...@@ -221,7 +219,7 @@ class TopologyBuilder { ...@@ -221,7 +219,7 @@ class TopologyBuilder {
return mappings; return mappings;
} }
private Map<Integer, String> changeNodeCompName2Map( private Map<Integer, String> changeNodeComp2Map(
List<IApplicationComponentUIDAO.ApplicationComponent> applicationComponents) { List<IApplicationComponentUIDAO.ApplicationComponent> applicationComponents) {
Map<Integer, String> components = new HashMap<>(); Map<Integer, String> components = new HashMap<>();
applicationComponents.forEach(applicationComponent -> { applicationComponents.forEach(applicationComponent -> {
...@@ -230,13 +228,4 @@ class TopologyBuilder { ...@@ -230,13 +228,4 @@ class TopologyBuilder {
}); });
return components; return components;
} }
private Map<Integer, Integer> changeNodeCompId2Map(
List<IApplicationComponentUIDAO.ApplicationComponent> applicationComponents) {
Map<Integer, Integer> components = new HashMap<>();
applicationComponents.forEach(applicationComponent -> {
components.put(applicationComponent.getApplicationId(), applicationComponent.getComponentId());
});
return components;
}
} }
...@@ -74,6 +74,7 @@ public enum OperationNameDictionary { ...@@ -74,6 +74,7 @@ public enum OperationNameDictionary {
ServiceNameElement serviceNameElement = ServiceNameElement.newBuilder() ServiceNameElement serviceNameElement = ServiceNameElement.newBuilder()
.setApplicationId(operationNameKey.getApplicationId()) .setApplicationId(operationNameKey.getApplicationId())
.setServiceName(operationNameKey.getOperationName()) .setServiceName(operationNameKey.getOperationName())
.setSrcSpanType(operationNameKey.getSpanType())
.build(); .build();
builder.addElements(serviceNameElement); builder.addElements(serviceNameElement);
} }
...@@ -122,9 +123,14 @@ public enum OperationNameDictionary { ...@@ -122,9 +123,14 @@ public enum OperationNameDictionary {
OperationNameKey key = (OperationNameKey)o; OperationNameKey key = (OperationNameKey)o;
if (applicationId != key.applicationId) boolean isApplicationMatch = false;
return false; if (applicationId == key.applicationId) {
return operationName.equals(key.operationName); isApplicationMatch = true;
} else if (operationName.equals(key.operationName)) {
isApplicationMatch = true;
}
return isApplicationMatch && isEntry == key.isEntry
&& isExit == key.isExit;
} }
@Override public int hashCode() { @Override public int hashCode() {
...@@ -140,5 +146,15 @@ public enum OperationNameDictionary { ...@@ -140,5 +146,15 @@ public enum OperationNameDictionary {
boolean isExit() { boolean isExit() {
return isExit; return isExit;
} }
SpanType getSpanType() {
if (isEntry) {
return SpanType.Entry;
} else if (isExit) {
return SpanType.Exit;
} else {
return SpanType.Local;
}
}
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册