Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch instrumentation breaks returned promise #1565

Closed
watson opened this issue Dec 11, 2019 · 0 comments · Fixed by #1566
Closed

Elasticsearch instrumentation breaks returned promise #1565

watson opened this issue Dec 11, 2019 · 0 comments · Fixed by #1566
Labels

Comments

@watson
Copy link
Contributor

watson commented Dec 11, 2019

In the elasticsearch module instrumentation, any request can return a promise, eg:

client.ping().then(() => {
  console.log('ping successful')
})

The returned promise has an extra function not normally on promises: abort(). The abort function is used to abort the request to Elasticsearch. As part of the instrumentation, this agent returns a different promise which doesn't have the expected abort() function. This, in turn, causes errors like elastic/kibana#52617.

@watson watson added the bug label Dec 11, 2019
watson added a commit to watson/apm-agent-nodejs that referenced this issue Dec 11, 2019
vigneshshanmugam pushed a commit to watson/apm-agent-nodejs that referenced this issue Jul 29, 2020
vigneshshanmugam pushed a commit to watson/apm-agent-nodejs that referenced this issue Aug 6, 2020
vigneshshanmugam added a commit that referenced this issue Aug 10, 2020
* fix(elasticsearch): ensure requests can be aborted

Fixes #1565

* chore: add abort as func testt

* fix: capture aborted spans

* chore: end span after calling abort

* chore: obtain descriptors before promise tick

Co-authored-by: vigneshshanmugam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant