diff --git a/.gitignore b/.gitignore index 50b3b97f8880a71a5c5dd92ca5a7722e2024f829..c8c84886d0767eecbb7bb753f19bf5dffb778e1b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ OALLexer.tokens .vscode .checkstyle .externalToolBuilders +/test/plugin/dist +/test/plugin/workspace diff --git a/CHANGES.md b/CHANGES.md index 21aa616bcce8c6611cccbfcf669b26a0346d9be5..8724c472a08d0a88278e55a3c9d100b35bc4693b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,15 @@ Changes by Version ================== Release Notes. +6.6.0 +------------------ +TODO + +#### Project +- [**IMPORTANT**] Local span and exit span are not treated as endpoint detected at client and local. Only entry span is the endpoint. Reduce the load of register and memory cost. + +All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/37?closed=1) + 6.5.0 ------------------ @@ -74,6 +83,8 @@ Release Notes. - Update als setup doc as istio 1.3 released (#3470) - Fill faq reply in official document. (#3450) +All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/36?closed=1) + 6.4.0 ------------------ diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java index 5e788a35a321837457f36dadbd76c336e90d51ff..2bc276c3b58edb6d7bc0862fa9574437fbfc169e 100755 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java @@ -317,11 +317,14 @@ public class Config { */ public static class OPGroup { /** - * Rules for RestTemplate plugin + * Since 6.6.0, exit span is not requesting endpoint register, + * this group rule is not required. + * + * Keep this commented, just as a reminder that, it will be reused in a RPC server side plugin. */ - public static class RestTemplate implements OPGroupDefinition { - public static Map RULE = new HashMap(); - } +// public static class RestTemplate implements OPGroupDefinition { +// public static Map RULE = new HashMap(); +// } } public static class Light4J { diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java index f8db1307322022997a8e8729d31f4b8c375fb011..ccb9aae523513298321938ee689015664f9e849b 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java @@ -74,7 +74,7 @@ public class TracingContext implements AbstractTracerContext { /** * Active spans stored in a Stack, usually called 'ActiveSpanStack'. This {@link LinkedList} is the in-memory * storage-structure.

I use {@link LinkedList#removeLast()}, {@link LinkedList#addLast(Object)} and {@link - * LinkedList#last} instead of {@link #pop()}, {@link #push(AbstractSpan)}, {@link #peek()} + * LinkedList#getLast()} instead of {@link #pop()}, {@link #push(AbstractSpan)}, {@link #peek()} */ private LinkedList activeSpanStack = new LinkedList(); @@ -131,34 +131,58 @@ public class TracingContext implements AbstractTracerContext { } else { carrier.setPeerId(peerId); } + + AbstractSpan firstSpan = first(); + String firstSpanOperationName = firstSpan.getOperationName(); + List refs = this.segment.getRefs(); - int operationId; - String operationName; + int operationId = DictionaryUtil.inexistence(); + String operationName = ""; int entryApplicationInstanceId; + if (refs != null && refs.size() > 0) { TraceSegmentRef ref = refs.get(0); operationId = ref.getEntryEndpointId(); operationName = ref.getEntryEndpointName(); entryApplicationInstanceId = ref.getEntryServiceInstanceId(); } else { - AbstractSpan firstSpan = first(); - operationId = firstSpan.getOperationId(); - operationName = firstSpan.getOperationName(); + if (firstSpan.isEntry()) { + /** + * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), + * rather than an endpoint. + */ + operationId = firstSpan.getOperationId(); + operationName = firstSpanOperationName; + } entryApplicationInstanceId = this.segment.getApplicationInstanceId(); + } carrier.setEntryServiceInstanceId(entryApplicationInstanceId); if (operationId == DictionaryUtil.nullValue()) { if (!StringUtil.isEmpty(operationName)) { carrier.setEntryEndpointName(operationName); + } else { + /** + * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), + * rather than an endpoint. + */ } } else { carrier.setEntryEndpointId(operationId); } - int parentOperationId = first().getOperationId(); + int parentOperationId = firstSpan.getOperationId(); if (parentOperationId == DictionaryUtil.nullValue()) { - carrier.setParentEndpointName(first().getOperationName()); + if (firstSpan.isEntry() && !StringUtil.isEmpty(firstSpanOperationName)) { + carrier.setParentEndpointName(firstSpanOperationName); + } else { + /** + * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), + * rather than an endpoint. + */ + carrier.setParentEndpointId(DictionaryUtil.inexistence()); + } } else { carrier.setParentEndpointId(parentOperationId); } @@ -195,17 +219,27 @@ public class TracingContext implements AbstractTracerContext { activeSpan().getSpanId(), segment.getRelatedGlobalTraces()); int entryOperationId; - String entryOperationName; + String entryOperationName = ""; int entryApplicationInstanceId; AbstractSpan firstSpan = first(); + String firstSpanOperationName = firstSpan.getOperationName(); + if (refs != null && refs.size() > 0) { TraceSegmentRef ref = refs.get(0); entryOperationId = ref.getEntryEndpointId(); entryOperationName = ref.getEntryEndpointName(); entryApplicationInstanceId = ref.getEntryServiceInstanceId(); } else { - entryOperationId = firstSpan.getOperationId(); - entryOperationName = firstSpan.getOperationName(); + if (firstSpan.isEntry()) { + entryOperationId = firstSpan.getOperationId(); + entryOperationName = firstSpanOperationName; + } else { + /** + * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), + * rather than an endpoint. + */ + entryOperationId = DictionaryUtil.inexistence(); + } entryApplicationInstanceId = this.segment.getApplicationInstanceId(); } snapshot.setEntryApplicationInstanceId(entryApplicationInstanceId); @@ -213,15 +247,29 @@ public class TracingContext implements AbstractTracerContext { if (entryOperationId == DictionaryUtil.nullValue()) { if (!StringUtil.isEmpty(entryOperationName)) { snapshot.setEntryOperationName(entryOperationName); + } else { + /** + * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), + * rather than an endpoint. + */ } } else { snapshot.setEntryOperationId(entryOperationId); } - if (firstSpan.getOperationId() == DictionaryUtil.nullValue()) { - snapshot.setParentOperationName(firstSpan.getOperationName()); + int parentOperationId = firstSpan.getOperationId(); + if (parentOperationId == DictionaryUtil.nullValue()) { + if (firstSpan.isEntry() && !StringUtil.isEmpty(firstSpanOperationName)) { + snapshot.setParentOperationName(firstSpanOperationName); + } else { + /** + * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), + * rather than an endpoint. + */ + snapshot.setParentOperationId(DictionaryUtil.inexistence()); + } } else { - snapshot.setParentOperationId(firstSpan.getOperationId()); + snapshot.setParentOperationId(parentOperationId); } return snapshot; } @@ -341,39 +389,13 @@ public class TracingContext implements AbstractTracerContext { new PossibleFound.FoundAndObtain() { @Override public Object doProcess(final int peerId) { - return DictionaryManager.findEndpointSection() - .findOnly(segment.getServiceId(), operationName) - .doInCondition( - new PossibleFound.FoundAndObtain() { - @Override - public Object doProcess(int operationId) { - return new ExitSpan(spanIdGenerator++, parentSpanId, operationId, peerId); - } - }, new PossibleFound.NotFoundAndObtain() { - @Override - public Object doProcess() { - return new ExitSpan(spanIdGenerator++, parentSpanId, operationName, peerId); - } - }); + return new ExitSpan(spanIdGenerator++, parentSpanId, operationName, peerId); } }, new PossibleFound.NotFoundAndObtain() { @Override public Object doProcess() { - return DictionaryManager.findEndpointSection() - .findOnly(segment.getServiceId(), operationName) - .doInCondition( - new PossibleFound.FoundAndObtain() { - @Override - public Object doProcess(int operationId) { - return new ExitSpan(spanIdGenerator++, parentSpanId, operationId, remotePeer); - } - }, new PossibleFound.NotFoundAndObtain() { - @Override - public Object doProcess() { - return new ExitSpan(spanIdGenerator++, parentSpanId, operationName, remotePeer); - } - }); + return new ExitSpan(spanIdGenerator++, parentSpanId, operationName, remotePeer); } }); push(exitSpan); diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java index afb0dfa1e4ef49ef1aabef41f3171cd5a078375b..cdf26a8d7e10c2e6efaba1228904c6cb3f8fc43e 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java @@ -89,21 +89,26 @@ public abstract class StackBasedTracingSpan extends AbstractTracingSpan { @Override public boolean finish(TraceSegment owner) { if (--stackDepth == 0) { - if (this.operationId == DictionaryUtil.nullValue()) { - this.operationId = (Integer)DictionaryManager.findEndpointSection() - .findOrPrepare4Register(owner.getServiceId(), operationName, this.isEntry(), this.isExit()) - .doInCondition( - new PossibleFound.FoundAndObtain() { - @Override public Object doProcess(int value) { - return value; + /** + * Since 6.6.0, only entry span requires the op name register, which is endpoint. + */ + if (this.isEntry()) { + if (this.operationId == DictionaryUtil.nullValue()) { + this.operationId = (Integer)DictionaryManager.findEndpointSection() + .findOrPrepare4Register(owner.getServiceId(), operationName) + .doInCondition( + new PossibleFound.FoundAndObtain() { + @Override public Object doProcess(int value) { + return value; + } + }, + new PossibleFound.NotFoundAndObtain() { + @Override public Object doProcess() { + return DictionaryUtil.nullValue(); + } } - }, - new PossibleFound.NotFoundAndObtain() { - @Override public Object doProcess() { - return DictionaryUtil.nullValue(); - } - } - ); + ); + } } return super.finish(owner); } else { diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java index 2f5b357fbe812008fa9243cfc4629bf4c0e81721..d8ac1d55ec89c26effda301b0de6eaf36462787f 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java @@ -30,4 +30,11 @@ public class DictionaryUtil { public static boolean isNull(int id) { return id == nullValue(); } + + /** + * @return -1 represent the object doesn't exist. + */ + public static int inexistence() { + return -1; + } } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java index 1f28a805c030f13aeb9b4a58f0d69c0c47afbe03..3447d8a18e1aaa0e970e72436b6ba121c521689b 100755 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java @@ -37,21 +37,20 @@ public enum EndpointNameDictionary { private Map endpointDictionary = new ConcurrentHashMap(); private Set unRegisterEndpoints = new ConcurrentSet(); - public PossibleFound findOrPrepare4Register(int serviceId, String endpointName, - boolean isEntry, boolean isExit) { - return find0(serviceId, endpointName, isEntry, isExit, true); + public PossibleFound findOrPrepare4Register(int serviceId, String endpointName) { + return find0(serviceId, endpointName, true); } public PossibleFound findOnly(int serviceId, String endpointName) { - return find0(serviceId, endpointName, false, false, false); + return find0(serviceId, endpointName, false); } private PossibleFound find0(int serviceId, String endpointName, - boolean isEntry, boolean isExit, boolean registerWhenNotFound) { + boolean registerWhenNotFound) { if (endpointName == null || endpointName.length() == 0) { return new NotFound(); } - OperationNameKey key = new OperationNameKey(serviceId, endpointName, isEntry, isExit); + OperationNameKey key = new OperationNameKey(serviceId, endpointName); Integer operationId = endpointDictionary.get(key); if (operationId != null) { return new Found(operationId); @@ -72,7 +71,7 @@ public enum EndpointNameDictionary { Endpoint endpoint = Endpoint.newBuilder() .setServiceId(operationNameKey.getServiceId()) .setEndpointName(operationNameKey.getEndpointName()) - .setFrom(operationNameKey.getSpanType()) + .setFrom(DetectPoint.server) .build(); builder.addEndpoints(endpoint); } @@ -81,9 +80,7 @@ public enum EndpointNameDictionary { for (EndpointMappingElement element : serviceNameMappingCollection.getElementsList()) { OperationNameKey key = new OperationNameKey( element.getServiceId(), - element.getEndpointName(), - DetectPoint.server.equals(element.getFrom()), - DetectPoint.client.equals(element.getFrom())); + element.getEndpointName()); unRegisterEndpoints.remove(key); endpointDictionary.put(key, element.getEndpointId()); } @@ -98,14 +95,10 @@ public enum EndpointNameDictionary { private class OperationNameKey { private int serviceId; private String endpointName; - private boolean isEntry; - private boolean isExit; - public OperationNameKey(int serviceId, String endpointName, boolean isEntry, boolean isExit) { + public OperationNameKey(int serviceId, String endpointName) { this.serviceId = serviceId; this.endpointName = endpointName; - this.isEntry = isEntry; - this.isExit = isExit; } public int getServiceId() { @@ -128,8 +121,7 @@ public enum EndpointNameDictionary { if (serviceId == key.serviceId && endpointName.equals(key.endpointName)) { isServiceEndpointMatch = true; } - return isServiceEndpointMatch && isEntry == key.isEntry - && isExit == key.isExit; + return isServiceEndpointMatch; } @Override public int hashCode() { @@ -138,30 +130,11 @@ public enum EndpointNameDictionary { return result; } - boolean isEntry() { - return isEntry; - } - - boolean isExit() { - return isExit; - } - - DetectPoint getSpanType() { - if (isEntry) { - return DetectPoint.server; - } else if (isExit) { - return DetectPoint.client; - } else { - return DetectPoint.UNRECOGNIZED; - } - } @Override public String toString() { return "OperationNameKey{" + "serviceId=" + serviceId + ", endpointName='" + endpointName + '\'' + - ", isEntry=" + isEntry + - ", isExit=" + isExit + '}'; } } diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java index 81c0eb889397b6224eb5e2c8355d6ba30b0f4f59..48bbf2aff67d72e57a6980cfe22883a2428ca8d4 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java @@ -20,12 +20,9 @@ package org.apache.skywalking.apm.plugin.spring.resttemplate.async; import java.lang.reflect.Method; import java.net.URI; -import org.apache.skywalking.apm.agent.core.boot.ServiceManager; -import org.apache.skywalking.apm.agent.core.conf.Config; import org.apache.skywalking.apm.agent.core.context.ContextCarrier; import org.apache.skywalking.apm.agent.core.context.ContextManager; import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; -import org.apache.skywalking.apm.agent.core.context.OperationNameFormatService; import org.apache.skywalking.apm.agent.core.context.tag.Tags; import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; @@ -37,8 +34,6 @@ import org.apache.skywalking.apm.plugin.spring.commons.EnhanceCacheObjects; import org.springframework.http.HttpMethod; public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor { - private OperationNameFormatService nameFormatService; - @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { @@ -46,13 +41,9 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor final HttpMethod httpMethod = (HttpMethod)allArguments[1]; final ContextCarrier contextCarrier = new ContextCarrier(); - if (nameFormatService == null) { - nameFormatService = ServiceManager.INSTANCE.findService(OperationNameFormatService.class); - } - String remotePeer = requestURL.getHost() + ":" + (requestURL.getPort() > 0 ? requestURL.getPort() : "https".equalsIgnoreCase(requestURL.getScheme()) ? 443 : 80); - String formatURIPath = nameFormatService.formatOperationName(Config.Plugin.OPGroup.RestTemplate.class, requestURL.getPath()); + String formatURIPath = requestURL.getPath(); AbstractSpan span = ContextManager.createExitSpan( formatURIPath, contextCarrier, remotePeer); diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java index c5060b4ecfa81973b2d287cc63715b925abd85fc..66b0e779da2ae8258ac8c961e543caa6abb373da 100644 --- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java @@ -20,23 +20,18 @@ package org.apache.skywalking.apm.plugin.spring.resttemplate.sync; import java.lang.reflect.Method; import java.net.URI; -import org.apache.skywalking.apm.agent.core.boot.ServiceManager; -import org.apache.skywalking.apm.agent.core.conf.Config; import org.apache.skywalking.apm.agent.core.context.ContextCarrier; -import org.apache.skywalking.apm.agent.core.context.OperationNameFormatService; +import org.apache.skywalking.apm.agent.core.context.ContextManager; import org.apache.skywalking.apm.agent.core.context.tag.Tags; +import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; import org.springframework.http.HttpMethod; public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor { - private OperationNameFormatService nameFormatService; - @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { @@ -44,12 +39,8 @@ public class RestExecuteInterceptor implements InstanceMethodsAroundInterceptor final HttpMethod httpMethod = (HttpMethod)allArguments[1]; final ContextCarrier contextCarrier = new ContextCarrier(); - if (nameFormatService == null) { - nameFormatService = ServiceManager.INSTANCE.findService(OperationNameFormatService.class); - } - String remotePeer = requestURL.getHost() + ":" + (requestURL.getPort() > 0 ? requestURL.getPort() : "https".equalsIgnoreCase(requestURL.getScheme()) ? 443 : 80); - String formatURIPath = nameFormatService.formatOperationName(Config.Plugin.OPGroup.RestTemplate.class, requestURL.getPath()); + String formatURIPath = requestURL.getPath(); AbstractSpan span = ContextManager.createExitSpan(formatURIPath, contextCarrier, remotePeer); span.setComponent(ComponentsDefine.SPRING_REST_TEMPLATE); diff --git a/docs/en/FAQ/README.md b/docs/en/FAQ/README.md index eac44b5fb8c561457a24ffa3c473c8c6e6f643a0..3e0e79fcd7a23e317e660ef8c4cd49356551f13d 100644 --- a/docs/en/FAQ/README.md +++ b/docs/en/FAQ/README.md @@ -18,3 +18,4 @@ These are known and common FAQs. We welcome you to contribute yours. * [IllegalStateException when install Java agent on WebSphere 7](install_agent_on_websphere.md) * ["FORBIDDEN/12/index read-only / allow delete (api)" appears in the log](https://discuss.elastic.co/t/forbidden-12-index-read-only-allow-delete-api/110282) * [No data shown and backend replies with "Variable 'serviceId' has coerced Null value for NonNull type 'ID!'"](time-and-timezone.md) +* [**Unexpected endpoint register** warning after 6.6.0](Unexpected-endpoint-register.md) diff --git a/docs/en/FAQ/Unexpected-endpoint-register.md b/docs/en/FAQ/Unexpected-endpoint-register.md new file mode 100644 index 0000000000000000000000000000000000000000..dd732daef683ab881c1c14328e018781efaf9848 --- /dev/null +++ b/docs/en/FAQ/Unexpected-endpoint-register.md @@ -0,0 +1,12 @@ +# Local span and Exit span should not be register + +Since 6.6.0, SkyWalking cancelled the local span and exit span register. If old java agent(before 6.6.0) is still running, +and do register to 6.6.0+ backend, you will face the following warning message. +``` +class=RegisterServiceHandler, message = Unexpected endpoint register, endpoint isn't detected from server side. +``` + +This will not harm the backend or cause any issue. This is a reminder that, your agent or other client should follow the new protocol +requirements. + +You could simply use `log4j2.xml` to filter this warning message out. \ No newline at end of file diff --git a/docs/en/guides/Plugin-test.md b/docs/en/guides/Plugin-test.md index 7d6c3ac5ddd21ceb3b24d5d08aa634a00b639a33..207e41a18cc194d9b0fb692788e6a7ff2eb5af35 100644 --- a/docs/en/guides/Plugin-test.md +++ b/docs/en/guides/Plugin-test.md @@ -230,7 +230,7 @@ registryItems: | --- | --- | applications | The registered service codes. Normally, not 0 should be enough. | instances | The number of service instances exists in this test case. -| operationNames | All endpoint registered in this test case. Also means, the operation names of all entry and exit spans. +| operationNames | All endpoint registered in this test case. Also means, the operation names of all entry spans. **Segment verify description format** diff --git a/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md b/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md index 74d64eb5551e058887724b0ab8d7fd1b47807015..fa4b4a73b0f257d38f32085d334a1a5106caa8bc 100644 --- a/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md +++ b/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md @@ -38,6 +38,8 @@ _This value can use exchange/compress collector service to get the id(integer) t 1. Parent endpoint of the parent service. **String(BASE64 encoded)**. _This value can use exchange/compress collector service to get the id(integer) to represent the string. If you use the string, it must start with `#`, others use integer directly._ +endpoint id = -1 and parent endpoint name is empty mean there is no real parent endpoint. Since 6.6.0 + ## Sample values 1. Short version, `1-TRACEID-SEGMENTID-3-5-2-IPPORT` 1. Complete version, `1-TRACEID-SEGMENTID-3-5-2-IPPORT-ENTRYURI-PARENTURI` diff --git a/docs/en/setup/service-agent/java-agent/README.md b/docs/en/setup/service-agent/java-agent/README.md index bf80d5f39cdc4c44c9ae78de816ce2a31b025484..787d90ea3f99190f25948203e9d40c766e43fc16 100755 --- a/docs/en/setup/service-agent/java-agent/README.md +++ b/docs/en/setup/service-agent/java-agent/README.md @@ -158,6 +158,9 @@ Now, we have the following known bootstrap plugins. SkyWalking java agent supports plugin to extend [the supported list](Supported-list.md). Please follow our [Plugin Development Guide](../../../guides/Java-Plugin-Development-Guide.md). +If some RPC framework endpoints(server side) could include parameter, please read [Operation Name Group Rule](op_name_group_rule.md), +and consider to add this feature. + # Test If you are interested in plugin compatible tests or agent performance, see the following reports. * [Plugin Test](https://github.com/SkyAPMTest/agent-integration-test-report) diff --git a/docs/en/setup/service-agent/java-agent/op_name_group_rule.md b/docs/en/setup/service-agent/java-agent/op_name_group_rule.md index ea24f186199c7b24a373276f8ea06cf672ccc9d1..6deaca2c0d4352466e2e7adfa41ffb62c492bd30 100644 --- a/docs/en/setup/service-agent/java-agent/op_name_group_rule.md +++ b/docs/en/setup/service-agent/java-agent/op_name_group_rule.md @@ -4,8 +4,7 @@ Those operation name are also as known endpoint name in most cases. Such as /api/checkTicket/tk/{userToken}. We solved most of these cases, by leverage the parameter pattern path in framework, such as SpringMVC, Webflux, etc. -But it is undetected in RPC client side, such as HTTP restful client. -In this case, we have to ask the users to set the group rule manually. +In this case, it is undetected in this way, so we have to ask the users to set the group rule manually. All rules are supported to set through agent.config, system properties and system env, like other agent settings. - Config format, `plugin.opgroup.`plugin name`.rule[`rule name`]`=pattern regex expression diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java index d91a47ac972f64384d7aefb64f21c5e7cbcde2ad..f7e7bf3c386773b3c8ae63947a6226071d44e6c4 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java @@ -32,6 +32,7 @@ public class Const { public static final int USER_SERVICE_ID = 1; public static final int USER_INSTANCE_ID = 1; public static final int USER_ENDPOINT_ID = 1; + public static final int INEXISTENCE_ENDPOINT_ID = -1; public static final String USER_CODE = "User"; public static final String SEGMENT_SPAN_SPLIT = "S"; public static final String UNKNOWN = "Unknown"; diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java index e8d46bcf8bfd0902e8cdd61706fbd7b41eceda7c..3e9a60535e94cb8bbf8173c1637ec98a01217e72 100644 --- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java +++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java @@ -163,14 +163,19 @@ public class RegisterServiceHandler extends RegisterGrpc.RegisterImplBase implem int serviceId = endpoint.getServiceId(); String endpointName = endpoint.getEndpointName(); - int endpointId = inventoryService.getOrCreate(serviceId, endpointName, DetectPoint.fromNetworkProtocolDetectPoint(endpoint.getFrom())); - - if (endpointId != Const.NONE) { - builder.addElements(EndpointMappingElement.newBuilder() - .setServiceId(serviceId) - .setEndpointName(endpointName) - .setEndpointId(endpointId) - .setFrom(endpoint.getFrom())); + DetectPoint detectPoint = DetectPoint.fromNetworkProtocolDetectPoint(endpoint.getFrom()); + if (DetectPoint.SERVER.equals(detectPoint)) { + int endpointId = inventoryService.getOrCreate(serviceId, endpointName, detectPoint); + + if (endpointId != Const.NONE) { + builder.addElements(EndpointMappingElement.newBuilder() + .setServiceId(serviceId) + .setEndpointName(endpointName) + .setEndpointId(endpointId) + .setFrom(endpoint.getFrom())); + } + } else { + logger.warn("Unexpected endpoint register, endpoint isn't detected from server side. {}", request); } }); diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParse.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParse.java index 726adb00e007f3e5081d9bb025e7011276dc3f3d..1b527bcaba5cf0c2a2d05a8b5abc3ced0d93b443 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParse.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParse.java @@ -141,7 +141,7 @@ public class SegmentParse { for (int i = 0; i < segmentDecorator.getSpansCount(); i++) { SpanDecorator spanDecorator = segmentDecorator.getSpans(i); - if (!SpanIdExchanger.getInstance(moduleManager).exchange(spanDecorator, segmentCoreInfo.getServiceId())) { + if (!SpanExchanger.getInstance(moduleManager).exchange(spanDecorator, segmentCoreInfo.getServiceId())) { exchanged = false; } else { for (int j = 0; j < spanDecorator.getRefsCount(); j++) { diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParseV2.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParseV2.java index 06018c4757ea6153263a9ad7c8e91d14e377bae3..583301bbe15be198ef80dd2d31d3ae9c2d1d3bad 100755 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParseV2.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/SegmentParseV2.java @@ -158,7 +158,7 @@ public class SegmentParseV2 { for (int i = 0; i < segmentDecorator.getSpansCount(); i++) { SpanDecorator spanDecorator = segmentDecorator.getSpans(i); - if (!SpanIdExchanger.getInstance(moduleManager).exchange(spanDecorator, segmentCoreInfo.getServiceId())) { + if (!SpanExchanger.getInstance(moduleManager).exchange(spanDecorator, segmentCoreInfo.getServiceId())) { exchanged = false; } else { for (int j = 0; j < spanDecorator.getRefsCount(); j++) { diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java index 7cb31c28f14b4853c8b62c481f88b40024843659..705c782fc49fe5528e07fe91707395a2e901182f 100755 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java @@ -106,7 +106,11 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe for (int i = 0; i < spanDecorator.getRefsCount(); i++) { ReferenceDecorator reference = spanDecorator.getRefs(i); SourceBuilder sourceBuilder = new SourceBuilder(); - sourceBuilder.setSourceEndpointId(reference.getParentEndpointId()); + if (reference.getParentEndpointId() == Const.INEXISTENCE_ENDPOINT_ID) { + sourceBuilder.setSourceEndpointId(Const.USER_ENDPOINT_ID); + } else { + sourceBuilder.setSourceEndpointId(reference.getParentEndpointId()); + } final int networkAddressId = reference.getNetworkAddressId(); final int serviceIdByPeerId = serviceInventoryCache.getServiceId(networkAddressId); @@ -161,10 +165,8 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe int destInstanceId = instanceInventoryCache.getServiceInstanceId(destServiceId, peerId); int mappingServiceInstanceId = instanceInventoryCache.get(destInstanceId).getMappingServiceInstanceId(); - sourceBuilder.setSourceEndpointId(Const.USER_ENDPOINT_ID); sourceBuilder.setSourceServiceInstanceId(segmentCoreInfo.getServiceInstanceId()); sourceBuilder.setSourceServiceId(segmentCoreInfo.getServiceId()); - sourceBuilder.setDestEndpointId(spanDecorator.getOperationNameId()); if (Const.NONE == mappingServiceId) { sourceBuilder.setDestServiceId(destServiceId); } else { @@ -235,10 +237,14 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe sourceBuilder.setSourceServiceName(serviceInventoryCache.get(sourceBuilder.getSourceServiceId()).getName()); sourceBuilder.setSourceServiceInstanceName(instanceInventoryCache.get(sourceBuilder.getSourceServiceInstanceId()).getName()); - sourceBuilder.setSourceEndpointName(endpointInventoryCache.get(sourceBuilder.getSourceEndpointId()).getName()); + if (sourceBuilder.getSourceEndpointId() != Const.NONE) { + sourceBuilder.setSourceEndpointName(endpointInventoryCache.get(sourceBuilder.getSourceEndpointId()).getName()); + } sourceBuilder.setDestServiceName(serviceInventoryCache.get(sourceBuilder.getDestServiceId()).getName()); sourceBuilder.setDestServiceInstanceName(instanceInventoryCache.get(sourceBuilder.getDestServiceInstanceId()).getName()); - sourceBuilder.setDestEndpointName(endpointInventoryCache.get(sourceBuilder.getDestEndpointId()).getName()); + if (sourceBuilder.getDestEndpointId() != Const.NONE) { + sourceBuilder.setDestEndpointName(endpointInventoryCache.get(sourceBuilder.getDestEndpointId()).getName()); + } } @Override public void build() { @@ -255,6 +261,9 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe * Parent endpoint could be none, because in SkyWalking Cross Process Propagation Headers Protocol v2, * endpoint in ref could be empty, based on that, endpoint relation maybe can't be established. * So, I am making this source as optional. + * + * Also, since 6.6.0, source endpoint could be none, if this trace begins by an internal task(local span or exit span), such as Timer, + * rather than, normally begin as an entry span, like a RPC server side. */ if (endpointRelation != null) { sourceReceiver.receive(endpointRelation); diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java index 48c261827431368ac2391644cb32bf51b59e5e97..492b1d6de9ff9551e9200a7fe50d09d97a675892 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java @@ -19,6 +19,7 @@ package org.apache.skywalking.oap.server.receiver.trace.provider.parser.listener.segment; import org.apache.skywalking.apm.network.language.agent.UniqueId; +import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.source.Segment; @@ -51,6 +52,7 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener private SAMPLE_STATUS sampleStatus = SAMPLE_STATUS.UNKNOWN; private int entryEndpointId = 0; private int firstEndpointId = 0; + private String firstEndpointName = ""; private SegmentSpanListener(ModuleManager moduleManager, TraceSegmentSampler sampler) { this.sampler = sampler; @@ -85,6 +87,7 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener segment.setVersion(segmentCoreInfo.isV2() ? 2 : 1); firstEndpointId = spanDecorator.getOperationNameId(); + firstEndpointName = spanDecorator.getOperationName(); } @Override public void parseEntry(SpanDecorator spanDecorator, SegmentCoreInfo segmentCoreInfo) { @@ -124,9 +127,19 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener return; } - if (entryEndpointId == 0) { - segment.setEndpointId(firstEndpointId); - segment.setEndpointName(serviceNameCacheService.get(firstEndpointId).getName()); + if (entryEndpointId == Const.NONE) { + if (firstEndpointId != Const.NONE) { + /** + * Since 6.6.0, only entry span is treated as an endpoint. Other span's endpoint id == 0. + */ + segment.setEndpointId(firstEndpointId); + segment.setEndpointName(serviceNameCacheService.get(firstEndpointId).getName()); + } else { + /** + * Only fill first operation name for the trace list query, as no endpoint id. + */ + segment.setEndpointName(firstEndpointName); + } } else { segment.setEndpointId(entryEndpointId); segment.setEndpointName(serviceNameCacheService.get(entryEndpointId).getName()); diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java index f1d72aebfc1ca3be6a8aba478907730c3f94f5fe..0fcff21bf4ab650da27fb52e14584be7d84fe2c0 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java @@ -70,6 +70,10 @@ public class ReferenceIdExchanger implements IdExchanger { standardBuilder.setEntryEndpointId(entryEndpointId); standardBuilder.setEntryEndpointName(Const.EMPTY_STRING); } + } else { + /** + * Since 6.6.0, endpoint id could be -1, as it is not an endpoint. Such as local span and exist span. + */ } if (standardBuilder.getParentEndpointId() == 0) { @@ -88,6 +92,10 @@ public class ReferenceIdExchanger implements IdExchanger { standardBuilder.setParentEndpointId(parentEndpointId); standardBuilder.setParentEndpointName(Const.EMPTY_STRING); } + } else { + /** + * Since 6.6.0, endpoint id could be -1, as it is not an endpoint. Such as local span and exist span. + */ } if (standardBuilder.getNetworkAddressId() == 0 && !Strings.isNullOrEmpty(standardBuilder.getNetworkAddress())) { @@ -104,16 +112,18 @@ public class ReferenceIdExchanger implements IdExchanger { standardBuilder.setNetworkAddressId(networkAddressId); standardBuilder.setNetworkAddress(Const.EMPTY_STRING); } + } else { + /** + * Since 6.6.0, endpoint id could be -1, as it is not an endpoint. Such as local span and exist span. + */ } return exchanged; } /** - * Endpoint in ref could be local or exit span's operation name. - * Especially if it is local span operation name, - * exchange may not happen at agent, such as Java agent, - * then put literal endpoint string in the header, - * Need to try to get the id by assuming the endpoint name is detected at server, local or client. + * Endpoint in ref could be local or exit span's operation name. Especially if it is local span operation name, + * exchange may not happen at agent, such as Java agent, then put literal endpoint string in the header, Need to try + * to get the id by assuming the endpoint name is detected at server, local or client. * * If agent does the exchange, then always use endpoint id. */ diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanIdExchanger.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java similarity index 84% rename from oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanIdExchanger.java rename to oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java index 7fcbb9efa76eb323d44821ccf932668d0f0bf723..b3518834e7a4068cb39eeb7471185d27853e1116 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanIdExchanger.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java @@ -22,6 +22,7 @@ import com.google.common.base.Strings; import com.google.gson.JsonObject; import org.apache.skywalking.apm.network.common.KeyStringValuePair; import org.apache.skywalking.apm.network.language.agent.SpanLayer; +import org.apache.skywalking.apm.network.language.agent.SpanType; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; @@ -45,11 +46,11 @@ import java.util.List; /** * @author peng-yongsheng */ -public class SpanIdExchanger implements IdExchanger { +public class SpanExchanger implements IdExchanger { - private static final Logger logger = LoggerFactory.getLogger(SpanIdExchanger.class); + private static final Logger logger = LoggerFactory.getLogger(SpanExchanger.class); - private static SpanIdExchanger EXCHANGER; + private static SpanExchanger EXCHANGER; private final ServiceInventoryCache serviceInventoryCacheDAO; private final IServiceInventoryRegister serviceInventoryRegister; private final ServiceInstanceInventoryCache serviceInstanceInventoryCacheDAO; @@ -58,14 +59,14 @@ public class SpanIdExchanger implements IdExchanger { private final INetworkAddressInventoryRegister networkAddressInventoryRegister; private final IComponentLibraryCatalogService componentLibraryCatalogService; - public static SpanIdExchanger getInstance(ModuleManager moduleManager) { + public static SpanExchanger getInstance(ModuleManager moduleManager) { if (EXCHANGER == null) { - EXCHANGER = new SpanIdExchanger(moduleManager); + EXCHANGER = new SpanExchanger(moduleManager); } return EXCHANGER; } - private SpanIdExchanger(ModuleManager moduleManager) { + private SpanExchanger(ModuleManager moduleManager) { this.serviceInventoryCacheDAO = moduleManager.find(CoreModule.NAME).provider().getService(ServiceInventoryCache.class); this.serviceInventoryRegister = moduleManager.find(CoreModule.NAME).provider().getService(IServiceInventoryRegister.class); this.serviceInstanceInventoryCacheDAO = moduleManager.find(CoreModule.NAME).provider().getService(ServiceInstanceInventoryCache.class); @@ -135,19 +136,25 @@ public class SpanIdExchanger implements IdExchanger { } if (standardBuilder.getOperationNameId() == Const.NONE) { - String endpointName = Strings.isNullOrEmpty(standardBuilder.getOperationName()) ? Const.DOMAIN_OPERATION_NAME : standardBuilder.getOperationName(); - int endpointId = endpointInventoryRegister.getOrCreate(serviceId, endpointName, DetectPoint.fromSpanType(standardBuilder.getSpanType())); - - if (endpointId == 0) { - if (logger.isDebugEnabled()) { - logger.debug("endpoint name: {} from service id: {} exchange failed", endpointName, serviceId); + /** + * Only operation name of entry span is being treated as an endpoint, + * so, since 6.6.0, only it triggers register. + */ + if (SpanType.Entry.equals(standardBuilder.getSpanType())) { + String endpointName = Strings.isNullOrEmpty(standardBuilder.getOperationName()) ? Const.DOMAIN_OPERATION_NAME : standardBuilder.getOperationName(); + int endpointId = endpointInventoryRegister.getOrCreate(serviceId, endpointName, DetectPoint.fromSpanType(standardBuilder.getSpanType())); + + if (endpointId == 0) { + if (logger.isDebugEnabled()) { + logger.debug("endpoint name: {} from service id: {} exchange failed", endpointName, serviceId); + } + + exchanged = false; + } else { + standardBuilder.toBuilder(); + standardBuilder.setOperationNameId(endpointId); + standardBuilder.setOperationName(Const.EMPTY_STRING); } - - exchanged = false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setOperationNameId(endpointId); - standardBuilder.setOperationName(Const.EMPTY_STRING); } } return exchanged; diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceAMock.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceAMock.java index 4da1f80f581004f67310f6822df7d11fd706e707..dd6d25ada7e2c18ba241a74002288742cbd4d246 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceAMock.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceAMock.java @@ -90,11 +90,7 @@ class ServiceAMock { span.setParentSpanId(0); span.setStartTime(startTimestamp + 100); span.setEndTime(startTimestamp + 500); - if (isPrepare) { - span.setOperationName("org.apache.skywalking.Local.do"); - } else { - span.setOperationNameId(3); - } + span.setOperationName("org.apache.skywalking.Local.do"); span.setIsError(false); return span; } @@ -108,12 +104,11 @@ class ServiceAMock { span.setStartTime(startTimestamp + 120); span.setEndTime(startTimestamp + 5800); span.setComponentId(ComponentsDefine.DUBBO.getId()); + span.setOperationName(DUBBO_ENDPOINT); if (isPrepare) { span.setPeer(DUBBO_ADDRESS); - span.setOperationName(DUBBO_ENDPOINT); } else { span.setPeerId(2); - span.setOperationNameId(6); } span.setIsError(false); return span; diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceBMock.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceBMock.java index 949681552120bd5a4a51b80a8a8e188b7a49229b..73893ee1e0202943a2803f0467e2732d1b7bedb4 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceBMock.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/trace/mock/ServiceBMock.java @@ -119,11 +119,10 @@ class ServiceBMock { span.addTags(KeyWithStringValue.newBuilder().setKey("db.statement").setValue("select * from database where complex = 1;").build()); span.addTags(KeyWithStringValue.newBuilder().setKey("db.type").setValue("mongodb").build()); + span.setOperationName("mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"); if (isPrepare) { - span.setOperationName("mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"); span.setPeer("localhost:27017"); } else { - span.setOperationNameId(7); span.setPeerId(3); } return span; @@ -140,11 +139,10 @@ class ServiceBMock { span.setComponentId(ComponentsDefine.ROCKET_MQ_PRODUCER.getId()); span.setIsError(false); + span.setOperationName(ROCKET_MQ_ENDPOINT); if (isPrepare) { - span.setOperationName(ROCKET_MQ_ENDPOINT); span.setPeer(ROCKET_MQ_ADDRESS); } else { - span.setOperationNameId(8); span.setPeerId(4); } return span; diff --git a/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml b/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml index ec49d3c6ba77e3ee645dc900ea40619ab7281e42..788aa918f45bc6e2cbcc466aec802fe21622a677 100644 --- a/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml @@ -20,9 +20,8 @@ registryItems: instances: - {apm-toolkit-trace-scenario: 1} operationNames: - - apm-toolkit-trace-scenario: [/apm-toolkit-trace-scenario/case/asyncVisit/runnable, - /case/asyncVisit/runnable, /case/asyncVisit/callable, /apm-toolkit-trace-scenario/case/asyncVisit/callable, - /case/tool-kit,/apm-toolkit-trace-scenario/case/asyncVisit/supplier,/case/asyncVisit/supplier] + - apm-toolkit-trace-scenario: [/case/asyncVisit/runnable, /case/asyncVisit/callable, + /case/tool-kit, /case/asyncVisit/supplier] heartbeat: [] segmentItems: - applicationCode: apm-toolkit-trace-scenario @@ -163,7 +162,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/callable'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.CallableWrapper/call, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/tool-kit, entryServiceInstanceId: 1} @@ -258,7 +257,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/runnable'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.RunnableWrapper/run, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/tool-kit, entryServiceInstanceId: 1} @@ -317,7 +316,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/apm-toolkit-trace-scenario/case/asyncVisit/supplier'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.SupplierWrapper/get, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/tool-kit, entryServiceInstanceId: 1} \ No newline at end of file diff --git a/test/plugin/scenarios/canal-scenario/config/expectedData.yaml b/test/plugin/scenarios/canal-scenario/config/expectedData.yaml index 154e28bc91bdab6b35c4474fd72c15c88e30816a..de5e7c29eb87a8feeeb966a7ecb218a04505ee9b 100644 --- a/test/plugin/scenarios/canal-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/canal-scenario/config/expectedData.yaml @@ -19,7 +19,7 @@ registryItems: instances: - {canal-scenario: 1} operationNames: - - canal-scenario: [Canal/example, /canal-scenario/case/canal-case] + - canal-scenario: [/canal-scenario/case/canal-case] heartbeat: [] segmentItems: - applicationCode: canal-scenario diff --git a/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml index 81ce9aaa010e35ef4370d0ae7b31c5e54322191c..233019790841d4ff1f8640a6e10564d0cf5116f1 100644 --- a/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml @@ -19,7 +19,7 @@ registryItems: instances: - {cassandra-java-driver-3.x-scenario: 1} operationNames: - - cassandra-java-driver-3.x-scenario: [Cassandra/execute, Cassandra/executeAsync, /cassandra-java-driver-3.x-scenario/case/cassandra] + - cassandra-java-driver-3.x-scenario: [/cassandra-java-driver-3.x-scenario/case/cassandra] heartbeat: [] segmentItems: - applicationCode: cassandra-java-driver-3.x-scenario diff --git a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml index 763c7721ab049aef19d9bd9a47d335448d6a5d49..5fa2275fcb391978e4f405093bbfa58f64dc11d8 100644 --- a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml @@ -19,30 +19,12 @@ registryItems: instances: - {dubbo-2.5.x-scenario: 1} operationNames: - - dubbo-2.5.x-scenario: [/dubbo-2.5.x-scenario/case/healthCheck, /dubbo-2.5.x-scenario/case/dubbo, org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()] + - dubbo-2.5.x-scenario: [/dubbo-2.5.x-scenario/case/dubbo, org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()] heartbeat: [] segmentItems: - applicationCode: dubbo-2.5.x-scenario segmentSize: ge 3 segments: - - segmentId: not null - spans: - - operationName: /dubbo-2.5.x-scenario/case/healthCheck - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: nq 0 - endTime: nq 0 - componentId: 1 - componentName: '' - isError: false - spanType: Entry - peer: '' - peerId: 0 - tags: - - {key: url, value: 'http://localhost:8080/dubbo-2.5.x-scenario/case/healthCheck'} - - {key: http.method, value: HEAD} - segmentId: not null spans: - operationName: org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness() diff --git a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml index bd29f26c41469bacb33f532179aee656c5e198da..b48b542ddace97baf79f7d32a6292f7b1dc07926 100644 --- a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml @@ -19,32 +19,13 @@ registryItems: instances: - {dubbo-2.7.x-scenario: 1} operationNames: - - dubbo-2.7.x-scenario: [/dubbo-2.7.x-scenario/case/healthCheck, - /dubbo-2.7.x-scenario/case/dubbo, + - dubbo-2.7.x-scenario: [/dubbo-2.7.x-scenario/case/dubbo, org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()] heartbeat: [] segmentItems: - applicationCode: dubbo-2.7.x-scenario segmentSize: ge 3 segments: - - segmentId: not null - spans: - - operationName: /dubbo-2.7.x-scenario/case/healthCheck - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: nq 0 - endTime: nq 0 - componentId: 1 - componentName: '' - isError: false - spanType: Entry - peer: '' - peerId: 0 - tags: - - {key: url, value: 'http://localhost:8080/dubbo-2.7.x-scenario/case/healthCheck'} - - {key: http.method, value: HEAD} - segmentId: not null spans: - operationName: org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness() diff --git a/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml index 489f1f9108849e64a7091afca7efdef29cb73aba..b2a077a07bc1818f7321a52616e362a9f6970587 100644 --- a/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml @@ -19,7 +19,7 @@ registryItems: instances: - {ehcache-2.x-scenario: 1} operationNames: - - ehcache-2.x-scenario: [/ehcache-2.x-scenario/case/ehcache, /ehcache-2.x-scenario/healthCheck] + - ehcache-2.x-scenario: [/ehcache-2.x-scenario/case/ehcache] heartbeat: [] segmentItems: - applicationCode: ehcache-2.x-scenario diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml index 118fcfb0d6420716449978626b8005c2d96948e2..36058787b1bacc8ee58e21ef5ed5f1f18b4b7f71 100644 --- a/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml @@ -19,10 +19,7 @@ registryItems: instances: - {elasticsearch-5.x-scenario: 1} operationNames: - - elasticsearch-5.x-scenario: [Elasticsearch/IndexRequest, Elasticsearch/GetRequest, - Elasticsearch/SearchRequest, Elasticsearch/UpdateRequest, - Elasticsearch/DeleteRequest, Elasticsearch/DeleteIndexRequest, - /case/elasticsearch] + - elasticsearch-5.x-scenario: [/case/elasticsearch] heartbeat: [] segmentItems: - applicationCode: elasticsearch-5.x-scenario diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml index 95f3d62afc4e17ce88334f42123236d5c17f40bb..38fb50b1b29378495fb3f1c3fba56dfde1f68675 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml @@ -19,10 +19,7 @@ registryItems: instances: - {elasticsearch-6.x-scenario: 1} operationNames: - - elasticsearch-6.x-scenario: [Elasticsearch/CreateRequest, Elasticsearch/IndexRequest, - Elasticsearch/GetRequest, Elasticsearch/SearchRequest, - Elasticsearch/UpdateRequest, Elasticsearch/DeleteRequest, - /elasticsearch-case/case/elasticsearch] + - elasticsearch-6.x-scenario: [/elasticsearch-case/case/elasticsearch] heartbeat: [] segmentItems: - applicationCode: elasticsearch-6.x-scenario diff --git a/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml index e2e3b51a74f0b7bad658e875823778dd1e509d19..d7454bf4f2d300ce9e24ab61b372ecfe1d30366d 100644 --- a/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml @@ -19,10 +19,7 @@ registryItems: instances: - {elasticsearch-7.x-scenario: 1} operationNames: - - elasticsearch-7.x-scenario: [Elasticsearch/CreateRequest, Elasticsearch/IndexRequest, - Elasticsearch/GetRequest, Elasticsearch/SearchRequest, - Elasticsearch/UpdateRequest, Elasticsearch/DeleteRequest, - /elasticsearch-case/case/elasticsearch] + - elasticsearch-7.x-scenario: [/elasticsearch-case/case/elasticsearch] heartbeat: [] segmentItems: - applicationCode: elasticsearch-7.x-scenario diff --git a/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml b/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml index 66ccf5d1b9852d50bac898221bc5fefe6ed955e6..e1a1c9e24331b1c29e914aa5269d04baac46ba96 100644 --- a/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml @@ -47,7 +47,8 @@ segmentItems: - {key: message, value: not null} - {key: stack, value: not null} refs: - - {parentEndpointId: 0, parentEndpoint: /case/hystrix-scenario, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: '${hystrix-scenario[2]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0 } + - {parentEndpointId: 0, parentEndpoint: /case/hystrix-scenario, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: '${hystrix-scenario[2]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0 } - segmentId: not null spans: - operationName: Hystrix/TestACommand/Fallback @@ -64,7 +65,8 @@ segmentItems: peer: '' peerId: 0 refs: - - {parentEndpointId: 0, parentEndpoint: Hystrix/TestACommand/Execution, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: '${hystrix-scenario[0]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0} + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, + parentTraceSegmentId: '${hystrix-scenario[0]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0} - segmentId: not null spans: - operationName: Hystrix/TestBCommand/Execution diff --git a/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml b/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml index c87e2df6dfe9c6f14900d7f242eb01097dcde594..181927b4d55627c653f021e8dd21bdbcd2c6b7b4 100644 --- a/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml @@ -20,8 +20,7 @@ registryItems: instances: - {jedis-scenario: 1} operationNames: - - jedis-scenario: [Jedis/set, Jedis/echo, Jedis/del, - Jedis/get, /jedis-scenario/case/jedis-scenario] + - jedis-scenario: [/jedis-scenario/case/jedis-scenario] heartbeat: [] segmentItems: - applicationCode: jedis-scenario diff --git a/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml b/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml index 247ff97913651fa7ff485fee4d01da10e39304c8..ecfa7dd49611f28b06905c83920c59164ff798bf 100644 --- a/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml @@ -22,8 +22,7 @@ registryItems: - {jettyclient-scenario: 1} operationNames: - jettyserver-scenario: [/jettyserver-case/case/receiveContext-0] - - jettyclient-scenario: [/jettyserver-case/case/receiveContext-0, - /jettyclient-case/case/jettyclient-case, + - jettyclient-scenario: [/jettyclient-case/case/jettyclient-case, /jettyclient-case/case/healthCheck] segmentItems: - applicationCode: jettyserver-scenario diff --git a/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml b/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml index bcd8b492df85f66cb6ab09c79c6eaefaaaba0239..b85df953f2c6eeebe881403dadf8d8417550dcc2 100644 --- a/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml @@ -19,31 +19,12 @@ registryItems: instances: - {kafka-scenario: 1} operationNames: - - kafka-scenario: [Kafka/test/Producer, Kafka/test/Consumer/testGroup, - /case/healthCheck, /case/kafka-case] + - kafka-scenario: [Kafka/test/Consumer/testGroup, /case/kafka-case] heartbeat: [] segmentItems: - applicationCode: kafka-scenario - segmentSize: gt 4 + segmentSize: gt 3 segments: - - segmentId: not null - spans: - - operationName: /case/healthCheck - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: nq 0 - endTime: nq 0 - componentId: 14 - componentName: '' - isError: false - spanType: Entry - peer: '' - peerId: 0 - tags: - - {key: url, value: 'http://localhost:8080/kafka-scenario/case/healthCheck'} - - {key: http.method, value: HEAD} - segmentId: not null spans: - operationName: Kafka/Producer/Callback diff --git a/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml index 8081780b9c36c03e8acd5d74ef9709e17dd46b30..20bce04a0305f4cd5973ebf986713af87f8ec532 100644 --- a/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml @@ -20,8 +20,7 @@ registryItems: instances: - {mongodb-3.x-scenario: 1} operationNames: - - mongodb-3.x-scenario: [/mongodb-case/case/mongodb, MongoDB/DropDatabaseOperation, MongoDB/FindOperation, - MongoDB/CreateCollectionOperation, MongoDB/MixedBulkWriteOperation] + - mongodb-3.x-scenario: [/mongodb-case/case/mongodb] heartbeat: [] segmentItems: diff --git a/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml b/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml index 9b571d7cb02651a961a7051fdb4940ff0e35adfb..be73e68b30633b667ad379519ceb3c0642c1d9a7 100644 --- a/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml @@ -19,8 +19,7 @@ registryItems: instances: - {mysql-scenario: 1} operationNames: - - mysql-scenario: [Mysql/JDBI/Statement/execute, /mysql-scenario/case/healthCheck, - Mysql/JDBI/PreparedStatement/execute, /mysql-scenario/case/mysql-scenario, Mysql/JDBI/Connection/close] + - mysql-scenario: [/mysql-scenario/case/healthCheck, /mysql-scenario/case/mysql-scenario] segmentItems: - applicationCode: mysql-scenario segmentSize: ge 2 diff --git a/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml b/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml index e8ea27c327c0cf92f5c240a26f334192d152d3de..021e00c2dd0bef4a8c0be1436c458ae97d87c73d 100644 --- a/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml @@ -20,7 +20,7 @@ registryItems: instances: - {netty-socketio-scenario: 1} operationNames: - - netty-socketio-scenario: [/netty-socketio-scenario/case/netty-socketio, /socket.io/, + - netty-socketio-scenario: [/netty-socketio-scenario/case/netty-socketio, /netty-socketio-scenario/healthCheck, SocketIO/onConnect, SocketIO/send_data/receive] heartbeat: [] segmentItems: diff --git a/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml b/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml index 48c46123810b1330f8bec4d00fbe06d88d894219..6d4af0cfca4a8d9d884bea91f7aef5c359d1eb27 100644 --- a/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml @@ -20,7 +20,7 @@ registryItems: instances: - {okhttp-scenario: 1} operationNames: - - okhttp-scenario: [/case/receiveContext-0, /okhttp-case/case/receiveContext-0,/case/healthCheck, /case/okhttp-case, /case/receiveContext-1] + - okhttp-scenario: [/case/receiveContext-0, /case/healthCheck, /case/okhttp-case, /case/receiveContext-1] heartbeat: [] segmentItems: - applicationCode: okhttp-scenario @@ -76,7 +76,9 @@ segmentItems: - {key: url, value: 'http://127.0.0.1:8080/okhttp-case/case/receiveContext-0'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: /okhttp-case/case/receiveContext-0, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '127.0.0.1:8080', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, + refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '127.0.0.1:8080', + entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} - segmentId: not null spans: - operationName: /case/receiveContext-1 @@ -96,7 +98,8 @@ segmentItems: - {key: url, value: 'http://127.0.0.1:8080/okhttp-case/case/receiveContext-1'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: /okhttp-case/case/receiveContext-0, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '127.0.0.1:8080', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, + parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '127.0.0.1:8080', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} - segmentId: not null spans: - operationName: /okhttp-case/case/receiveContext-0 @@ -116,4 +119,5 @@ segmentItems: - {key: http.method, value: GET} - {key: url, value: 'http://127.0.0.1:8080/okhttp-case/case/receiveContext-0'} refs: - - {parentEndpointId: 0, parentEndpoint: /case/okhttp-case, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 1, parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} + - {parentEndpointId: 0, parentEndpoint: '/case/okhttp-case', networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 1, + parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} diff --git a/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml b/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml index fbedc4c8f368e6269d33af8da4fd09ac494de536..c85f2f792ff020889e72f1840f037d71840df451 100644 --- a/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml @@ -19,9 +19,7 @@ registryItems: instances: - {oracle-scenario: 1} operationNames: - - oracle-scenario: [Oracle/JDBI/Connection/close, Oracle/JDBI/PreparedStatement/executeQuery, - Oracle/JDBI/PreparedStatement/execute, Oracle/JDBI/Statement/execute, - /oracle-scenario/case/oracle] + - oracle-scenario: [/oracle-scenario/case/oracle] segmentItems: - applicationCode: oracle-scenario segmentSize: ge 1 diff --git a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml index bb5260be15ce6739b96919bff0a3bf15bdee0bf3..2fa965b4a6afb5ec9f6c1836cab62baae0e645b7 100644 --- a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml @@ -19,9 +19,7 @@ registryItems: instances: - {postgresql-above9.4.1207-scenario: 1} operationNames: - - postgresql-above9.4.1207-scenario: [/postgresql-scenario/case/postgres, PostgreSQL/JDBI/PreparedStatement/executeWithFlags, - PostgreSQL/JDBI/CallableStatement/executeWithFlags, PostgreSQL/JDBI/Statement/execute, - PostgreSQL/JDBI/Connection/close] + - postgresql-above9.4.1207-scenario: [/postgresql-scenario/case/postgres] segmentItems: - applicationCode: postgresql-above9.4.1207-scenario segmentSize: ge 1 diff --git a/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml b/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml index 9fa8c2339617ee5b8e3b3e7c29d893420290c863..06405767355ac3b6c0be764873cecf39d09344e0 100644 --- a/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml @@ -19,9 +19,7 @@ registryItems: instances: - {postgresql-scenario: 1} operationNames: - - postgresql-scenario: [/postgresql-scenario/case/postgres, PostgreSQL/JDBI/PreparedStatement/execute, - PostgreSQL/JDBI/CallableStatement/execute, PostgreSQL/JDBI/Statement/execute, - PostgreSQL/JDBI/Connection/close] + - postgresql-scenario: [/postgresql-scenario/case/postgres] heartbeat: [] segmentItems: - applicationCode: postgresql-scenario diff --git a/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml b/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml index 8adc16d546a8039b96c7d230df789ff4218772c3..559082791e78a5c5ae6431b8fd060fd8c04318c7 100644 --- a/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml @@ -20,7 +20,7 @@ registryItems: instances: - {pulsar-scenario: nq 0} operationNames: - - pulsar-scenario: [Pulsar/test/Producer, /case/pulsar-case, Pulsar/test/Consumer/test] + - pulsar-scenario: [/case/pulsar-case, Pulsar/test/Consumer/test] segmentItems: - applicationCode: pulsar-scenario segmentSize: ge 3 diff --git a/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml b/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml index ff452607518211a9e1d2896d89bace0155b4a18f..8b6b964b80763ab0d06b4b35a8bedfa010252a6f 100644 --- a/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml @@ -19,7 +19,7 @@ registryItems: instances: - {rabbitmq-scenario: 1} operationNames: - - rabbitmq-scenario: [/rabbitmq-scenario/case/rabbitmq,RabbitMQ/Topic/Queue/test/Producer,RabbitMQ/Topic/Queue/test/Consumer] + - rabbitmq-scenario: [/rabbitmq-scenario/case/rabbitmq, RabbitMQ/Topic/Queue/test/Consumer] segmentItems: - applicationCode: rabbitmq-scenario segmentSize: gt 2 diff --git a/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml b/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml index d1cb1dcc799668ac5b7164bd1b1c18cd9dba4ecd..aac27237eb819ab44dc9b1e356eb59b3442872e0 100644 --- a/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml @@ -20,7 +20,7 @@ registryItems: instances: - {redisson-scenario: 1} operationNames: - - redisson-scenario: [/case/healthCheck, Redisson/BATCH_EXECUTE, Redisson/SET, /case/redisson-case] + - redisson-scenario: [/case/healthCheck, /case/redisson-case] heartbeat: [] segmentItems: - applicationCode: redisson-scenario diff --git a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml index ed3a2dab925803c979a785aa09bf23907e51ae02..efe708f2d278f70d5bf7b71d97e232fe574b84f9 100644 --- a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml @@ -19,9 +19,7 @@ registryItems: instances: - {solrj-7.x-scenario: nq 0} operationNames: - - solrj-7.x-scenario: [/solrj-scenario/case/solrj, solrJ/mycore/update/COMMIT, solrJ/mycore/update/DELETE_BY_IDS, - solrJ/mycore/select, solrJ/mycore/update/DELETE_BY_QUERY, solrJ/mycore/get, - solrJ/mycore/update/OPTIMIZE, solrJ/mycore/update/ADD] + - solrj-7.x-scenario: [/solrj-scenario/case/solrj] heartbeat: [] segmentItems: - applicationCode: solrj-7.x-scenario diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml index b9444923c6eafa790e3f87fa4b8dd196085863e2..5f5acdfdc1a20af66c4c61045c2720f0f8af23a2 100644 --- a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml @@ -20,9 +20,8 @@ registryItems: - {spring-3.1.x-scenario: 1} operationNames: - spring-3.1.x-scenario: ['{DELETE}/delete/{id}', /case/resttemplate, '{GET}/get/{id}', - /spring-3.1.x-scenario/delete/1, '{POST}/create/', /healthCheck, /case/spring3, - /spring-3.1.x-scenario/case/spring3/, /spring-3.1.x-scenario/update/1, '{PUT}/update/{id}', - /spring-3.1.x-scenario/create/, /spring-3.1.x-scenario/get/1] + '{POST}/create/', /healthCheck, /case/spring3, + '{PUT}/update/{id}'] heartbeat: [] segmentItems: - applicationCode: spring-3.1.x-scenario diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml index 33757eeadd6e8f918b640109a88369d3773b5074..0f4931bb411e8d216ae69267afa648a3416f4487 100644 --- a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml @@ -20,9 +20,7 @@ registryItems: - {spring-4.1.x-scenario: 1} operationNames: - spring-4.1.x-scenario: ['{DELETE}/delete/{id}', /case/resttemplate, '{GET}/get/{id}', - /spring-4.1.x-scenario/delete/1, '{POST}/create/', /healthCheck, /case/spring3, - /spring-4.1.x-scenario/case/spring3/, /spring-4.1.x-scenario/update/1, '{PUT}/update/{id}', - /spring-4.1.x-scenario/create/, /spring-4.1.x-scenario/get/1] + '{POST}/create/', /healthCheck, /case/spring3, '{PUT}/update/{id}'] heartbeat: [] segmentItems: - applicationCode: spring-4.1.x-scenario diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml index 73c8f7abd6d9b87280d2c821b03ee691627a01d6..982805a273c3de948cc19023690f6d22448d70bb 100644 --- a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml @@ -20,9 +20,7 @@ registryItems: - {spring-4.3.x-scenario: 1} operationNames: - spring-4.3.x-scenario: [/create/, '/delete/{id}', /inherit/child/test, /healthCheck, - /spring-4.3.x-scenario/case/spring3/, /spring-4.3.x-scenario/create/, /spring-4.3.x-scenario/get/1, - '/get/{id}', '/update/{id}', /case/resttemplate, /spring-4.3.x-scenario/delete/1, - /spring-4.3.x-scenario/inherit/child/test, /spring-4.3.x-scenario/update/1, + '/get/{id}', '/update/{id}', /case/resttemplate, /case/spring3] heartbeat: [] segmentItems: diff --git a/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml index e3a7c51e185ff2ca7efabaca80e2b1e5c1a0ac64..e2377b747040e574b251551c2bac5d88e399afc4 100644 --- a/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml @@ -63,7 +63,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: SpringAsync, networkAddressId: 0, entryEndpointId: 0, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /spring-async-scenario/case/spring-async, entryServiceInstanceId: 1} @@ -86,7 +86,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: SpringAsync, networkAddressId: 0, entryEndpointId: 0, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /spring-async-scenario/case/spring-async, entryServiceInstanceId: 1} diff --git a/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml index 72cf9955a8e813ad91435f38c3847730a08c35a1..46a42e601d956e44368fd0899bf943a743fe4786 100644 --- a/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml @@ -20,9 +20,7 @@ registryItems: instances: - {spring-tx-scenario: 1} operationNames: - - spring-tx-scenario: [Mysql/JDBI/Statement/execute, Mysql/JDBI/Connection/commit, - Mysql/JDBI/PreparedStatement/executeUpdate, /case/spring-tx-case, /case/healthCheck, - Mysql/JDBI/Connection/close, Mysql/JDBI/Statement/executeQuery] + - spring-tx-scenario: [/case/spring-tx-case, /case/healthCheck] heartbeat: [] segmentItems: - applicationCode: spring-tx-scenario diff --git a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml index c4fb328c3abac0dbcaa2f8decac4c5d1eb0dd376..010032df772de18c57427dad624994dd330bf5f7 100644 --- a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml @@ -20,7 +20,7 @@ registryItems: instances: - {undertow-scenario: 1} operationNames: - - undertow-scenario: [/undertow-scenario/case/undertow1, /undertow-scenario/case/undertow, /undertow-routing-scenario/case/undertow, + - undertow-scenario: [/undertow-scenario/case/undertow1, /undertow-scenario/case/undertow, '/undertow-routing-scenario/case/{context}'] heartbeat: [] segmentItems: @@ -64,7 +64,7 @@ segmentItems: - {key: url, value: 'http://localhost:8081/undertow-routing-scenario/case/undertow'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: UndertowDispatch, networkAddressId: 0, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8081', entryEndpoint: /undertow-scenario/case/undertow, entryServiceInstanceId: 1} @@ -87,7 +87,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/undertow-scenario/case/undertow1'} - {key: http.method, value: GET} refs: - - {parentEndpointId: 0, parentEndpoint: UndertowDispatch, networkAddressId: 0, + - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /undertow-scenario/case/undertow, entryServiceInstanceId: 1} diff --git a/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml b/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml index cb167cd0e750b5c9024ad43f50052c2e1f5c751d..9c29c6df9403e9a10ef1c44b615d5d0ff42ee419 100644 --- a/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml @@ -27,9 +27,7 @@ registryItems: WEBFLUX.handle, org.apache.skywalking.apm.testcase.sc.webflux.projectB.controller.TestAnnotationController.error, org.apache.skywalking.apm.testcase.sc.webflux.projectB.controller.TestAnnotationController.healthCheck, RoutingConfiguration.org.apache.skywalking.apm.testcase.sc.webflux.projectB.route.TestHandler] - - webflux-projectA-scenario: [/testcase/annotation/mono/hello, /projectA/testcase, - /testcase/annotation/success, /testcase/annotation/healthCheck, /notFound, /projectA/healthCheck, - /testcase/route/error, /testcase/route/success, /testcase/annotation/error] + - webflux-projectA-scenario: [/projectA/testcase] heartbeat: [] segmentItems: - applicationCode: webflux-projectB-scenario diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java index aabba74d54238885fe37fcaf2b4d8fc69ad71c3b..8baaf370c53157f21da6359f6e03e4b9afb4e606 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java @@ -211,8 +211,8 @@ public class SegmentAssert { private static boolean simpleSegmentRefEquals(SegmentRef expected, SegmentRef actual) { try { - ExpressParser.parse(expected.entryServiceName()).assertValue("entry service name", actual.entryServiceName()); - ExpressParser.parse(expected.parentServiceName()).assertValue("parent service name", actual.parentServiceName()); + ExpressParser.parse(expected.entryEndpointName()).assertValue("entry service name", actual.entryEndpointName()); + ExpressParser.parse(expected.parentEndpointName()).assertValue("parent service name", actual.parentEndpointName()); ExpressParser.parse(expected.refType()).assertValue("ref type", actual.refType()); return true; } catch (ValueAssertFailedException e) { diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentRefAssert.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentRefAssert.java index b131dbdc59b7d5704a4d34765e6b582a158de90a..fffc10a1740b6d84bab40c21cc32112e1d94ef82 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentRefAssert.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentRefAssert.java @@ -57,17 +57,17 @@ public class SegmentRefAssert { private static boolean segmentRefEquals(SegmentRef expected, SegmentRef actual) { try { - ExpressParser.parse(expected.entryServiceName()).assertValue("entry service name", actual.entryServiceName()); + ExpressParser.parse(expected.entryEndpointName()).assertValue("entry endpoint name", actual.entryEndpointName()); ExpressParser.parse(expected.networkAddress()).assertValue("network address", actual.networkAddress()); ExpressParser.parse(expected.parentTraceSegmentId()).assertValue("parent segment id", actual.parentTraceSegmentId()); ExpressParser.parse(expected.parentSpanId()).assertValue("span id", actual.parentSpanId()); - ExpressParser.parse(expected.entryServiceId()).assertValue("entry service id", actual.entryServiceId()); + ExpressParser.parse(expected.entryEndpointId()).assertValue("entry endpoint id", actual.entryEndpointId()); ExpressParser.parse(expected.networkAddressId()).assertValue("network address id", actual.networkAddressId()); - ExpressParser.parse(expected.parentApplicationInstanceId()).assertValue("parent application instance id", actual.parentApplicationInstanceId()); - ExpressParser.parse(expected.parentServiceId()).assertValue("parent service id", actual.parentServiceId()); - ExpressParser.parse(expected.parentServiceName()).assertValue("parent service name", actual.parentServiceName()); + ExpressParser.parse(expected.parentServiceInstanceId()).assertValue("parent application instance id", actual.parentServiceInstanceId()); + ExpressParser.parse(expected.parentEndpointId()).assertValue("parent endpoint id", actual.parentEndpointId()); + ExpressParser.parse(expected.parentEndpointName()).assertValue("parent endpoint name", actual.parentEndpointName()); ExpressParser.parse(expected.refType()).assertValue("ref type", actual.refType()); - ExpressParser.parse(expected.entryApplicationInstanceId()).assertValue("entry application instance id", actual.entryApplicationInstanceId()); + ExpressParser.parse(expected.entryServiceInstanceId()).assertValue("entry application instance id", actual.entryServiceInstanceId()); return true; } catch (ValueAssertFailedException e) { throw new SegmentRefAssertFailedException(e, expected, actual); diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/exception/SegmentRefNotFoundException.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/exception/SegmentRefNotFoundException.java index dbc8af05e76bac17da1fcf2cbf5367f447f6e799..268efb96cc604fd659359f46049b875e50e5f787 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/exception/SegmentRefNotFoundException.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/exception/SegmentRefNotFoundException.java @@ -40,9 +40,9 @@ public class SegmentRefNotFoundException extends AssertFailedException { String reason = cause.getFailedCause().getCauseMessage(); StringBuilder actualSegmentRef = new StringBuilder(String.format("\nSegmentRef:\t%s\n", reason)); - actualSegmentRef.append(String.format(" - entryServiceName:\t\t%s\n", actual.entryServiceName())) + actualSegmentRef.append(String.format(" - entryServiceName:\t\t%s\n", actual.entryEndpointName())) .append(String.format(" - networkAddress:\t\t\t%s\n", actual.networkAddress())) - .append(String.format(" - parentServiceName:\t\t%s\n", actual.parentServiceName())) + .append(String.format(" - parentServiceName:\t\t%s\n", actual.parentEndpointName())) .append(String.format(" - parentSpanId:\t\t\t%s\n", actual.parentSpanId())) .append(String.format(" - parentTraceSegmentId:\t%s\n", actual.parentTraceSegmentId())) .append(String.format(" - refType:\t\t\t\t\t%s", actual.refType())).toString(); diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentForRead.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentForRead.java index 6473a160d5a83b78ba31134a223f09601097472f..b5c6dc5b7a62cd2c6c92ceab91e96d1a5e4899f7 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentForRead.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentForRead.java @@ -110,11 +110,11 @@ public class SegmentForRead implements Segment { this.entryServiceInstanceId = entryServiceInstanceId; } - @Override public String parentServiceId() { + @Override public String parentEndpointId() { return parentEndpointId; } - @Override public String parentServiceName() { + @Override public String parentEndpointName() { return parentEndpoint; } @@ -122,7 +122,7 @@ public class SegmentForRead implements Segment { return networkAddressId; } - @Override public String entryServiceId() { + @Override public String entryEndpointId() { return entryEndpointId; } @@ -138,7 +138,7 @@ public class SegmentForRead implements Segment { return parentTraceSegmentId; } - @Override public String parentApplicationInstanceId() { + @Override public String parentServiceInstanceId() { return parentServiceInstanceId; } @@ -146,7 +146,7 @@ public class SegmentForRead implements Segment { return networkAddress; } - @Override public String entryServiceName() { + @Override public String entryEndpointName() { return entryEndpoint; } @@ -154,15 +154,15 @@ public class SegmentForRead implements Segment { this.parentTraceSegmentId = parentTraceSegmentId; } - @Override public String entryApplicationInstanceId() { + @Override public String entryServiceInstanceId() { return entryServiceInstanceId; } @Override public String toString() { StringBuilder actualSegmentRef = new StringBuilder("\nSegmentRef:\n"); - return actualSegmentRef.append(String.format(" - entryServiceName:\t\t%s\n", entryServiceName())) + return actualSegmentRef.append(String.format(" - entryServiceName:\t\t%s\n", entryEndpointName())) .append(String.format(" - networkAddress:\t\t\t%s\n", networkAddress())) - .append(String.format(" - parentServiceName:\t\t%s\n", parentServiceName())) + .append(String.format(" - parentServiceName:\t\t%s\n", parentEndpointName())) .append(String.format(" - parentSpanId:\t\t\t%s\n", parentSpanId())) .append(String.format(" - parentTraceSegmentId:\t%s\n", parentTraceSegmentId())) .append(String.format(" - refType:\t\t\t\t\t%s", refType())).toString(); diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentRef.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentRef.java index 58e6a8d6424fe76f06d00d1de8fc662925a713ac..c654f68e8f80561aa90371cbc478bbfce849e592 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentRef.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/entity/SegmentRef.java @@ -21,13 +21,13 @@ package org.apache.skywalking.plugin.test.agent.tool.validator.entity; */ public interface SegmentRef { - String parentServiceId(); + String parentEndpointId(); - String parentServiceName(); + String parentEndpointName(); String networkAddressId(); - String entryServiceId(); + String entryEndpointId(); String refType(); @@ -35,13 +35,13 @@ public interface SegmentRef { String parentTraceSegmentId(); - String parentApplicationInstanceId(); + String parentServiceInstanceId(); String networkAddress(); - String entryServiceName(); + String entryEndpointName(); void parentTraceSegmentId(String parentTraceSegmentId); - String entryApplicationInstanceId(); + String entryServiceInstanceId(); }