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-4299] Extract trace context from AWSTraceHeader in SQS java upstream case #511

Merged
merged 12 commits into from
Mar 18, 2024

Conversation

joeyzhao2018
Copy link
Contributor

@joeyzhao2018 joeyzhao2018 commented Mar 14, 2024

What does this PR do?

In the case where
Java lambda ==> SQS ==> NodeJS lambda
the tracecontext is injected into the Records[i].attributes.AWSTraceHeader.
This PR refactors around XRayService and SQSEventTraceExtractor to extract that context out.
Result:
Screenshot 2024-03-14 at 2 27 50 PM

Motivation

Testing Guidelines

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 March 14, 2024 18:27
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 82.05128% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 82.08%. Comparing base (3af0c75) to head (ec245ce).

❗ Current head ec245ce differs from pull request most recent head e9185ec. Consider uploading reports for the commit e9185ec to get more accurate results

Files Patch % Lines
src/trace/context/extractors/sqs.ts 58.33% 3 Missing and 2 partials ⚠️
src/trace/xray-service.ts 92.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #511      +/-   ##
==========================================
- Coverage   82.10%   82.08%   -0.02%     
==========================================
  Files          54       54              
  Lines        2191     2211      +20     
  Branches      511      513       +2     
==========================================
+ Hits         1799     1815      +16     
- Misses        329      332       +3     
- Partials       63       64       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joeyzhao2018 joeyzhao2018 changed the title extrace trace context from AWSTraceHeader in SQS java upstream case Extract trace context from AWSTraceHeader in SQS java upstream case Mar 14, 2024
@astuyve
Copy link
Contributor

astuyve commented Mar 14, 2024

Hmmm, the codecov report seems to highlight some important gaps where we return undefined or null, can we cover those? https://app.codecov.io/gh/DataDog/datadog-lambda-js/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog

src/trace/context/extractors/sqs.ts Outdated Show resolved Hide resolved
src/trace/context/extractors/sqs.ts Outdated Show resolved Hide resolved
src/trace/xray-service.ts Show resolved Hide resolved
src/trace/xray-service.ts Outdated Show resolved Hide resolved
src/trace/xray-service.ts Outdated Show resolved Hide resolved
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 and nits, but overall, looks good! Great work on fixing the code coverage!

src/trace/xray-service.ts Outdated Show resolved Hide resolved
src/trace/xray-service.ts Outdated Show resolved Hide resolved
src/trace/xray-service.ts Outdated Show resolved Hide resolved
src/trace/xray-service.ts Outdated Show resolved Hide resolved
src/trace/context/extractors/sqs.ts Outdated Show resolved Hide resolved
joeyzhao2018 and others added 5 commits March 18, 2024 11:11
Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>
@joeyzhao2018 joeyzhao2018 merged commit 4160e9a into main Mar 18, 2024
25 checks passed
@joeyzhao2018 joeyzhao2018 deleted the joey/sqs-java branch March 18, 2024 16:00
@joeyzhao2018 joeyzhao2018 changed the title Extract trace context from AWSTraceHeader in SQS java upstream case [SVLS-4299] Extract trace context from AWSTraceHeader in SQS java upstream case Mar 22, 2024
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.

None yet

4 participants