Skip to content

fix(sampling): isolate manual sampling test trace contexts - #7698

Open
bm1549 wants to merge 2 commits into
mainfrom
brian.marks/fix-manual-sampling-shared-trace-id
Open

fix(sampling): isolate manual sampling test trace contexts#7698
bm1549 wants to merge 2 commits into
mainfrom
brian.marks/fix-manual-sampling-shared-trace-id

Conversation

@bm1549

@bm1549 bm1549 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Motivation

Trace ID overlap report (AppGate required)

The manual-sampling tests used the same upstream trace and parent IDs for the keep and drop cases. When uWSGI handled the two requests at once, dd-trace-py correctly grouped their spans into one trace, and the drop request had no serialized sampling priority.

Changes

The upstream-context helper now offsets its fixed IDs by the upstream sampling priority. Each case stays stable for lineage assertions, while keep and drop use separate trace and parent IDs.

Tests

  • Temporary event/barrier reproduction against Python 4.14.0, uwsgi-poc, and Agent 7.83.1: 5/5 expected failures with shared IDs; 5/5 passes with isolated IDs
  • Explicit mutation check with the same reproduction: failed after removing the ID offset, then passed after restoring it
  • TEST_LIBRARY=python ./run.sh SAMPLING tests/test_sampling_manual.py::Test_Manual_Sampling: 2 passed
  • ./run.sh TEST_THE_TEST tests/test_the_test/test_sampling_manual.py: 1 passed
  • ./format.sh --check: passed

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@bm1549 bm1549 added the ai-generated The pull request includes a significant amount of AI-generated code label Sep 11, 2026
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/test_sampling_manual.py                                           @DataDog/system-tests-core

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 11, 2026

Copy link
Copy Markdown

Tests

All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@bm1549
bm1549 marked this pull request as ready for review September 11, 2026 01:57
@bm1549
bm1549 requested a review from a team as a code owner September 11, 2026 01:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-11T01:59:06.023987Z 1579c77 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated The pull request includes a significant amount of AI-generated code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant