Skip to content

test(otel): port otel tracestate sampling tests to parametric - #7518

Open
MilanGarnier wants to merge 10 commits into
mainfrom
milan.garnier/otel-tracestate-ot-th
Open

test(otel): port otel tracestate sampling tests to parametric#7518
MilanGarnier wants to merge 10 commits into
mainfrom
milan.garnier/otel-tracestate-ot-th

Conversation

@MilanGarnier

@MilanGarnier MilanGarnier commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Ports the OpenTelemetry ot.th/ot.rv sampling coverage from #7372 to parametric tests.
Reason : We want to have a single source of truth for all tracers and dd-trace-cpp does not have a weblog.

Test correspondence

Several end-to-end tests are consolidated into parameterized parametric tests.

New parametric test function Removed e2e test function(s) Covers
test_emits_probability_sampling_vectors test_emit_ot_on_probability_decision The five old rate classes are now five rate parameters; each retains its full trace-ID vector.
test_forwards_and_sanitizes_inbound_ot test_forward_inbound_ot_unchanged
test_th_only_does_not_fabricate_rv
test_preserve_dd_and_other_vendors
test_malformed_rv_and_th_treated_as_absent
Separate inherited-decision, th-only, and malformed-ot inputs; the inherited case also preserves dd and congo.
test_forwards_unknown_inbound_ot_subkeys test_forward_inbound_ot_unknown_subkey Preserves both inherited and unknown-only ot subkey cases.
test_forwards_dropped_inbound_ot test_forward_inbound_ot_unchanged_when_dropped Dropped inherited rv/th decision.
test_dropped_th_only_does_not_fabricate_rv test_th_only_does_not_fabricate_rv_when_dropped Dropped inherited th-only decision.
test_force_keep_clears_th test_force_keep_with_no_inbound_ot
test_force_keep_forwards_inherited_rv
test_force_keep_overrides_inherited_drop_decision
Separate no-inbound-ot, inherited-rv, and inherited-drop inputs; every resulting span asserts USER_KEEP.
test_sampled_without_ot_does_not_fabricate_it test_sampled_without_ot_not_fabricated Sampled inbound trace with no ot member.
test_malformed_th_preserves_rv test_malformed_th_only_treated_as_absent Well-formed rv is retained while malformed th is removed.
test_precision_boundary_decisions test_precision_boundary_decision The two old rate classes are parameterized as keep and drop precision-boundary cases.
test_otlp_carries_probability_sampling_ot test_otlp_carries_ot OTLP export of generated probability-sampling ot fields.

What's being tested

  • dd-trace-go and dd-trace-rb already ship this should have the same coverage

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/parametric/test_otel_tracestate_sampling.py                       @DataDog/system-tests-core @DataDog/apm-sdk-capabilities
manifests/c.yml                                                         @DataDog/system-tests-core
manifests/cpp.yml                                                       @DataDog/dd-trace-cpp
manifests/cpp_httpd.yml                                                 @DataDog/dd-trace-cpp
manifests/cpp_kong.yml                                                  @DataDog/system-tests-core
manifests/cpp_nginx.yml                                                 @DataDog/dd-trace-cpp
manifests/dotnet.yml                                                    @DataDog/apm-dotnet @DataDog/asm-dotnet
manifests/golang.yml                                                    @DataDog/dd-trace-go-guild
manifests/java.yml                                                      @DataDog/asm-java @DataDog/apm-java
manifests/nodejs.yml                                                    @DataDog/dd-trace-js
manifests/php.yml                                                       @DataDog/apm-php @DataDog/asm-php
manifests/python.yml                                                    @DataDog/apm-python @DataDog/asm-python
manifests/ruby.yml                                                      @DataDog/ruby-guild @DataDog/asm-ruby
manifests/rust.yml                                                      @DataDog/apm-rust
tests/otel/test_tracing_otlp.py                                         @DataDog/system-tests-core
utils/_context/_scenarios/__init__.py                                   @DataDog/system-tests-core
tests/test_otel_tracestate_sampling.py                                  @DataDog/system-tests-core

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 14, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

🚦 4 Pipeline jobs failed

Testing the test | System Tests (cpp, prod) / parametric / parametric (1)   View in Datadog   GitHub Actions

🔧 Fix in code. This looks caused by changes in this PR. 12 failed tests due to multiple assertion errors in test_otel_tracestate_sampling.py, indicating expected output did not match actual.

🧪 12 Tests failed · 🎯 related to the job error above

🎯 tests.parametric.test_otel_tracestate_sampling.Test_OtelTracestateSampling.test_emits_probability_sampling_vectors[rate-0.01, parametric-cpp] from system_tests_suite   View in Datadog
AssertionError: assert {} == {'rv': 'f0948...d70a3d70a3d7'}
  Right contains 2 more items:
  {'rv': 'f0948a54d43b8e', 'th': 'fd70a3d70a3d7'}
  Full diff:
  - {'rv': 'f0948a54d43b8e', 'th': 'fd70a3d70a3d7'}
  + {}

self = <tests.parametric.test_otel_tracestate_sampling.Test_OtelTracestateSampling object at 0x7f79f08ddd00>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f79bdc15df0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f79bdfd2510>
...
🎯 tests.parametric.test_otel_tracestate_sampling.Test_OtelTracestateSampling.test_emits_probability_sampling_vectors[rate-0.1, parametric-cpp] from system_tests_suite   View in Datadog
AssertionError: assert {} == {'rv': 'f0948...666666666668'}
  Right contains 2 more items:
  {'rv': 'f0948a54d43b8e', 'th': 'e6666666666668'}
  Full diff:
  - {'rv': 'f0948a54d43b8e', 'th': 'e6666666666668'}
  + {}

self = <tests.parametric.test_otel_tracestate_sampling.Test_OtelTracestateSampling object at 0x7f79f08de060>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f79bdc15df0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f79bdc431d0>
...
🎯 tests.parametric.test_otel_tracestate_sampling.Test_OtelTracestateSampling.test_emits_probability_sampling_vectors[rate-0.2, parametric-cpp] from system_tests_suite   View in Datadog
AssertionError: assert {} == {'rv': 'f0948...cccccccccccd'}
  Right contains 2 more items:
  {'rv': 'f0948a54d43b8e', 'th': 'ccccccccccccd'}
  Full diff:
  - {'rv': 'f0948a54d43b8e', 'th': 'ccccccccccccd'}
  + {}

self = <tests.parametric.test_otel_tracestate_sampling.Test_OtelTracestateSampling object at 0x7f79f08dd730>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f79bdc15df0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f79be157830>
...
View all failed tests

Testing the test | System Tests (ruby, dev) / parametric / parametric (2)   View in Datadog   GitHub Actions

See error No OTLP trace export request received due to connection reset errors while checking if the test agent is alive.

🧪 2 Tests failed

tests.parametric.test_otel_tracestate_sampling.Test_OtlpTracestateSampling.test_otlp_carries_probability_sampling_ot[library_env0, parametric-ruby] from system_tests_suite   View in Datadog
AssertionError: No OTLP trace export request received

self = <tests.parametric.test_otel_tracestate_sampling.Test_OtlpTracestateSampling object at 0x7f0ad3b0bc50>
otlp_library_env = {'DD_TRACE_RATE_LIMIT': '10000000', 'DD_TRACE_SAMPLE_RATE': '0.1', 'DD_TRACE_STATS_COMPUTATION_ENABLED': 'false', 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT': 'http://ddapm-test-agent-worker-gw3-5740354900026072187:4318/v1/traces', ...}
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f0aa387a4b0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f0ad79e4320>

    @pytest.mark.parametrize("library_env", [_otlp_library_env()])
    def test_otlp_carries_probability_sampling_ot(
        self,
...
tests.parametric.test_otel_tracestate_sampling.Test_OtlpTracestateSampling.test_otlp_forwards_inherited_ot[library_env0, parametric-ruby] from system_tests_suite   View in Datadog
AssertionError: No OTLP trace export request received

self = <tests.parametric.test_otel_tracestate_sampling.Test_OtlpTracestateSampling object at 0x7f0ad3b0baa0>
otlp_library_env = {'DD_TRACE_RATE_LIMIT': '10000000', 'DD_TRACE_SAMPLE_RATE': '0.1', 'DD_TRACE_STATS_COMPUTATION_ENABLED': 'false', 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT': 'http://ddapm-test-agent-worker-gw3-5740354900026072187:4318/v1/traces', ...}
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f0aa387a4b0>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f0aa3aa2450>

    @pytest.mark.parametrize("library_env", [_otlp_library_env()])
    def test_otlp_forwards_inherited_ot(
        self,
...

Testing the test | System Tests (cpp, dev) / parametric / parametric (2)   View in Datadog   GitHub Actions

🔧 Fix in code. This looks caused by changes in this PR. 12 failed tests due to assertion errors comparing expected return values with obtained output in test_oel_tracestate_sampling.py.

View all 4 failed jobs.

📋 Copy prompt for your agent
CI on my pull request is failing. Help me find and fix the root cause of each failing job below — they were flagged as caused by changes in this PR, so focus on the diff. For each job, explain the failure and propose a fix.

Branch: milan.garnier/otel-tracestate-ot-th

Testing the test | System Tests (cpp, prod) / parametric / parametric (1)
Commit: b9e723e2ca8647a4a8b74b4103afe51cd8fd44d7
Error (code / test):
12 failed tests due to multiple assertion errors in test_otel_tracestate_sampling.py, indicating expected output did not match actual.
CI job: https://github.com/DataDog/system-tests/actions/runs/31813242649/job/94831647349

Testing the test | System Tests (cpp, dev) / parametric / parametric (2)
Commit: b9e723e2ca8647a4a8b74b4103afe51cd8fd44d7
Error (code / test):
12 failed tests due to assertion errors comparing expected return values with obtained output in test_oel_tracestate_sampling.py.
CI job: https://github.com/DataDog/system-tests/actions/runs/31813242649/job/94831648097

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🔄 Datadog auto-retried 5 jobs - 1 passed on retry View in Datadog

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a12642e | Docs | Datadog PR Page | Give us feedback!

@MilanGarnier

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 3aa2ecb08c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@MilanGarnier MilanGarnier changed the title test(otel): port tracestate sampling to parametric test(otel): port tracestate sampling to parametric [cpp@milan.garnier/otel-tracestate-ot-th] Aug 14, 2026
@MilanGarnier MilanGarnier changed the title test(otel): port tracestate sampling to parametric [cpp@milan.garnier/otel-tracestate-ot-th] test(otel): port otel tracestate sampling tests to parametric [cpp@milan.garnier/otel-tracestate-ot-th] Aug 14, 2026
@MilanGarnier MilanGarnier changed the title test(otel): port otel tracestate sampling tests to parametric [cpp@milan.garnier/otel-tracestate-ot-th] test(otel): port otel tracestate sampling tests to parametric Aug 14, 2026
@MilanGarnier
MilanGarnier marked this pull request as ready for review August 14, 2026 15:04
@MilanGarnier
MilanGarnier requested review from a team as code owners August 14, 2026 15:04
@MilanGarnier
MilanGarnier requested review from a team as code owners August 14, 2026 15:04
@MilanGarnier
MilanGarnier requested review from PerfectSlayer, ZStriker19, cataphract, christophe-papazian, claponcet, dromanol and link04 and removed request for a team August 14, 2026 15:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d74e159d04

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


@features.w3c_headers_injection_and_extraction
@scenarios.parametric
class Test_OtelTracestateSampling:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the C++ skips for ported tracestate tests

For C++ PARAMETRIC runs, this new test file is enabled by default: I checked manifests/cpp.yml and there is no entry for tests/parametric/test_otel_tracestate_sampling.py, while this commit removes the previous C++ missing_feature entries for the old APMAPI-2171/APMAPI-2172 classes and the same manifest still disables neighboring OTel parametric tests because C++ does not implement OpenTelemetry. Please add the corresponding C++ manifest entries so the port does not start failing unsupported C++ jobs. .cursor/rules/pr-review.mdcL49-L52

Useful? React with 👍 / 👎.

Comment thread manifests/nodejs.yml
tests/parametric/test_otel_span_methods.py::Test_Otel_Span_Methods::test_otel_start_span: missing_feature (New operation name mapping not yet implemented)
tests/parametric/test_otel_span_with_baggage.py::Test_Otel_Span_With_Baggage: *ref_5_32_0
tests/parametric/test_otel_tracer.py::Test_Otel_Tracer::test_otel_force_flush: missing_feature (Not implemented)
tests/parametric/test_otel_tracestate_sampling.py::Test_OtelTracestateSampling: missing_feature (APMAPI-2171)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep nodejs activation granular for ported cases

For nodejs this class-level missing_feature now skips every ported APMAPI-2171 parametric case, but the deleted nodejs manifest entries only skipped some old classes unconditionally; forwarding/no-fabrication cases such as Test_ForwardInboundOtUnchanged, Test_PreserveDdAndOtherVendors, and Test_ThOnlyDoesNotFabricateRv were enabled for supported nodejs weblogs at >=6.8.0. Collapsing them into a single class skip loses existing coverage for current nodejs versions, so please carry over the old per-test activation rather than disabling the whole class.

Useful? React with 👍 / 👎.

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