wu-sheng commented on a change in pull request #4177: Enhance gRPC plugin
URL: https://github.com/apache/skywalking/pull/4177#discussion_r366914052
 
 

 ##########
 File path: 
apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/client/BlockingCallInterceptor.java
 ##########
 @@ -16,43 +16,48 @@
  *
  */
 
-package org.apache.skywalking.apm.plugin.grpc.v1;
+package org.apache.skywalking.apm.plugin.grpc.v1.client;
 
 import io.grpc.Channel;
 import io.grpc.MethodDescriptor;
-import java.lang.reflect.Method;
 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.context.trace.SpanLayer;
 import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
 import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
 import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
 
+import java.lang.reflect.Method;
+
+import static 
org.apache.skywalking.apm.plugin.grpc.v1.Constants.BLOCKING_CALL_EXIT_SPAN;
 import static 
org.apache.skywalking.apm.plugin.grpc.v1.OperationNameFormatUtil.formatOperationName;
 
 /**
- * @author zhang xin
+ * @author zhang xin, kanro
  */
 public class BlockingCallInterceptor implements StaticMethodsAroundInterceptor 
{
 
-    @Override public void beforeMethod(Class clazz, Method method, Object[] 
allArguments, Class<?>[] parameterTypes,
-        MethodInterceptResult result) {
-        Channel channel = (Channel)allArguments[0];
-        MethodDescriptor methodDescriptor = (MethodDescriptor)allArguments[1];
+    @Override
+    public void beforeMethod(Class clazz, Method method, Object[] 
allArguments, Class<?>[] parameterTypes,
+                             MethodInterceptResult result) {
+        Channel channel = (Channel) allArguments[0];
+        MethodDescriptor<?, ?> methodDescriptor = (MethodDescriptor<?, ?>) 
allArguments[1];
         final AbstractSpan span = 
ContextManager.createExitSpan(formatOperationName(methodDescriptor), 
channel.authority());
         span.setComponent(ComponentsDefine.GRPC);
-        SpanLayer.asRPCFramework(span);
+        span.setLayer(SpanLayer.RPC_FRAMEWORK);
+        ContextManager.getRuntimeContext().put(BLOCKING_CALL_EXIT_SPAN, span);
 
 Review comment:
   If not, whether the multiple RPCs will trigger dirty read?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to