# Nodejs missing transaction trace

**URL:** <https://discuss.elastic.co/t/nodejs-missing-transaction-trace/272551>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [May 10, 2021, 8:21am UTC](https://discuss.elastic.co/t/nodejs-missing-transaction-trace/272551 "2021-05-10T08:21:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Lee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max_lee/32/82242_2.png) [@Max\_Lee](https://discuss.elastic.co/u/Max_Lee)\
**Post date:** [May 10, 2021, 8:21am UTC](https://discuss.elastic.co/t/nodejs-missing-transaction-trace/272551/1 "2021-05-10T08:21:50Z")

</div>

**Kibana version** :  
v7.12.1

**Elasticsearch version** :  
v7.12.1

**APM Server version** :  
v7.12.1

**APM Agent language and version** :  
nodejs : 12  
fastify : 2.11.0  
mongoose : 5.11.1  
elastic-apm-node : 3.14.0  
ioredis : 4.14.1

**Browser version** :  
Google Chrome 90.0.4430.85

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:

> **[Get started with Fastify | APM Node.js Agent Reference \[3.x\] | Elastic](https://www.elastic.co/guide/en/apm/agent/nodejs/current/fastify.html#fastify)**

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

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e90e3d5aca62a828ec0f59864a38a97365d0f7f7.png)

**Steps to reproduce** :

1. Launch APM server, elastic search, and Kibana containers
2. Install Node APM in the server
3. Call API using postman
4. Browse the application

**Errors in browser console (if relevant)**:

**Provide logs and/or server output (if relevant)**:

I'm trying to build a APM tool for server monitoring (server performance, transaction tracing... etc). It is easy to build APM tool, but I can't get some transaction detail like distributed span.

[in elastic document](https://www.elastic.co/guide/en/apm/agent/nodejs/current/supported-technologies.html#compatibility-tracing-and-instrumentation), mongoose version used to my project is not supported.

let me know any solution to get transaction tracing.  
thank you.

---

<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:** [May 10, 2021, 7:17pm UTC](https://discuss.elastic.co/t/nodejs-missing-transaction-trace/272551/2 "2021-05-10T19:17:02Z")

</div>

@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):

```js
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** :

 ![Screen Shot 2021-05-10 at 12.13.59 PM](https://us1.discourse-cdn.com/elastic/original/3X/c/0/c03354ce4d2894dd8f25b2172faf6a43f4af7d1f.png)

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

Or are you saying there is a different problem?

> [@Max\_Lee](#):
>
> [in elastic document](https://www.elastic.co/guide/en/apm/agent/nodejs/current/supported-technologies.html#compatibility-tracing-and-instrumentation), mongoose version used to my project is not supported.

That is true. We have an issue ([Extend Mongoose support · Issue #1833 · elastic/apm-agent-nodejs · GitHub](https://github.com/elastic/apm-agent-nodejs/issues/1833)) 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.

---

<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:** [May 31, 2021, 3:17pm UTC](https://discuss.elastic.co/t/nodejs-missing-transaction-trace/272551/3 "2021-05-31T15:17:16Z")

</div>

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