# Missing mongo spans with redis session

**URL:** <https://discuss.elastic.co/t/missing-mongo-spans-with-redis-session/244134>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [August 7, 2020, 8:15am UTC](https://discuss.elastic.co/t/missing-mongo-spans-with-redis-session/244134 "2020-08-07T08:15:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashrafuzzaman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashrafuzzaman/32/71128_2.png) [@ashrafuzzaman](https://discuss.elastic.co/u/ashrafuzzaman)\
**Post date:** [August 7, 2020, 8:15am UTC](https://discuss.elastic.co/t/missing-mongo-spans-with-redis-session/244134/1 "2020-08-07T08:15:56Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

TIP 1: select at least one tag that further categorizes your topic. For example `server` for APM Server related questions, `java` for questions regarding the Elastic APM Java agent, or `ui` for questions about the APM App within Kibana.

TIP 2: Check out the [troubleshooting guide](https://www.elastic.co/guide/en/apm/get-started/current/troubleshooting.html) first. Not only will it help you to resolve common problems faster but it also explains in more detail which information we need before we can properly help you.

**Kibana version** :  
7.4.0  
**Elasticsearch version** :  
7.4.0  
**APM Server version** :  
7.4.0  
**APM Agent language and version** :  
elastic-apm-node: 3.6.1  
**Browser version** :  
Google Chrome  
Version 83.0.4103.116 (Official Build) (64-bit)  
**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
Installed elastic-apm-node via npm  
**Fresh install or upgraded from other version?**  
Fresh install  
**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.  
I have replicated the issue in an opensource project

> **[ashrafuzzaman/apm-redis-session-test](https://github.com/ashrafuzzaman/apm-redis-session-test)**
>
> Contribute to ashrafuzzaman/apm-redis-session-test development by creating an account on GitHub.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
Configured node APM with,

```auto
    require('elastic-apm-node').start({
      serviceName: 'redis-test',
      asyncHooks: true,
      serverUrl: 'http://localhost:8200',
      logLevel: 'trace'
    });

```

Mongo or any span is not registered using express-session and Redis. Please check the [repository](https://github.com/ashrafuzzaman/apm-redis-session-test) for a sample case.

**Steps to reproduce** :

1. Please check the [repository](https://github.com/ashrafuzzaman/apm-redis-session-test)

**Errors in browser console (if relevant)**:  
Error in the terminal is provided

**Provide logs and/or server output (if relevant)**:  
Using redis as session store getting the following log,

```auto
    intercepted request event call to http.Server.prototype.emit for /api/v3/tasks/5f2a94627dd119014c4921a4
    start trace {
      trans: 'a7d4249c7913ffc5',
      parent: undefined,
      trace: 'c0e4442225ecf3e267e2f0b157a85dee',
      name: 'unnamed',
      type: null,
      subtype: null,
      action: null
    }
    no active transaction found - cannot build new span
    setting transaction result {
      trans: 'a7d4249c7913ffc5',
      parent: undefined,
      trace: 'c0e4442225ecf3e267e2f0b157a85dee',
      result: 'HTTP 3xx'
    }
    setting default transaction name: GET /api/v3/tasks/:id {
      trans: 'a7d4249c7913ffc5',
      parent: undefined,
      trace: 'c0e4442225ecf3e267e2f0b157a85dee'
    }
    sending transaction {
      trans: 'a7d4249c7913ffc5',
      trace: 'c0e4442225ecf3e267e2f0b157a85dee'
    }
    ended transaction {
      trans: 'a7d4249c7913ffc5',
      parent: undefined,
      trace: 'c0e4442225ecf3e267e2f0b157a85dee',
      type: 'request',
      result: 'HTTP 3xx',
      name: 'GET /api/v3/tasks/:id'
    }
    transaction already ended - cannot build new span {
      trans: 'a7d4249c7913ffc5',
      parent: undefined,
      trace: 'c0e4442225ecf3e267e2f0b157a85dee'
    }
    intercepted call to http.request { id: null }
    no active transaction found - cannot build new span

```

But without the session store,

```auto
    intercepted request event call to http.Server.prototype.emit for /api/v3/tasks/5f2a94627dd119014c4921a4
    start trace {
      trans: '76cda12f88e7c16e',
      parent: undefined,
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      name: 'unnamed',
      type: null,
      subtype: null,
      action: null
    }
    start span {
      span: '6fd395dea28ff2e1',
      parent: '76cda12f88e7c16e',
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      name: 'marketing_platform.tasks.find',
      type: 'db',
      subtype: 'mongodb',
      action: 'query'
    }
    recovering from wrong currentTransaction {
      wrong: undefined,
      correct: '76cda12f88e7c16e',
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9'
    }
    ended span {
      span: '6fd395dea28ff2e1',
      parent: '76cda12f88e7c16e',
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      name: 'marketing_platform.tasks.find',
      type: 'db',
      subtype: 'mongodb',
      action: 'query'
    }
    encoding span {
      span: '6fd395dea28ff2e1',
      parent: '76cda12f88e7c16e',
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      name: 'marketing_platform.tasks.find',
      type: 'db'
    }
    setting transaction result {
      trans: '76cda12f88e7c16e',
      parent: undefined,
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      result: 'HTTP 3xx'
    }
    setting default transaction name: GET /api/v3/tasks/:id {
      trans: '76cda12f88e7c16e',
      parent: undefined,
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9'
    }
    sending transaction {
      trans: '76cda12f88e7c16e',
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9'
    }
    ended transaction {
      trans: '76cda12f88e7c16e',
      parent: undefined,
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      type: 'request',
      result: 'HTTP 3xx',
      name: 'GET /api/v3/tasks/:id'
    }
    sending span {
      span: '6fd395dea28ff2e1',
      parent: '76cda12f88e7c16e',
      trace: 'e0ca1f13d851ed6310f2c92d56da00b9',
      name: 'marketing_platform.tasks.find',
      type: 'db'
    }

```

---

<div class="post-metadata">

**Author:** ![ashrafuzzaman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashrafuzzaman/32/71128_2.png) [@ashrafuzzaman](https://discuss.elastic.co/u/ashrafuzzaman)\
**Post date:** [August 9, 2020, 5:22am UTC](https://discuss.elastic.co/t/missing-mongo-spans-with-redis-session/244134/2 "2020-08-09T05:22:40Z")

</div>

I later found that elastic APM node only supports Redis 2.0.0. I was using Redis client 3.X. This is really frustrating that APM don't support the latest version of Redis and creates issue if the latest version is being used.

---

<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:** [August 10, 2020, 7:05am UTC](https://discuss.elastic.co/t/missing-mongo-spans-with-redis-session/244134/3 "2020-08-10T07:05:43Z")

</div>

Thanks for reporting and creating an [issue](https://github.com/elastic/apm-agent-nodejs/issues/1806) for this!

---

<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:** [August 31, 2020, 3:05am UTC](https://discuss.elastic.co/t/missing-mongo-spans-with-redis-session/244134/4 "2020-08-31T03:05:48Z")

</div>

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