# Spans don't form a waterfall in UI (Node.js agent)

**URL:** <https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649>\
**Category:** APM\
**Created:** [January 17, 2019, 2:27pm UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649 "2019-01-17T14:27:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![treble.snake](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/treble.snake/32/39818_2.png) [@treble.snake](https://discuss.elastic.co/u/treble.snake)\
**Post date:** [January 17, 2019, 2:27pm UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649/1 "2019-01-17T14:27:37Z")

</div>

Hi,

I've run into a strange issue regarding the span waterfal in APM Ul.  
Say, I have a simple code like this:

```auto
const wait = time => () => new Promise(resolve => setTimeout(resolve, time));

const transaction = agent.startTransaction('test-apm-2', 'job');
const overallSpan = transaction.startSpan('overall-span', 'task');
let span1, span2, span3;

Promise.resolve()
  .then(wait(50))
  .then(() => span1 = transaction.startSpan('span-1', 'task'))
  .then(wait(50))
  .then(() => span1.end())
  .then(() => span2 = transaction.startSpan('span-2', 'task'))
  .then(wait(100))
  .then(() => span2.end())
  .then(() => span3 = transaction.startSpan('span-3', 'task'))
  .then(wait(150))
  .then(() => span3.end())
  .then(() => {
    overallSpan.end();
    transaction.end();
    agent.flush();
  });

```

I expect this behaviour: `overall-span` covers all transaction timeline and spans 1,2 and 3 appear sequentially. But instead I'm having the following picture will all spans starting at once:

 ![amp-span-waterfall](https://us1.discourse-cdn.com/elastic/original/3X/e/1/e100ca08b07fad66873bf612ceed15e2a02e737f.png)

The same thing appears with default instrumentation spans (like DB queries) - they all start at the same time in UI.

Am I doing something wrong? Or do I get the idea of waterfall wrong?

Node.js Agent v2.1.0  
APM Server v6.5.3

Thanks.

---

<div class="post-metadata">

**Author:** ![stephenbelanger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenbelanger/32/34880_2.png) [@stephenbelanger](https://discuss.elastic.co/u/stephenbelanger)\
**Post date:** [January 22, 2019, 1:14am UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649/2 "2019-01-22T01:14:02Z")

</div>

What versions of Elasticsearch and Kibana are you using? It looks like an old Kibana UI to me. 🤔

---

<div class="post-metadata">

**Author:** ![treble.snake](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/treble.snake/32/39818_2.png) [@treble.snake](https://discuss.elastic.co/u/treble.snake)\
**Post date:** [January 22, 2019, 7:39am UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649/3 "2019-01-22T07:39:02Z")

</div>

We have 6.4.0 - think it's the case?

---

<div class="post-metadata">

**Author:** ![treble.snake](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/treble.snake/32/39818_2.png) [@treble.snake](https://discuss.elastic.co/u/treble.snake)\
**Post date:** [January 22, 2019, 11:32am UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649/4 "2019-01-22T11:32:52Z")

</div>

Yeah, updating the Elastic stack did it 🙂  
Thanks for your help!

---

<div class="post-metadata">

**Author:** ![stephenbelanger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenbelanger/32/34880_2.png) [@stephenbelanger](https://discuss.elastic.co/u/stephenbelanger)\
**Post date:** [January 23, 2019, 1:09am UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649/5 "2019-01-23T01:09:55Z")

</div>

I'm glad you got it sorted. It seems to just be a data incompatibility between what apm-server stores and what your previous version of Kibana was expecting.

---

<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:** [February 12, 2019, 9:09pm UTC](https://discuss.elastic.co/t/spans-dont-form-a-waterfall-in-ui-node-js-agent/164649/6 "2019-02-12T21:09:55Z")

</div>

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