You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/08/15 07:54:16 UTC

[GitHub] flysqrlboy opened a new issue #1547: Some span segments in a trace disappared In my custom agent plugin

flysqrlboy opened a new issue #1547: Some span segments in a trace  disappared In my custom agent plugin
URL: https://github.com/apache/incubator-skywalking/issues/1547
 
 
   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [ ] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   
   - Which version of SkyWalking, OS and JRE?
   SkyWalking: 5.0.0-beta2
   
   
   - What happen?
   If possible, provide a way for reproducing the error. e.g. demo application, component version.
   
   ###### As below, my custom agent plugin code for myself RPC framework.
   
   ```
   
   public class DCClientInterceptor implements InstanceMethodsAroundInterceptor {
   
       @Override
       public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
               Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
   
           RpcContext rpcContext = RpcContext.getContext();
           ClientInvokeContext clientContext = (ClientInvokeContext) allArguments[0];
           ContextCarrier contextCarrier = new ContextCarrier();
           AbstractSpan span = ContextManager.createExitSpan("DC/client/invoke", contextCarrier,
                   "domain:" + clientContext.getRequestBuilder().getDomain() + ",op:"
                           + clientContext.getRequestBuilder().getOp());
   
           CarrierItem next = contextCarrier.items();
           while (next.hasNext()) {
               next = next.next();
               rpcContext.setAttachment(next.getHeadKey(), next.getHeadValue());
           }
           span.setComponent("DC");
           SpanLayer.asRPCFramework(span);
       }
   
       @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, Class<?>[] argumentsTypes, Throwable t) {
   
           ContextManager.activeSpan().errorOccurred().log(t);
       }
   
   ```
   
   ```
   
   public class DCServerInterceptor implements InstanceMethodsAroundInterceptor {
   
       @Override
       public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
               Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
   
           RpcContext rpcContext = RpcContext.getContext();
           InvokeContext invokeContext = (InvokeContext) allArguments[0];
           ContextCarrier contextCarrier = new ContextCarrier();
   
           CarrierItem next = contextCarrier.items();
           while (next.hasNext()) {
               next = next.next();
               next.setHeadValue(rpcContext.getAttachment(next.getHeadKey()));
           }
   
           AbstractSpan span = ContextManager.createEntrySpan("/DC/server/process-domain:"
                   + invokeContext.getDomain() + ";op:" + invokeContext.getOp(), contextCarrier);
   
           span.setComponent("DC");
           SpanLayer.asRPCFramework(span);
       }
   
       @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, Class<?>[] argumentsTypes, Throwable t) {
   
           ContextManager.activeSpan().errorOccurred().log(t);
       }
   
   }
   
   ```
   
   But Strangely,In the skywalking dashboard, THE SPAN "SpringMVC" and "DCClient" was gone in the trace chain, it just only leave the "DCServer" span. As Below graph:
   
   ![image](https://user-images.githubusercontent.com/7646548/44137337-a273f724-a0a2-11e8-8f32-53fba87d6d51.png)
   
   
   ##### As Below are debug info at that time:
   
   - DCClient(RPC Client) context 
   
   ![image](https://user-images.githubusercontent.com/7646548/44137514-47ce9a3a-a0a3-11e8-831d-697f55dd855e.png)
   
   ![image](https://user-images.githubusercontent.com/7646548/44137534-5221a4d2-a0a3-11e8-9ac7-5dadf2ce4a0f.png)
   
   
   - DCServer (RPC Server) context
   
   ![image](https://user-images.githubusercontent.com/7646548/44137552-5ee1adde-a0a3-11e8-82d0-57aee56b2496.png)
   
   ![image](https://user-images.githubusercontent.com/7646548/44137558-69a5a4a0-a0a3-11e8-8c77-4ea571e0f602.png)
   
   
   ___
   ### Requirement or improvement
   - Please describe about your requirements or improvement suggestions.

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


With regards,
Apache Git Services