elastic / elastic/apm-agent-nodejs
`request` method of other library is picked up by `http` instrumentation
- Dominant language
- JavaScript
- Stars
- 594
- Forks
- 244
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 16
Description
During https://github.com/elastic/apm-agent-nodejs/issues/1781 I also stumbled over the following behavior:
When wrapping a function called `request` the `http` instrumentation seems to get triggered:
```js
var originalRequest = prisma.fetcher.request
var newRequest = async function(object) {
var span = apm.startSpan('Query Engine (prisma.fetcher.request)')
var result = await originalRequest.call(this, object)
span.end()
return result
}
prisma.fetcher.request = newRequest
```
leads to this debug output:
```
no active transaction found - cannot build new span
intercepted call to http.request { id: null }
```
and quite some confusion.
The workaround or solution is to configure the instrumentation to ignore `http`: `disableInstrumentations: ['http']` in `apm.start()`.
Contributor guide
Assessment
This issue has not been assessed yet.