consider introducing proper tracing, not sure how ...
# spring
t
consider introducing proper tracing, not sure how it works with coroutines but it would be a better solution imo: https://spring.io/projects/spring-cloud-sleuth
☝️ 2
once you have this, spring will autogenerate a trace, and you could use that trace to follow a request along its entire journey. to actually monitor times, micrometer (included in the actuator) would help you there, and since you have a trace to correlate you get what you want
again, not knowing how any of this interacts with coroutines
e
This looks interesting, I'll investigate this further
thanks
c
Maybe @sdeleuze can shed some light
s
We use sleuth in our application with coroutines. I’m not sure if there is a better way, but if I recall we normally have to pass the MDC context manually into the coroutine context.
e
MDC?
s
Sleuth adds trace ids and span ids to SLF4J MDC and it works really great with other Spring libraries since it will instrument your components for you. You have to do it manually when launching new coroutines so everything stays instrumented, there is a helper library for this: https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration/kotlinx-coroutines-slf4j
Chances are that you can just add the sleuth dependency and see most things working, but with coroutines there’s just a little bit more work involved.