dd-trace-js
dd-trace-js copied to clipboard
Add EventBridge milliseconds
What does this PR do?
Adds a small ms field to EventBridge event trace context that carries the millisecond portion of the time at which the EventBridge event was sent (AWS, for unknown reasons, truncates this). ms will be treated as optional by the event receiver, but will assist in starting the inferred span at the correct time.
Motivation
Plugin Checklist
- [x] Unit tests.
- [ ] TypeScript definitions.
- [ ] TypeScript tests.
- [ ] API documentation.
- [ ] CircleCI jobs/workflows.
- [ ] Plugin is exported.
Additional Notes
thread of execution
I'm sorry for being unclear. I mean the lambda function or whatever is receiving the Event bridge event. Let's plan to chat tomorrow so we're on the same page.
On Thu, Mar 3, 2022, 19:54 Roch Devost @.***> wrote:
@.**** commented on this pull request.
In packages/datadog-plugin-aws-sdk/src/services/eventbridge.js https://github.com/DataDog/dd-trace-js/pull/1873#discussion_r819183598:
const byteSize = Buffer.byteLength(finalData)
if (byteSize >= (1024 * 256)) {log.info('Payload size too large to pass context')return}request.params.Entries[0].Detail = finalData
// eslint-disable-next-line no-consoleconsole.log('AGOCS 1')const currentMilliseconds = new Date().getMilliseconds()request.params.Entries.forEach((entry, index) => {// eslint-disable-next-line no-consoleconsole.log('AGOCS 2')const details = JSON.parse(entry.Detail)details._datadog = {}tracer.inject(span, 'text_map', details._datadog)details._datadog.ms = currentMillisecondsCan you provide more information about how this work? We shouldn't be altering the result on trace injection and there might be a better way to do this. When you say thread of execution, that sounds like it's in the same process?
— Reply to this email directly, view it on GitHub https://github.com/DataDog/dd-trace-js/pull/1873#discussion_r819183598, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIVNKJNE6JYEDTD4ADBJFLU6FNKXANCNFSM5PISE6JQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>