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

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


The following commit(s) were added to refs/heads/master by this push:
     new e355547  Support RedisTemplate via Jedis Plugin (#2579)
e355547 is described below

commit e3555479b4f88436dcf62c9be02db3e5a8c3c42f
Author: Lemon <[email protected]>
AuthorDate: Sun May 5 15:22:13 2019 +0800

    Support RedisTemplate via Jedis Plugin (#2579)
    
    * Support byte[] value for Jedis Plugin
    
    * When the type of key is byte[], only the method name is recorded.
---
 .../apm/plugin/jedis/v2/JedisMethodInterceptor.java          | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java
index 531804d..f154b12 100644
--- 
a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java
+++ 
b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java
@@ -20,6 +20,7 @@
 package org.apache.skywalking.apm.plugin.jedis.v2;
 
 import java.lang.reflect.Method;
+
 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;
@@ -31,7 +32,8 @@ import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
 
 public class JedisMethodInterceptor implements 
InstanceMethodsAroundInterceptor {
 
-    @Override public void beforeMethod(EnhancedInstance objInst, Method 
method, Object[] allArguments,
+    @Override
+    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments,
         Class<?>[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
         String peer = String.valueOf(objInst.getSkyWalkingDynamicField());
         AbstractSpan span = ContextManager.createExitSpan("Jedis/" + 
method.getName(), peer);
@@ -41,16 +43,20 @@ public class JedisMethodInterceptor implements 
InstanceMethodsAroundInterceptor
 
         if (allArguments.length > 0 && allArguments[0] instanceof String) {
             Tags.DB_STATEMENT.set(span, method.getName() + " " + 
allArguments[0]);
+        } else if (allArguments.length > 0 && allArguments[0] instanceof 
byte[]) {
+            Tags.DB_STATEMENT.set(span, method.getName());
         }
     }
 
-    @Override public Object afterMethod(EnhancedInstance objInst, Method 
method, Object[] allArguments,
+    @Override
+    public Object afterMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments,
         Class<?>[] argumentsTypes, Object ret) throws Throwable {
         ContextManager.stopSpan();
         return ret;
     }
 
-    @Override public void handleMethodException(EnhancedInstance objInst, 
Method method, Object[] allArguments,
+    @Override
+    public void handleMethodException(EnhancedInstance objInst, Method method, 
Object[] allArguments,
         Class<?>[] argumentsTypes, Throwable t) {
         AbstractSpan span = ContextManager.activeSpan();
         span.errorOccurred();

Reply via email to