elastic / elastic/apm-agent-nodejs

Knex database spans not recorded when using async/await

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

Description

**Describe the bug**
When a define a route wich uses knex to connect do the database, and use async await at the function definition, the apm agent does not send the sql span, not showing the sql info at the request timeline at kibana. The apm agent does not support async/await

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

**Expected behavior**
To show the sql span at the request timeline.

**Environment (please complete the following information)**
- OS: Linux
- Node.js version: v11.10.0
- APM Server version: 6.6.1
- Agent version: 2.5.1

**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**
Add any other context about the problem here.

- Agent config options

Click to expand

```
serviceName: 'service',
```

- `package.json` dependencies:

Click to expand

```
"elastic-apm-node": "^2.5.1",
"express": "^4.16.4",
"knex": "^0.16.3",
"mysql2": "^1.6.5"
```

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.