diff --git a/CHANGES.md b/CHANGES.md index 186467bb5..d8d5f5d21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ Release Notes. * Support 2.8 and 2.9 of pulsar client. * Add dubbo 3.x plugin. * Fix TracePathMatcher should match pattern "**" with paths end by "/" +* Add support `returnedObj` expression for apm-customize-enhance-plugin #### Documentation diff --git a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/test/java/org/apache/skywalking/apm/plugin/customize/util/CustomizeExpressionTest.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/util/CustomizeExpressionTest.java similarity index 97% rename from apm-sniffer/optional-plugins/customize-enhance-plugin/src/test/java/org/apache/skywalking/apm/plugin/customize/util/CustomizeExpressionTest.java rename to apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/util/CustomizeExpressionTest.java index 592c262ce..2adad842f 100644 --- a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/test/java/org/apache/skywalking/apm/plugin/customize/util/CustomizeExpressionTest.java +++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/util/CustomizeExpressionTest.java @@ -16,9 +16,8 @@ * */ -package org.apache.skywalking.apm.plugin.customize.util; +package org.apache.skywalking.apm.agent.core.util; -import org.apache.skywalking.apm.agent.core.util.CustomizeExpression; import org.junit.Assert; import org.junit.Test; diff --git a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeInstanceInstrumentation.java b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeInstanceInstrumentation.java index b0cd6e5d0..cc7627d69 100644 --- a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeInstanceInstrumentation.java +++ b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeInstanceInstrumentation.java @@ -21,8 +21,8 @@ package org.apache.skywalking.apm.plugin.customize.define; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.ClassInstanceMethodsEnhancePluginDefineV2; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.v2.InstanceMethodsInterceptV2Point; import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; import org.apache.skywalking.apm.plugin.customize.conf.CustomizeConfiguration; @@ -31,7 +31,7 @@ import org.apache.skywalking.apm.plugin.customize.conf.CustomizeConfiguration; * The instance of customize instrumentation. */ -public class CustomizeInstanceInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { +public class CustomizeInstanceInstrumentation extends ClassInstanceMethodsEnhancePluginDefineV2 { private String enhanceClass; @@ -45,20 +45,20 @@ public class CustomizeInstanceInstrumentation extends ClassInstanceMethodsEnhanc } @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + public InstanceMethodsInterceptV2Point[] getInstanceMethodsInterceptV2Points() { final ElementMatcher matcher = CustomizeConfiguration.INSTANCE.getInterceptPoints(enhanceClass, false); if (matcher == null) { - return new InstanceMethodsInterceptPoint[0]; + return new InstanceMethodsInterceptV2Point[0]; } else { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { + return new InstanceMethodsInterceptV2Point[] { + new InstanceMethodsInterceptV2Point() { @Override public ElementMatcher getMethodsMatcher() { return matcher; } @Override - public String getMethodsInterceptor() { + public String getMethodsInterceptorV2() { return "org.apache.skywalking.apm.plugin.customize.interceptor.CustomizeInstanceInterceptor"; } diff --git a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeStaticInstrumentation.java b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeStaticInstrumentation.java index f1f478e71..26558533f 100644 --- a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeStaticInstrumentation.java +++ b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/define/CustomizeStaticInstrumentation.java @@ -20,8 +20,8 @@ package org.apache.skywalking.apm.plugin.customize.define; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.ClassStaticMethodsEnhancePluginDefineV2; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.v2.StaticMethodsInterceptV2Point; import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; import org.apache.skywalking.apm.plugin.customize.conf.CustomizeConfiguration; @@ -30,7 +30,7 @@ import org.apache.skywalking.apm.plugin.customize.conf.CustomizeConfiguration; * The static of customize instrumentation. */ -public class CustomizeStaticInstrumentation extends ClassStaticMethodsEnhancePluginDefine { +public class CustomizeStaticInstrumentation extends ClassStaticMethodsEnhancePluginDefineV2 { private String enhanceClass; public CustomizeStaticInstrumentation(String enhanceClass) { @@ -38,20 +38,20 @@ public class CustomizeStaticInstrumentation extends ClassStaticMethodsEnhancePlu } @Override - public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() { + public StaticMethodsInterceptV2Point[] getStaticMethodsInterceptV2Points() { final ElementMatcher matcher = CustomizeConfiguration.INSTANCE.getInterceptPoints(enhanceClass, true); if (matcher == null) { - return new StaticMethodsInterceptPoint[0]; + return new StaticMethodsInterceptV2Point[0]; } else { - return new StaticMethodsInterceptPoint[] { - new StaticMethodsInterceptPoint() { + return new StaticMethodsInterceptV2Point[] { + new StaticMethodsInterceptV2Point() { @Override public ElementMatcher getMethodsMatcher() { return matcher; } @Override - public String getMethodsInterceptor() { + public String getMethodsInterceptorV2() { return "org.apache.skywalking.apm.plugin.customize.interceptor.CustomizeStaticInterceptor"; } diff --git a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/BaseInterceptorMethods.java b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/BaseInterceptorMethods.java index dcef43ec7..ea5974849 100644 --- a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/BaseInterceptorMethods.java +++ b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/BaseInterceptorMethods.java @@ -18,75 +18,167 @@ package org.apache.skywalking.apm.plugin.customize.interceptor; -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.plugin.customize.conf.CustomizeConfiguration; -import org.apache.skywalking.apm.plugin.customize.conf.MethodConfiguration; -import org.apache.skywalking.apm.plugin.customize.constants.Constants; -import org.apache.skywalking.apm.agent.core.util.CustomizeExpression; - import java.lang.reflect.Method; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +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.plugin.interceptor.enhance.v2.MethodInvocationContext; +import org.apache.skywalking.apm.agent.core.util.CustomizeExpression; +import org.apache.skywalking.apm.plugin.customize.conf.CustomizeConfiguration; +import org.apache.skywalking.apm.plugin.customize.conf.MethodConfiguration; +import org.apache.skywalking.apm.plugin.customize.constants.Constants; + class BaseInterceptorMethods { - void beforeMethod(Method method, Object[] allArguments) { + private static class SpanDataHolder { + final AbstractSpan localSpan; + + final Map tags; + + final Map logs; + + final Map spanTags; + + final Map spanLogs; + + public SpanDataHolder(AbstractSpan localSpan, Map tags, + Map logs, Map spanTags, Map spanLogs) { + this.localSpan = localSpan; + this.tags = tags; + this.logs = logs; + this.spanTags = spanTags; + this.spanLogs = spanLogs; + } + } + + void beforeMethod(Method method, Object[] allArguments, MethodInvocationContext miContext) { Map configuration = CustomizeConfiguration.INSTANCE.getConfiguration(method); String operationName = MethodConfiguration.getOperationName(configuration); - Map context = CustomizeExpression.evaluationContext(allArguments); - if (context == null || context.isEmpty()) { - ContextManager.createLocalSpan(operationName); + Map evalContext = CustomizeExpression.evaluationContext(allArguments); + + Map tags = MethodConfiguration.getTags(configuration); + Map logs = MethodConfiguration.getLogs(configuration); + Map spanTags = tags == null ? Collections.EMPTY_MAP : new HashMap(tags.size()); + Map spanLogs = logs == null ? Collections.EMPTY_MAP : new HashMap(logs.size()); + + if (evalContext == null || evalContext.isEmpty()) { + SpanDataHolder spanDataHolder = new SpanDataHolder( + ContextManager.createLocalSpan(operationName), + tags, logs, spanTags, spanLogs + ); + miContext.setContext(spanDataHolder); } else { - - Map tags = MethodConfiguration.getTags(configuration); - Map spanTags = new HashMap(); - Map logs = MethodConfiguration.getLogs(configuration); - Map spanLogs = new HashMap(); - List operationNameSuffixes = MethodConfiguration.getOperationNameSuffixes(configuration); StringBuilder operationNameSuffix = new StringBuilder(); if (operationNameSuffixes != null && !operationNameSuffixes.isEmpty()) { for (String expression : operationNameSuffixes) { operationNameSuffix.append(Constants.OPERATION_NAME_SEPARATOR); - operationNameSuffix.append(CustomizeExpression.parseExpression(expression, context)); + operationNameSuffix.append(CustomizeExpression.parseExpression(expression, evalContext)); } } - if (tags != null && !tags.isEmpty()) { - for (Map.Entry expression : tags.entrySet()) { - spanTags.put(expression.getKey(), CustomizeExpression.parseExpression(expression.getValue(), context)); - } - } - if (logs != null && !logs.isEmpty()) { - for (Map.Entry entries : logs.entrySet()) { - String expression = logs.get(entries.getKey()); - spanLogs.put(entries.getKey(), CustomizeExpression.parseExpression(expression, context)); - } - } - operationName = operationNameSuffix.insert(0, operationName).toString(); + evalAndPopulate(evalContext, tags, spanTags); + evalAndPopulate(evalContext, logs, spanLogs); - AbstractSpan span = ContextManager.createLocalSpan(operationName); - if (!spanTags.isEmpty()) { - for (Map.Entry tag : spanTags.entrySet()) { - span.tag(Tags.ofKey(tag.getKey()), tag.getValue()); - } - } - if (!spanLogs.isEmpty()) { - span.log(System.currentTimeMillis(), spanLogs); - } + operationName = operationNameSuffix.insert(0, operationName).toString(); + AbstractSpan localSpan = ContextManager.createLocalSpan(operationName); + + tagSpanTags(localSpan, spanTags); + tagSpanLogs(localSpan, spanLogs); + + spanTags.clear(); + spanLogs.clear(); + + SpanDataHolder spanDataHolder = new SpanDataHolder( + localSpan, tags, logs, spanTags, spanLogs + ); + miContext.setContext(spanDataHolder); } } - void afterMethod(Method method) { - ContextManager.stopSpan(); + void afterMethod(Method method, Object ret, MethodInvocationContext miContext) { + if (!ContextManager.isActive()) { + return; + } + SpanDataHolder spanDataHolder = (SpanDataHolder) miContext.getContext(); + if (spanDataHolder == null || spanDataHolder.localSpan == null) { + return; + } + AbstractSpan localSpan = spanDataHolder.localSpan; + if (ret == null) { + ContextManager.stopSpan(localSpan); + return; + } + Map tags = spanDataHolder.tags; + Map logs = spanDataHolder.logs; + Map spanTags = spanDataHolder.spanTags; + Map spanLogs = spanDataHolder.spanLogs; + + try { + Map evalContext = CustomizeExpression.evaluationReturnContext(ret); + + evalReturnAndPopulate(evalContext, tags, spanTags); + evalReturnAndPopulate(evalContext, logs, spanLogs); + + tagSpanTags(localSpan, spanTags); + tagSpanLogs(localSpan, spanLogs); + + spanTags.clear(); + spanLogs.clear(); + } finally { + ContextManager.stopSpan(localSpan); + } } void handleMethodException(Throwable t) { - if (ContextManager.isActive()) { - ContextManager.activeSpan().log(t); + ContextManager.activeSpan().log(t); + } + + private void evalAndPopulate(Map context, Map exprMap, Map toMap) { + if (exprMap != null && !exprMap.isEmpty()) { + for (Map.Entry entry : exprMap.entrySet()) { + String expression = entry.getValue(); + if (isReturnedObjExpression(expression)) { + continue; + } + toMap.put(entry.getKey(), CustomizeExpression.parseExpression(expression, context)); + } } } + private void evalReturnAndPopulate(Map context, Map exprMap, + Map toMap) { + if (exprMap != null && !exprMap.isEmpty()) { + for (Map.Entry entry : exprMap.entrySet()) { + String expression = entry.getValue(); + if (!isReturnedObjExpression(expression)) { + continue; + } + toMap.put(entry.getKey(), CustomizeExpression.parseReturnExpression(expression, context)); + } + } + } + + private void tagSpanTags(AbstractSpan span, Map spanTags) { + if (spanTags != null && !spanTags.isEmpty()) { + for (Map.Entry tag : spanTags.entrySet()) { + span.tag(Tags.ofKey(tag.getKey()), tag.getValue()); + } + } + } + + private void tagSpanLogs(AbstractSpan span, Map spanLogs) { + if (spanLogs != null && !spanLogs.isEmpty()) { + span.log(System.currentTimeMillis(), spanLogs); + } + } + + private boolean isReturnedObjExpression(String expression) { + String[] es = expression.split("\\."); + return "returnedObj".equals(es[0]); + } } diff --git a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeInstanceInterceptor.java b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeInstanceInterceptor.java index 96f069b58..5a61a9e72 100644 --- a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeInstanceInterceptor.java +++ b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeInstanceInterceptor.java @@ -18,29 +18,29 @@ package org.apache.skywalking.apm.plugin.customize.interceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; - import java.lang.reflect.Method; -public class CustomizeInstanceInterceptor extends BaseInterceptorMethods implements InstanceMethodsAroundInterceptor { +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.InstanceMethodsAroundInterceptorV2; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.MethodInvocationContext; + +public class CustomizeInstanceInterceptor extends BaseInterceptorMethods implements InstanceMethodsAroundInterceptorV2 { @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) throws Throwable { - super.beforeMethod(method, allArguments); + MethodInvocationContext context) throws Throwable { + super.beforeMethod(method, allArguments, context); } @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) throws Throwable { - super.afterMethod(method); + Object ret, MethodInvocationContext context) throws Throwable { + super.afterMethod(method, ret, context); return ret; } @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { + Class[] argumentsTypes, Throwable t, MethodInvocationContext context) { super.handleMethodException(t); } } diff --git a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeStaticInterceptor.java b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeStaticInterceptor.java index 96dc4f8c5..631803d2e 100644 --- a/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeStaticInterceptor.java +++ b/apm-sniffer/optional-plugins/customize-enhance-plugin/src/main/java/org/apache/skywalking/apm/plugin/customize/interceptor/CustomizeStaticInterceptor.java @@ -18,28 +18,29 @@ package org.apache.skywalking.apm.plugin.customize.interceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor; - import java.lang.reflect.Method; -public class CustomizeStaticInterceptor extends BaseInterceptorMethods implements StaticMethodsAroundInterceptor { +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.MethodInvocationContext; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.StaticMethodsAroundInterceptorV2; + +public class CustomizeStaticInterceptor extends BaseInterceptorMethods implements StaticMethodsAroundInterceptorV2 { + @Override public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class[] parameterTypes, - MethodInterceptResult result) { - super.beforeMethod(method, allArguments); + MethodInvocationContext context) { + super.beforeMethod(method, allArguments, context); } @Override public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class[] parameterTypes, - Object ret) { - super.afterMethod(method); + Object ret, MethodInvocationContext context) { + super.afterMethod(method, ret, context); return ret; } @Override public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class[] parameterTypes, - Throwable t) { + Throwable t, MethodInvocationContext context) { super.handleMethodException(t); } } diff --git a/docs/en/setup/service-agent/java-agent/Customize-enhance-trace.md b/docs/en/setup/service-agent/java-agent/Customize-enhance-trace.md index 47bbe5763..f5aa3414f 100644 --- a/docs/en/setup/service-agent/java-agent/Customize-enhance-trace.md +++ b/docs/en/setup/service-agent/java-agent/Customize-enhance-trace.md @@ -38,6 +38,15 @@ Implementing enhancements to custom classes requires two steps. arg[0].os.[1] arg[0].getM().['k1'] + + returnedObj + returnedObj + + + returnedObj.model1.id + returnedObj.model1.getId() + @@ -53,7 +62,6 @@ Implementing enhancements to custom classes requires two steps. - ``` - Explanation of the configuration in the file @@ -69,4 +77,5 @@ Implementing enhancements to custom classes requires two steps. | arg[x] | What it means is to get the input arguments. such as arg[0] is means get first arguments. | | .[x] | When the parsing object is Array or List, you can use it to get the object at the specified index. | | .['key'] | When the parsing object is Map, you can get the map 'key' through it.| + | returnedObj | What it means is to get the return value. | diff --git a/test/plugin/scenarios/customize-scenario/bin/startup.sh b/test/plugin/scenarios/customize-scenario/bin/startup.sh index 3cc699d99..7dbec00fe 100644 --- a/test/plugin/scenarios/customize-scenario/bin/startup.sh +++ b/test/plugin/scenarios/customize-scenario/bin/startup.sh @@ -20,4 +20,4 @@ home="$(cd "$(dirname $0)"; pwd)" java -jar ${agent_opts} \ -Dskywalking.plugin.customize.enhance_file=${home}/../config/customize_enhance.xml \ - ${home}/../libs/customize-scenario.jar & \ No newline at end of file + ${home}/../libs/customize-scenario.jar & diff --git a/test/plugin/scenarios/customize-scenario/config/customize_enhance.xml b/test/plugin/scenarios/customize-scenario/config/customize_enhance.xml index bf7ac6f4e..32e8d94e8 100644 --- a/test/plugin/scenarios/customize-scenario/config/customize_enhance.xml +++ b/test/plugin/scenarios/customize-scenario/config/customize_enhance.xml @@ -43,6 +43,15 @@ arg[0].os.[1] arg[0].getM().['k1'] + + returnedObj + returnedObj + + + returnedObj.model1.id + returnedObj.model1.getId() + @@ -57,4 +66,4 @@ arg[1] - \ No newline at end of file + diff --git a/test/plugin/scenarios/customize-scenario/config/expectedData.yaml b/test/plugin/scenarios/customize-scenario/config/expectedData.yaml index fe9f36b79..ad8c9d4cc 100644 --- a/test/plugin/scenarios/customize-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/customize-scenario/config/expectedData.yaml @@ -110,6 +110,32 @@ segmentItems: - logEvent: - {key: log_5_1, value: '123'} skipAnalysis: 'false' + - operationName: /retString + parentSpanId: 0 + spanId: 9 + startTime: nq 0 + endTime: nq 0 + isError: false + spanType: Local + tags: + - {key: tag_ret, value: 'str0'} + logs: + - logEvent: + - {key: log_map, value: 'str0'} + skipAnalysis: 'false' + - operationName: /retModel0 + parentSpanId: 0 + spanId: 10 + startTime: nq 0 + endTime: nq 0 + isError: false + spanType: Local + tags: + - {key: tag_ret, value: '100'} + logs: + - logEvent: + - {key: log_map, value: '100'} + skipAnalysis: 'false' - operationName: GET:/case/customize parentSpanId: -1 spanId: 0 diff --git a/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/controller/CustomizeController.java b/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/controller/CustomizeController.java index 9d3532e44..9a8cb748f 100644 --- a/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/controller/CustomizeController.java +++ b/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/controller/CustomizeController.java @@ -78,6 +78,9 @@ public class CustomizeController { add("a2"); }}, 123); + testService1.retString("str0"); + testService1.retModel0(m0); + LOGGER.info(SUCCESS); return SUCCESS; } diff --git a/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/service/TestService1.java b/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/service/TestService1.java index 3640cbc37..fd3581532 100644 --- a/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/service/TestService1.java +++ b/test/plugin/scenarios/customize-scenario/src/main/java/test/apache/skywalking/apm/testcase/customize/service/TestService1.java @@ -44,4 +44,12 @@ public class TestService1 { public void method(Model0 m0, String str0, int count) { } + + public String retString(String str0) { + return str0; + } + + public Model0 retModel0(Model0 m0) { + return m0; + } }