Skip to content
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

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

Merged
merged 5 commits into from
May 10, 2024
Merged

Conversation

joeyzhao2018
Copy link
Contributor

@joeyzhao2018 joeyzhao2018 commented May 6, 2024

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

Screenshot 2024-05-09 at 1 24 45 PM

Batch Publish
Screenshot 2024-05-09 at 10 19 40 AM

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@joeyzhao2018 joeyzhao2018 requested a review from a team as a code owner May 6, 2024 21:00
Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments.

src/trace/context/extractors/sns-sqs.ts Outdated Show resolved Hide resolved
src/trace/context/extractors/sns.ts Outdated Show resolved Hide resolved
src/trace/context/extractors/sqs.ts Outdated Show resolved Hide resolved
src/trace/context/extractors/sqs.ts Outdated Show resolved Hide resolved
@joeyzhao2018
Copy link
Contributor Author

joeyzhao2018 commented May 9, 2024

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.

@joeyzhao2018 joeyzhao2018 merged commit 9933ae9 into main May 10, 2024
25 checks passed
@joeyzhao2018 joeyzhao2018 deleted the joey/java-sns branch May 10, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants