# Node APM auto span middlewares

**URL:** <https://discuss.elastic.co/t/node-apm-auto-span-middlewares/133774>\
**Category:** APM\
**Created:** [May 30, 2018, 2:45am UTC](https://discuss.elastic.co/t/node-apm-auto-span-middlewares/133774 "2018-05-30T02:45:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fejalish](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fejalish/32/31364_2.png) [@fejalish](https://discuss.elastic.co/u/fejalish)\
**Post date:** [May 30, 2018, 2:45am UTC](https://discuss.elastic.co/t/node-apm-auto-span-middlewares/133774/1 "2018-05-30T02:45:32Z")

</div>

Hallo,

After trying out the Node APM with a Koa app and I've noticed that there's no auto-instrumentation of middlewares - i.e. no span for each middleware used. And after poking around to attempt a rough implementation, I assume that is because it's not necessarily a trivial task with Koa.

So my question is what is perhaps the best route to getting additional middlewares instrumented - doing an implementation for each module? Is there perhaps a plan to auto-instrument? I'm hoping to avoid spamming application level span creation in my code. 🙂

Thanks,  
Jeff.

---

<div class="post-metadata">

**Author:** ![wa7son](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wa7son/32/21259_2.png) [@wa7son](https://discuss.elastic.co/u/wa7son)\
**Post date:** [May 30, 2018, 2:38pm UTC](https://discuss.elastic.co/t/node-apm-auto-span-middlewares/133774/2 "2018-05-30T14:38:17Z")

</div>

Yeah, we currently don't auto instrument Koa middlewares (we don't do that for Express either). But it's definitely something that I've been considering - we just haven't had any requests for it before now.

I don't know how complicated it would be, so I can't say anything about when we'll get time to look into it unfortunately.

May I suggest that you open a new [feature request](https://github.com/elastic/apm-agent-nodejs/issues/new?template=Feature_request.md) so we don't forget 🙂

---

<div class="post-metadata">

**Author:** ![fejalish](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fejalish/32/31364_2.png) [@fejalish](https://discuss.elastic.co/u/fejalish)\
**Post date:** [May 31, 2018, 2:44am UTC](https://discuss.elastic.co/t/node-apm-auto-span-middlewares/133774/3 "2018-05-31T02:44:22Z")

</div>

Will do. 🙂 I'd love to help out even if possible.

---

<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:** [June 20, 2018, 10:44pm UTC](https://discuss.elastic.co/t/node-apm-auto-span-middlewares/133774/4 "2018-06-20T22:44:23Z")

</div>

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