celine2c commented on issue #6576:
URL: https://github.com/apache/skywalking/issues/6576#issuecomment-804270645


   Hi,
   
   I tried both the approaches but both are not giving expected results.
   
   1. For the contextManager.capture() approach - Expectation is, this will 
create two seperate segments, there will be a child of releationship between 
two.
        
                MainThread
                        createsEntrySpan
                        calls Runnable
                                In the runnable's constructor I take the 
snapshot.
                                Pass the snapshot in the EnhancedInstance's 
setSkyWalkingDynamicField
                        Do processing as the main thread has more job to do
                        stopSpan
                
                SubThread (this will start before or after the stopSpan 
according to the process jobs of the main thread)
                        In the run before method interceptor, I get the 
snapshot from EnhancedInstance's getSkyWalkingDynamicField
                                creates local span
                                ContextManager.continued
                        Do processes
                        In the run after method interceptor, stopSpan.
                        
        This approach, creates the first segment, but not the second one. 
        Is this behaving right or am I missing something?
        
   2.   For the prepareForAsync approach - Expectation is, this will pass the 
spans between threads and once asyncFinish is called, it will create a 
singleSpan
        
                MainThread      
                        createEntrySpan
                        calls Runnable  
                                In the runnable's constructor I call 
prepareForAsync 
                                Pass the span in the EnhancedInstance's 
setSkyWalkingDynamicField
                        Do processing as the main thread has more job to do
                        stopSpan // I tried without stopping the span as well. 
Which approach is right?
                        
                SubThread (this will start before or after the stopSpan 
according to the process jobs of the main thread)
                        In the run before method interceptor, I get the span 
from EnhancedInstance's getSkyWalkingDynamicField
                                //I can see that the span is active here        
                        Do processes
                                Static calls are made. I have interceptors for 
the static method as well. - At this point, I am unable to get the reference of 
the span in the static interceptor. How should I achive it as I have the span 
in getSkyWalkingDynamicField which is not available in the static interceptors.
                        asyncFinish
                        
        Do we need to pass the spans to different interceptors in the 
subThreads? If so how from the second thread to the staticmethod interceptors?
        
   Thanks in advance!


-- 
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:
[email protected]


Reply via email to