Missing mongo spans with redis session

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 :slight_smile:

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 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

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

    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 for a sample case.

Steps to reproduce:

  1. Please check the repository

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,

    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,

    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'
    }

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.

Thanks for reporting and creating an issue for this!

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