elastic / elastic/apm-agent-nodejs

Custom Transactions not instrumenting mongoDB calls

Open
#1,690 3 comments 0 reactions 0 assignees View on GitHub
agent-nodejs
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

**Describe the bug**
I am using the custom transaction api to start a transaction when a 'request' comes in on socket.io. I am able to see the transaction in the dashboard, but the calls to mongodb are not instrumented properly. When calling the same code path with a REST request, things seem to work find.

**To Reproduce**

Steps to reproduce the behavior:
1. Use this config '...'
2. Then call '....'
3. Then do '....'
4. See error

**Expected behavior**
The request timeline should show spans of MongoDB calls

**Environment (please complete the following information)**

- OS: Mac OS X
- Node.js version: v10.16.3
- APM Server version: 7.6.1
- Agent version: 3.5.0

**How are you starting the agent? (please tick one of the boxes)**

- [x] Calling `agent.start()` directly (e.g. `require('elastic-apm-node').start(...)`)
- [ ] Requiring `elastic-apm-node/start` from within the source code
- [ ] Starting node with `-r elastic-apm-node/start`

**Additional context**

Code Sample
```
const trans = apm.startTransaction(name, 'socket');
// Do some stuff that calls mongodb
trans.end()
```

Socket Request:
Screen Shot 2020-03-25 at 2 52 26 PM

vs. REST Request:
Screen Shot 2020-03-25 at 2 53 50 PM

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.