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

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

Conversation

duncanista
Copy link
Contributor

@duncanista duncanista commented Feb 7, 2024

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: f05c600#diff-8367049249917f97a7d4b0d7aa3355ac631ce80bd38d35f0f04c9288c603b76a

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)

@duncanista duncanista requested a review from a team as a code owner February 7, 2024 16:39
@codecov-commenter
Copy link

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

❗ 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 ⚠️
Additional details and impacted files
@@           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           

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

Copy link
Contributor

@astuyve astuyve left a comment

Choose a reason for hiding this comment

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

Good use of null coalescence here, 0 || would be falsey and could cause us to keep everything and break sampling (if priority is an int)

@duncanista duncanista merged commit 9c863a3 into main Feb 7, 2024
31 checks passed
@duncanista duncanista deleted the jordan.gonzalez/SVLS-4466/fix-missing-sampling-priority-erroring-on-read branch February 7, 2024 18:01
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.

3 participants