You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ta...@apache.org on 2020/04/26 04:51:00 UTC

[skywalking] 03/03: add md.

This is an automated email from the ASF dual-hosted git repository.

tanjian pushed a commit to branch active_span_enhan
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 6405272b0808163105a8f953bdc6d6d2d07f4066
Author: JaredTan95 <ji...@daocloud.io>
AuthorDate: Sun Apr 26 12:50:24 2020 +0800

    add md.
---
 .../apm/toolkit/activation/trace/ActiveSpanActivation.java          | 6 +++---
 docs/en/setup/service-agent/java-agent/Application-toolkit-trace.md | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/ActiveSpanActivation.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/ActiveSpanActivation.java
index fa795f5..b4f9b1e 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/ActiveSpanActivation.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/ActiveSpanActivation.java
@@ -20,11 +20,11 @@ package org.apache.skywalking.apm.toolkit.activation.trace;
 
 import net.bytebuddy.description.method.MethodDescription;
 import net.bytebuddy.matcher.ElementMatcher;
-import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
-import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
 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.match.ClassMatch;
+import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
 
 import static net.bytebuddy.matcher.ElementMatchers.named;
 import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
@@ -162,7 +162,7 @@ public class ActiveSpanActivation extends ClassStaticMethodsEnhancePluginDefine
             new StaticMethodsInterceptPoint() {
                 @Override
                 public ElementMatcher<MethodDescription> getMethodsMatcher() {
-                    return named(SET_OPERATION_NAME_METHOD_NAME).and(takesArguments(0));
+                    return named(SET_OPERATION_NAME_METHOD_NAME).and(takesArgumentWithType(0, "java.lang.String"));
                 }
 
                 @Override
diff --git a/docs/en/setup/service-agent/java-agent/Application-toolkit-trace.md b/docs/en/setup/service-agent/java-agent/Application-toolkit-trace.md
index 3586367..3f28662 100644
--- a/docs/en/setup/service-agent/java-agent/Application-toolkit-trace.md
+++ b/docs/en/setup/service-agent/java-agent/Application-toolkit-trace.md
@@ -27,6 +27,7 @@ The `value` of `Tag` is the same as what are supported in [Customize Enhance Tra
 * `ActiveSpan.error(Throwable throwable)` Mark the current span as error status with a Throwable.
 * `ActiveSpan.debug(String debugMsg)` Add a debug level log message in the current span.
 * `ActiveSpan.info(String infoMsg)` Add an info level log message in the current span.
+* `ActiveSpan.setOperationName(String operationName)` Customize an operation name. 
 
 ```java
 ActiveSpan.tag("my_tag", "my_value");
@@ -49,6 +50,7 @@ ActiveSpan.debug("Test-debug-Msg");
 @Tag(key = "username", value = "returnedObj.username")
 @Tag(key = "age", value = "returnedObj.age")
 public User methodYouWantToTrace(String param1, String param2) {
+    // ActiveSpan.setOperationName("Customize your own methodYouWantToTrace");
     // ...
 }
 ```