DataDog / datadog-lambda-js

The Datadog AWS Lambda Library for Node
Apache License 2.0
110 stars 35 forks source link

[SVLS-4780] upstream Java sns and sqs refactor #538

Closed joeyzhao2018 closed 4 months ago

joeyzhao2018 commented 5 months ago

What does this PR do?

Extract trace context in SNS and SQS cases where the upstream service is instrumented by dd-trace-java In short,

  1. For Java => SNS => Lambda, the env: _X_AMZN_TRACE_ID has the dd trace id but not the correct parent id. We will still use it here.
  2. For Java => SQS => Lambda or Java => SNS => SQS => Lambda case, AWS propagate the trace context in the json payload attributes.

Longer version:

javasnssqs drawio

Testing Guidelines

Batch Publish

Screenshot 2024-05-09 at 10 19 40 AM

Additional Notes

Types of Changes

Check all that apply

joeyzhao2018 commented 4 months ago

Left some comments.

@duncanista 's comments made me take a closer look at the way i added debug logs. And after some thoughts I think it's best to use just one static string as the parameter and removed extra logging of the event payload or tracecontext. This is to avoid any extra memory allocation and keep the code cleaner. Based on my on-call experience, we usually get the event payload from other logs.