Looking for a way to track the number of suspended...
# coroutines
m
Looking for a way to track the number of suspended coroutines in a context. My best guess for now is to make
ContinuationInterceptor
returning my custom continuation. Though cannot find an event on coroutine suspension.
interceptContinuation
is called much less often than
resumeWith
.
z
There's no built-in hook for suspension - at the byte code level, a suspension is just a suspend function returning the suspended sentinel value instead of the actual return value. That said, I think the coroutine debug agent might let you derive some of the metrics you're looking for: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-debug/README.md
m
Looked at that, but this solutions seems too heavy and too young for a production code