Skip to content

fix(trace): classify unsampled X-Ray context as AUTO_REJECT - #876

Closed
joeyzhao2018 wants to merge 1 commit into
mainfrom
joey/xray-auto-reject
Closed

joeyzhao2018 wants to merge 1 commit into
mainfrom
joey/xray-auto-reject

Conversation

@joeyzhao2018

@joeyzhao2018 joeyzhao2018 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Map unsampled X-Ray fallback context (Sampled=0) to numeric AUTO_REJECT (0) instead of USER_REJECT (-1). This classifies the inherited X-Ray decision as an automatic rejection rather than a user-directed drop.

Motivation

The investigation of SVLS-10260 highlighted that X-Ray sampling rejections currently become user-directed Datadog drops. Keep inheriting the rejection when X-Ray merging is enabled, but classify it as automatic. This is not a fix for the trace loss reported there and does not make Datadog resample unsampled X-Ray invocations.

Testing Guidelines

  • Full unit suite: 55 suites, 749 tests, and 3 snapshots passed with dd-trace 6.24.0.
  • Expanded public extraction coverage to check both Sampled=1 -> USER_KEEP and Sampled=0 -> numeric AUTO_REJECT, retaining trace ID, parent ID, and X-Ray source assertions.
  • Lint, repository-wide formatting, and git diff --check passed.
  • GitHub Docker integration matrix: all 10 jobs passed (Node 18, 20, 22, 24, and 26 on arm64 and amd64), running integration_tests_local/run.sh. The duplicate local arm64 sweep passed Node 18 and 20 before being stopped after the full CI matrix passed.
  • GitHub build and unit-test matrices: all five supported Node versions passed.

Additional Notes

Sampled=1 still maps to USER_KEEP. The numeric-priority fix from #850, explicit Datadog-context propagation, and the default DD_MERGE_XRAY_TRACES=false remain unchanged. Unsampled X-Ray metadata subsegments continue to be suppressed. Agent recovery sampling may treat automatic and user-directed rejections differently; deployed AWS behavior has not been tested.

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)

@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 2 Pipeline jobs failed

DataDog/datadog-lambda-js | publish layer sandbox (node20): [us-west-2] — 🔄 Retry may pass, looks flaky

View more details · View in GitLab

DataDog/datadog-lambda-js | publish layer sandbox (node22): [us-west-2]

View more details · View in GitLab

ℹ️ Info

🔁 Datadog re-ran npm-package-test (18.12) after it failed. The re-run passed. View in Datadog

🔁 Datadog re-ran publish layer sandbox (node20): [us-west-2] after it failed. The re-run did not pass. View in Datadog

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: dcc0c48 | Docs | View more details | Give us feedback!

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.

1 participant