Skip to content

test(parametric): enable Python FFE span-enrichment suite#7149

Draft
leoromanovsky wants to merge 1 commit into
mainfrom
leo.romanovsky/ffe-enrichment-enable-python
Draft

test(parametric): enable Python FFE span-enrichment suite#7149
leoromanovsky wants to merge 1 commit into
mainfrom
leo.romanovsky/ffe-enrichment-enable-python

Conversation

@leoromanovsky

Copy link
Copy Markdown
Contributor

Motivation

The FFE APM feature-flag span-enrichment feature (frozen against dd-trace-js#8343)
is being fanned out to the remaining Datadog server SDKs. The Python tracer
(dd-trace-py) now implements it (gated behind
DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED), attaching
ffe_flags_enc, ffe_subjects_enc, and ffe_runtime_defaults to the root APM span.

This PR enables the existing, frozen parametric enrichment suite
(tests/parametric/test_ffe/test_span_enrichment.py) to actually run and assert for
Python, so the contract is enforced in CI rather than skipped via missing_feature.

Changes

  • utils/build/docker/python/parametric/apm_test_client/server.py -- the
    /ffe/evaluate handler now honors the optional span_id field sent by the test
    client (_test_client_parametric.py). It looks up the caller-supplied root span in
    the existing spans registry and re-activates it via
    ddtrace.tracer.context_provider.activate(...) around the OpenFeature evaluation,
    so the ffe_* tags land on the test's intended root span. An unknown / missing /
    unparsable id simply skips activation and never throws. This reuses the same
    context-activation primitive that /trace/span/start's start_span(activate=True)
    relies on; the base /ffe/start + /ffe/evaluate handlers already exist on main.

  • manifests/python.yml -- removed the six class-level missing_feature entries for
    test_span_enrichment.py so those classes inherit the file-level >=4.9.0 gate and
    must pass. The validated artifact reports version 4.12.0rc1, which satisfies the gate.
    No change to the frozen test file, encoding, or limits.

Decisions

  • Scope kept minimal and language-scoped. Only the Python parametric server handler
    and the Python manifest are touched. The shared HTTP test-client (ffe_start /
    ffe_evaluate with span_id) already exists on main and needed no change. No
    _test_agent.py change is required -- the enrichment tests only use
    set_remote_config / wait_for_rc_apply_state / wait_for_num_traces.
  • Gate via inheritance, not a pinned version. Removing the per-class
    missing_feature lets the classes inherit the existing >=4.9.0 file gate rather than
    introducing a new hard-coded version, keeping the manifest forward-compatible.
  • Frozen contract untouched. tests/parametric/test_ffe/test_span_enrichment.py and
    the codec/limits are unchanged; product behavior lives in dd-trace-py
    (DataDog/dd-trace-py#18640).

Local validation

Built a cp311 wheel from dd-trace-py branch leo.romanovsky/ffe-apm-span-enrichment
(ddtrace-4.12.0rc1-cp311-cp311-linux_aarch64.whl), placed it in binaries/, and ran
the suite on this PR branch:

TEST_LIBRARY=python ./run.sh PARAMETRIC -k span_enrichment

Result -- all 8 enrichment classes, 18/18 tests passed, 0 skipped:

Scenario: PARAMETRIC
Library: python@4.12.0-rc1
============================= test session starts ==============================
....................                                                     [100%]
============================= 18 passed in 58.68s ==============================

Classes exercised (all passing): Test_Span_Enrichment_Serial_IDs,
Test_Span_Enrichment_Child_Span_Propagation, Test_Span_Enrichment_Max_Serial_IDs,
Test_Span_Enrichment_Default_Fallback, Test_Span_Enrichment_Max_Subjects,
Test_Span_Enrichment_Max_Experiments_Per_Subject, Test_Span_Enrichment_Subjects,
Test_Span_Enrichment_Delta_Varint.

Honor span_id in the Python parametric /ffe/evaluate handler so ffe_* tags
land on the test's root span, and flip the six class-level missing_feature
entries in manifests/python.yml so the frozen test_span_enrichment.py classes
run and assert for Python (>=4.9.0; validated against ddtrace 4.12.0rc1).

Validated locally: TEST_LIBRARY=python ./run.sh PARAMETRIC -k span_enrichment
-> 18 passed (8 enrichment classes), 0 skipped.
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

manifests/python.yml                                                    @DataDog/apm-python @DataDog/asm-python
utils/build/docker/python/parametric/apm_test_client/server.py          @DataDog/apm-python @DataDog/asm-python @DataDog/system-tests-core

@datadog-official

datadog-official Bot commented Jun 16, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

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

🧪 10 Tests failed

tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Child_Span_Propagation.test_child_span_flag_evaluation_propagates_to_root[library_env0, parametric-python] from system_tests_suite   View in Datadog
AssertionError: ffe_flags_enc not found in root span meta: ['_dd.p.tid', '_dd.svc_src', 'runtime-id', '_dd.p.dm', '_dd.tags.process', 'language', '_dd.base_service']
assert 'ffe_flags_enc' in {'_dd.base_service': '', '_dd.p.dm': '-0', '_dd.p.tid': '6a31d4c600000000', '_dd.svc_src': 'm', ...}

self = <tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Child_Span_Propagation object at 0x7f22816d63c0>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f224c4b0e90>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f224c723560>

    @parametrize("library_env", [{**DEFAULT_ENVVARS}])
    def test_child_span_flag_evaluation_propagates_to_root(
        self, test_agent: TestAgentAPI, test_library: APMLibrary
...
tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Default_Fallback.test_ffe_runtime_defaults_value_truncated_at_64_chars[library_env0, parametric-python] from system_tests_suite   View in Datadog
AssertionError: ffe_runtime_defaults not found in span meta: ['_dd.p.tid', '_dd.tags.process', 'language', '_dd.base_service', '_dd.svc_src', 'runtime-id', '_dd.p.dm']
assert 'ffe_runtime_defaults' in {'_dd.base_service': '', '_dd.p.dm': '-0', '_dd.p.tid': '6a31d4cc00000000', '_dd.svc_src': 'm', ...}

self = <tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Default_Fallback object at 0x7f85e1b56030>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f85af67ce30>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f85af9b2ea0>

    @parametrize("library_env", [{**DEFAULT_ENVVARS}])
    def test_ffe_runtime_defaults_value_truncated_at_64_chars(
        self, test_agent: TestAgentAPI, test_library: APMLibrary
...
View all 10 test failures

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

🧪 10 Tests failed

tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Child_Span_Propagation.test_child_span_flag_evaluation_propagates_to_root[library_env0, parametric-python] from system_tests_suite   View in Datadog
AssertionError: ffe_flags_enc not found in root span meta: ['_dd.p.tid', 'language', '_dd.svc_src', '_dd.base_service', '_dd.p.dm', 'runtime-id', '_dd.tags.process']
assert 'ffe_flags_enc' in {'_dd.base_service': '', '_dd.p.dm': '-0', '_dd.p.tid': '6a31d59a00000000', '_dd.svc_src': 'm', ...}

self = <tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Child_Span_Propagation object at 0x7f900b2769f0>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f8fd6064c50>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f8fd5cee090>

    @parametrize("library_env", [{**DEFAULT_ENVVARS}])
    def test_child_span_flag_evaluation_propagates_to_root(
        self, test_agent: TestAgentAPI, test_library: APMLibrary
...
tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Default_Fallback.test_ffe_runtime_defaults_value_truncated_at_64_chars[library_env0, parametric-python] from system_tests_suite   View in Datadog
AssertionError: ffe_runtime_defaults not found in span meta: ['_dd.base_service', '_dd.tags.process', '_dd.svc_src', '_dd.p.tid', 'language', 'runtime-id', '_dd.p.dm']
assert 'ffe_runtime_defaults' in {'_dd.base_service': '', '_dd.p.dm': '-0', '_dd.p.tid': '6a31d5a500000000', '_dd.svc_src': 'm', ...}

self = <tests.parametric.test_ffe.test_span_enrichment.Test_Span_Enrichment_Default_Fallback object at 0x7f7c44cbdbe0>
test_agent = <utils.docker_fixtures._test_agent.TestAgentAPI object at 0x7f7c44783590>
test_library = <utils.docker_fixtures._test_clients._test_client_parametric.ParametricTestClientApi object at 0x7f7c447f8680>

    @parametrize("library_env", [{**DEFAULT_ENVVARS}])
    def test_ffe_runtime_defaults_value_truncated_at_64_chars(
        self, test_agent: TestAgentAPI, test_library: APMLibrary
...
View all 10 test failures

Testing the test | all-jobs-are-green   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7e6886e | Docs | Datadog PR Page | 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