-
Notifications
You must be signed in to change notification settings - Fork 227
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
fix: more reliable span.sync determination, drop unused transaction.sync #2326
Conversation
Current `span.sync` is tracked via: - the "before" async hook setting it false on the "active" span, and - Instrumentation#bindFunction's wrapper setting it false, on the fair assumption that all usages of bindFunction are for async callbacks. The former has issues when there are multiple active spans within a single async task -- as is the case with Elasticsearch instrumentation (issue #1996) and the aws-sdk instrumentations (which have manual workarounds). This changes to set sync=false if the executionAsyncId() at end-time is different than at start-time. This works for whatever `asyncHooks` config var value. Fixes: #1996
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
…reliability of transaction.test.js usage of agent._transport (CapturingTransport)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! (and smart!) -- overall I like this change and this seems like a better/more-accurate way of tracking whether a span has cross an asynchronous boundary (I'm increasingly skeptical of how useful this is to track for the general Node.js user -- but that's a separate issue :))
Happy to get on the approval train once the perf. and patch-async questions are worked through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Current
span.sync
is tracked via:fair assumption that all usages of bindFunction are for async
callbacks.
The former has issues when there are multiple active spans within a
single async task -- as is the case with Elasticsearch instrumentation
(issue Async spans are being reported as sync #1996) and the aws-sdk instrumentations (which have manual
workarounds).
This changes to set sync=false if the executionAsyncId() at end-time
is different than at start-time. This works for whatever
asyncHooks
config var value.
One change in behaviour is that the value of span.sync is only
guaranteed to be accurate after span.end() is called. Given that
span.sync isn't a public field, I believe this is fine.
This change also drops the 'transaction.sync' fields. It was never
used by APM server.
Fixes: #1996
Fixes: #2292
Checklist