Hello! I'm using Spring and I would like to use K...
# ktor
d
Hello! I'm using Spring and I would like to use Ktor as client instead of classic Webflux Everything works well, except to integrate span with Datadog. With Webflux, the integration was native, but in Ktor it seems not to be. Is someone of you know how I can have call traces in datadog with Ktor and Spring please?
s
Hey @Distractic, It seems there is support for Datadog for OkHttp which you can use as the underlying engine for the Ktor client using the OkHttp Engine. So you can use the Ktor client in conjunction with OkHttp to benefit from its Datadog support without Ktor explicitly building.Otherwise it would require writing a custom client plugin to wrap the requests in the required datadog spans.
1
d
Ok I will try in some hours! I keep you informed thanks
Do I need to customize something with OkHTTP? After changing the Engine from CIO to OkHttp, I got the same result in Datadog and only the trace from Spring (health endpoint etc.) are visible, but not the trace of my request that produces a 4XX
Aaah .. I got traces .. but some hours after, maybe there is a delay .. I will continue to test tomorrow
s
I’m not sure about configuring the engine, on their website in the documentation it mentions adding the Java agent and it automatically wires itself.
d
Yes and that's the case. After 10min (approx), I got traces. So thank you very much! (And yes I read the datadog documentation but that's .. not very friendly, for me at least)
s
No, that wasn't the most friendly documentation for me either. Great to hear that worked for you 🙌
s
The CIO engine does not work with APMs in datadog.... ask me how I know 🤕 .... the netty and okhttp engines do but it also has different names for the traces. In DD in APMs on top left, check the operation drop down to see if you're defaulted to one thats not standard. Mine for Netty for example. It was defaulted to ok.http when I first setup because some of my imported libraries use okhttp under the hood.
d
I have the same behavior 👍