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

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.

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

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


input {
    tcp {
        port => "10000"

filter {
    json {
        source => "message"

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


http.host: ""

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

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.


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

Great to hear. Thanks for getting back.

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