# Unable to see full trace in Express Server (missing Mongo Instrumentation?)

**URL:** <https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611>\
**Category:** APM\
**Tags:** docker, nodejs\
**Created:** [February 27, 2023, 3:29pm UTC](https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611 "2023-02-27T15:29:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pocketcolin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pocketcolin/32/117585_2.png) [@pocketcolin](https://discuss.elastic.co/u/pocketcolin)\
**Post date:** [February 27, 2023, 3:29pm UTC](https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611/1 "2023-02-27T15:29:45Z")

</div>

I have a NodeJS stack pushing logs and APM info to Logstash and then to elasticsearch/kibana hosted on Elastic Cloud. For some reason, the APM trace is missing the full trace. At the very least, I'd like to see MongoDB instrumentation (in the below example screenshot, that request is making multiple requests to MongoDB that should be visible). I'll post as much context as I think is relevant, but please let me know if there is any config/setup that would be helpful to see. I have a hunch that the issue is related to using Parse Server which isn't natively supported by Elastic APM but it's just a layer over Express and I've seen other APM (including DataDog and New Relic) instrument the requests in their entirety out of the box.

 ![Screenshot 2023-02-27 at 10.10.46 AM](https://us1.discourse-cdn.com/elastic/original/3X/b/3/b3f72ee0e0bcf189c8927cec22068368138f1319.png)

Web Server: NodeJS 16.14.0  
Web Server Framework: ExpressJS 4.17.1 with Parse Server 5.4.0  
APM Transport tool: elastic-apm-node 3.42.0  
Database: MongoDB 5.0.14

Elasticsearch/Kibana Host: Elastic Cloud  
Elasticsearch version: 8.6.2  
Logstash: Deployed with Docker container (v8.6.2)

APM Initialization

```auto
// Initialize Elastic APM
const environment = 'localhost'
export const apm = elasticApm.start({
    environment,
    logLevel: 'info',
})

```

logstash.conf

```auto
input {
    tcp {
        port => "10000"
    }
}

filter {
    json {
        source => "message"
    }
}

output {
    elasticsearch {
        cloud_id => "${CLOUD_ID}"
        cloud_auth => "${CLOUD_AUTH}"
        data_stream => "true"
    }
    stdout {
        codec => rubydebug
    }
}

```

logstash.yml

```auto
http.host: "0.0.0.0"

```

---

<div class="post-metadata">

**Author:** ![trentm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/trentm/32/77647_2.png) [@trentm](https://discuss.elastic.co/u/trentm)\
**Post date:** [February 27, 2023, 6:38pm UTC](https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611/2 "2023-02-27T18:38:07Z")

</div>

Hi @pocketcolin,  
Thanks for the question/post.

1. What Mongo client driver module are you using? A possible issue is if you are using `mongodb` ([mongodb - npm](https://www.npmjs.com/package/mongodb)) and using version 5.x. _Currently_ the APM agent is being defensive and explicitly _not_ instrumenting version 5.x because we haven't yet validated that our instrumentation works with the new `mongodb` driver version. We plan to add that soon in [mongodb@5 support · Issue #3138 · elastic/apm-agent-nodejs · GitHub](https://github.com/elastic/apm-agent-nodejs/issues/3138). However, not fast enough because there is another user that has submitted a PR to enable it [chore: Do not block instrumentation for mongodb driver v5.x by webcarrot · Pull Request #3168 · elastic/apm-agent-nodejs · GitHub](https://github.com/elastic/apm-agent-nodejs/pull/3168).

If you _are_ using mongodb@5, please let me know. That'll help me prioritize, so I can see about getting a fix out for this this week.

1. If that isn't the issue, then the next step would be to get a full trace-level log: configure the elastic-apm-node agent with `logLevel: 'trace'`), run your app, send us/me the full output to look for issues. A common issue is if `elasticApm.start(...)` is called too late -- after a DB client driver module has already been `require()`d.

---

<div class="post-metadata">

**Author:** ![pocketcolin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pocketcolin/32/117585_2.png) [@pocketcolin](https://discuss.elastic.co/u/pocketcolin)\
**Post date:** [February 27, 2023, 9:59pm UTC](https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611/3 "2023-02-27T21:59:59Z")

</div>

🤦

Welp it was as easy as moving the `apm.start` higher up in the index file. Thanks for the suggestion! Everything is working 💯 now.

---

<div class="post-metadata">

**Author:** ![trentm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/trentm/32/77647_2.png) [@trentm](https://discuss.elastic.co/u/trentm)\
**Post date:** [February 28, 2023, 12:21am UTC](https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611/4 "2023-02-28T00:21:54Z")

</div>

Great to hear. Thanks for getting back.

---

<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 20, 2023, 8:22pm UTC](https://discuss.elastic.co/t/unable-to-see-full-trace-in-express-server-missing-mongo-instrumentation/326611/5 "2023-03-20T20:22:07Z")

</div>

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