dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

Add EventBridge milliseconds

Open agocs opened this issue 3 years ago • 1 comments

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

Additional Notes

agocs avatar Feb 24 '22 21:02 agocs

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-console
    
  •    console.log('AGOCS 1')
    
  •    const currentMilliseconds = new Date().getMilliseconds()
    
  •    request.params.Entries.forEach((entry, index) => {
    
  •      // eslint-disable-next-line no-console
    
  •      console.log('AGOCS 2')
    
  •      const details = JSON.parse(entry.Detail)
    
  •      details._datadog = {}
    
  •      tracer.inject(span, 'text_map', details._datadog)
    
  •      details._datadog.ms = currentMilliseconds
    

Can 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: @.***>

agocs avatar Mar 04 '22 00:03 agocs