DataDog / datadog-lambda-js

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

fix: reading sampling priority will error when not available #483

Closed duncanista closed 6 months ago

duncanista commented 6 months ago

What does this PR do?

Fixes a bug in which reading sampling priority will cause an error, because it was undefined. Previously, before adding W3C, we'd just set always AUTO_KEEP, but now we decided on getting whatever the trace context had.

Now, if not available, we'll go back to using AUTO_KEEP, while respecting whichever was there before if set.

Motivation

482

Testing Guidelines

Added unit tests.

Additional Notes

Introduced in: https://github.com/DataDog/datadog-lambda-js/commit/f05c6003a4f7bab82e46e741ac8d0c98d89efe5b#diff-8367049249917f97a7d4b0d7aa3355ac631ce80bd38d35f0f04c9288c603b76a

Types of Changes

Check all that apply

codecov-commenter commented 6 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a481762) 82.12% compared to head (226cee8) 82.13%.

:exclamation: Current head 226cee8 differs from pull request most recent head bf0b1ae. Consider uploading reports for the commit bf0b1ae to get more accurate results

Files Patch % Lines
src/trace/span-context-wrapper.ts 50.00% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #483 +/- ## ======================================= Coverage 82.12% 82.13% ======================================= Files 54 54 Lines 2188 2189 +1 Branches 510 510 ======================================= + Hits 1797 1798 +1 Misses 329 329 Partials 62 62 ```

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