Nodejs missing transaction trace

@Max_Lee Hi!

Let me try to make sure I understand what you are saying is the problem. Is the problem that you don't see a span for a query to MongoDB using mongoose? Here is a small example using mongoose@5.11.1 (like you), but using express instead of fastify (in case that matters, but it shouldn't):

var apm = require('elastic-apm-node').start({
  serviceName: 'mongoose-example'
})

const express = require('express')
const mongoose = require('mongoose');

const app = express()
const Cat = mongoose.model('Cat', { name: String });
app.get('/', (req, res) => {
    mongoose.connect('mongodb://localhost/test', {useNewUrlParser: true, useUnifiedTopology: true});
    const kitty = new Cat({ name: 'Zildjian' });
    kitty.save().then(() => {
        res.send('meow')
    });
});

app.listen(3000, function () {
  console.log('listening at http://localhost:3000')
})

When I run that server and make a request via curl -i http://localhost:3000/, I see a trace in Kibana that has a span for the mongo request:

Are you able to post example code showing a small reproducible example?

Or are you saying there is a different problem?

That is true. We have an issue (Extend Mongoose support · Issue #1833 · elastic/apm-agent-nodejs · GitHub) that we need to get to. It may be only that the documentation and the agent's testing needs to be updated that all mongoose@5.x versions work.