# Need support of Elastic APM Agent for Kotlin Coroutine

**URL:** <https://discuss.elastic.co/t/need-support-of-elastic-apm-agent-for-kotlin-coroutine/220280>\
**Category:** APM\
**Tags:** java\
**Created:** [February 21, 2020, 1:15am UTC](https://discuss.elastic.co/t/need-support-of-elastic-apm-agent-for-kotlin-coroutine/220280 "2020-02-21T01:15:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ty-edelweiss](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@ty-edelweiss](https://discuss.elastic.co/u/ty-edelweiss)\
**Post date:** [February 21, 2020, 1:15am UTC](https://discuss.elastic.co/t/need-support-of-elastic-apm-agent-for-kotlin-coroutine/220280/1 "2020-02-21T01:15:30Z")

</div>

I faced the problem to trace logs while using Kotlin. I want to use Kotlin Coroutine in our program. But apm-java-agent hasn't support it yet. Of course, Kotlin is 100% compatible with Java.  
That's why I can use ExecutorService but want to use Kotlin Coroutine if possible because it seems to be lighter than a thread.  
Is there any plan to support this package in the near future?

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [February 21, 2020, 8:07am UTC](https://discuss.elastic.co/t/need-support-of-elastic-apm-agent-for-kotlin-coroutine/220280/2 "2020-02-21T08:07:33Z")

</div>

Hi and welcome to the forum 👋

Kotlin Coroutines are not on our near-term roadmap yet. You could either contribute a plugin for that or use the API to manually propagate the trace context by getting the current span (`ElasticApm.currentSpan()`) before calling the coroutine and activating the span in the coroutine: [https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-span-activate](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-span-activate)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 13, 2020, 4:07am UTC](https://discuss.elastic.co/t/need-support-of-elastic-apm-agent-for-kotlin-coroutine/220280/3 "2020-03-13T04:07:43Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
