tom-pytel commented on pull request #89:
URL: https://github.com/apache/skywalking-python/pull/89#issuecomment-733711640


   > That is what I meant, this kind of cases may be hard to reproduce stably 
but it would be nice if we can add a test case to possibly cover it as our best 
effort, so I need your help to reproduce it under #88, feel free to do it when 
you got some time. I'm merging this for now. Thanks again
   
   ```
   import time
   from skywalking import agent
   from skywalking.trace.context import get_context
   
   agent.start()
   
   async def test(num):
       # with get_context().new_local_span(f'child{num}'):
       with get_context().new_exit_span(f'child{num}', '0.0.0.0'):
           from skywalking.trace.context import _spans; print('...', _spans())
           await asyncio.sleep(0.01)  # allow other tasks to tick and start 
spans
           if num == 1:
               get_context().active_span().raised()  # error a single child
   
   async def main():
       with get_context().new_local_span('parent'):
           await asyncio.gather(
               test(0),
               test(1),
               test(2),
           )
   
   asyncio.run(main())
   
   time.sleep(1)  # allow BG daemon thread to finish updating
   ```
   Compare #88 with this PR.
   


----------------------------------------------------------------
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


Reply via email to