dd-trace-js
dd-trace-js copied to clipboard
Fix aws-sdk distributed tracing when using .promise()
What does this PR do?
When using .promise() there is no callback for dd-trace-js to wrap.
Before this change, that meant we never called tracer.extract on any
incoming requests.
This changes the functionality by creating a "fake" callback for us to wrap and then immediately calling it.
Motivation
We use the sqs-consumer library that uses sqs.receiveMessage({}).promise(). Meaning we currently don't get any distributed traces currently.
Plugin Checklist
- [x] Unit tests.
- [x] TypeScript definitions.
- [ ] TypeScript tests.
- [x] API documentation.
- [x] CircleCI jobs/workflows.
- [x] Plugin is exported.
Additional Notes
Fixes #1680
@rochdev The code here is pretty messy still. More of a POC than anything else ATM. Happy to clean it up / add additional tests still
Is this a feature that you'd still be interested in working on? Looks like there are some conflicts and that Roch had some concerns.
I'll close this PR for now but we can consider reopening it in the future.