DataDog / datadog-lambda-js

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

[SVLS-4299] Extract trace context from AWSTraceHeader in SQS java upstream case #511

Closed joeyzhao2018 closed 6 months ago

joeyzhao2018 commented 6 months ago

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

Check all that apply

codecov-commenter commented 6 months ago

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).

:exclamation: 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 :warning:
src/trace/xray-service.ts 92.59% 2 Missing :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

astuyve commented 6 months ago

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