I have not seen any examples of integratin opentra...
# ktor
e
I have not seen any examples of integratin opentracing/jaeger in ktor. Can you point me in the right direction?
d
Never used jaeger/opentracing, so can’t help much with this. But I guess that as long as there is a JVM/Java library for using it, you can use it with ktor. Ktor allows to intercept all the requests so you can put custom code, before and after each request: https://ktor.io/advanced/pipeline/route.html
e
On JVM it uses ThreadLocal to pass context around. Should I use custom coroutine context instead?
d
This is your thread: https://github.com/Kotlin/kotlinx.coroutines/issues/119 We talked about this in ktor not too much ago, but it seems that has been lost in slack by just one day (17th june). There was several proposal about how to use coroutines to restore the ThreadLocal stuff on each context change, but ideally you should try to use non-thread local whenever it is possible. You can use kotlin DSL (receivers) or the corotuine context to store stuff, and extension methods to make things nicer. @katokay did this in the end: https://github.com/ktorio/ktor-samples/commit/1e011e4c43bcfe9269ded6ced7e7385453415c21 You can also ask in #coroutines
e
Looks good, thanks
👍 1
f
hey @enleur , i've been working on this, see https://github.com/zopaUK/ktor-opentracing