devkanro commented on PR #451:
URL: https://github.com/apache/skywalking-java/pull/451#issuecomment-1420394812

   Kotlin Coroutine will create those StackTraceElement by two ways.
   
   1. Someone generated from compile-time, it can get the most superficial 
stack, which has no performance cost.  
     
[ContinuationImpl.kt#L76](https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt#L76)
 
[DebugMetadata#L41-L49](https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/jvm/src/kotlin/coroutines/jvm/internal/DebugMetadata.kt#L41-L49)
   2. Another converted from an exception stack trace, these can cause the 
performance issues you're worried about.
     
[DebugProbesImpl#L496](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt#L496)
   
   By default, kotlin provides the second option for every coroutine created, 
we can refer to the following 
[documents](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-debug/)
 to turn off this behavior. 
   
   I plan to only use the compile-time generated StackTraceElement provided in 
option1 as the source of suspend point logs, so we can get the best performance.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to