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 2019/10/29 12:44:49 UTC

[GitHub] [skywalking] Karlzzb opened a new issue #3738: how to link multispans to the same traceId

Karlzzb opened a new issue #3738: how to link multispans to the same traceId
URL: https://github.com/apache/skywalking/issues/3738
 
 
   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [*] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
   I need to know how to link two spans. 
   ___
   ### Bug
   - Which version of SkyWalking, OS and JRE?
   6.4.0
   - Which company or project?
   zcsmart
   The inner framework in our company. https://github.com/karl-free-legion/zcs-legion-cluster.git
   - What happen?
   If possible, provide a way for reproducing the error. e.g. demo application, component version.
   
   I need to know how to link two spans. I try two methods, neither of which is working.
   
   First : I tried the way attach in my message, codes as below
   
   `        CarrierItem next = contextCarrier.items();
           while (next.hasNext()) {
               next = next.next();
               String contextValue = header.getContextCarrierOrDefault(next.getHeadKey(),"");
               if (!StringUtil.isEmpty(contextValue)) {
                   System.out.println("receive message ["+header.getTrackId()+"] contextCarrier got key="+next.getHeadKey()+",value="+contextValue);
                   next.setHeadValue(contextValue);
               }
           }`
   
   Second: I also use the traceId setting way, such as
   `        List<DistributedTraceId> distributedTraceIds = new ArrayList();
           distributedTraceIds.add(new PropagatedTraceId(header.getTrackId()));
           contextCarrier.setDistributedTraceIds(distributedTraceIds);
           AbstractSpan span = ContextManager.createEntrySpan(header.getTag(), contextCarrier);
   //        span.setPeer(header.getModuleSource().getGroupId());
           new StringTag(Constans.CARRIER_LEGION_TRACK_ID_KEY).set(span,header.getTrackId());
           span.setOperationName("handler Message【"+header.getTrackId()+"】");
           Tags.URL.set(span,header.getUri());
           SpanLayer.asRPCFramework(span);
           span.setComponent(ComponentsDefine.GRPC);`
   
   **The result is** 
   端点:sent out Message【65.96.15723518143630001】
   traceId: 65.96.15723518143630001
   跨度类型:Exit
   组件:
   Peer:g001
   失败:false
   url:M://g001
   legion_track_id:65.96.15723518143630001
   
   跨度信息
   标记.
   端点:handler Message【65.96.15723518143630001】
   traceId: 64.91.15723518147410001
   跨度类型:Entry
   组件:GRPC
   Peer:No Peer
   失败:false
   legion_track_id:65.96.15723518143630001
   url:M://g001
   
   ___
   ### 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 to 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