Skip to content

feat(parametric/java): enable FFE span-enrichment scenario for Java#7150

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

feat(parametric/java): enable FFE span-enrichment scenario for Java#7150
leoromanovsky wants to merge 1 commit into
mainfrom
leo.romanovsky/ffe-enrichment-enable-java

Conversation

@leoromanovsky

Copy link
Copy Markdown
Contributor

Motivation

DataDog/dd-trace-java#11658 adds
FFE APM feature-flag span enrichment to the Java tracer (experimental, gated behind
DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED): the root APM span carries
ffe_flags_enc / ffe_subjects_enc / ffe_runtime_defaults tags, encoded against the
FROZEN contract (dd-trace-js#8343). The parametric suite
tests/parametric/test_ffe/test_span_enrichment.py already exists and is frozen; Java is
currently marked missing_feature. This PR enables it for Java.

Changes

  • manifests/java.yml — declare tests/parametric/test_ffe/test_span_enrichment.py
    at v1.64.0 (the release that ships the feature), replacing missing_feature.
  • FeatureFlagEvaluatorController.java (parametric test client) — re-activate the
    caller-supplied root span around the OpenFeature evaluation so the ffe_* tags land on
    the test's root span. The client sends span_id as a decimal string; it is resolved via
    the OpenTracing registry (OpenTracingController.getSpan(DDSpanId.from(...))). An
    unknown / missing / unparsable span_id leaves the target null → activation is skipped
    and never throws. The eval switch is extracted into an evaluate(...) helper so it can
    run inside or outside the re-activated scope.

The frozen test, fixture (span-enrichment-flags.json), and the Python client-side
ffe_evaluate(..., span_id=...) plumbing already exist on main, so the diff is limited
to the manifest line and the Java parametric controller.

Decisions

  • v1.64.0 (release) vs. a SNAPSHOT declaration — the manifest declares the release
    version the feature ships in, matching the existing FFE convention
    (test_dynamic_evaluation.py: v1.56.0). Validated locally against a
    1.64.0-SNAPSHOT build of the SDK branch.
  • Why re-activate the span in the controllerffe_* tags are attached to the root
    span of the active trace at flag-evaluation time. The parametric test starts a span and
    passes its span_id to /ffe/evaluate; without re-activating that span around the eval,
    the evaluation runs outside the test's trace and the tags have no root span to attach to.

Validation

The frozen suite (18 cases) was run locally against a dd-java-agent 1.64.0-SNAPSHOT
(+ custom dd-trace-api / dd-openfeature) built from dd-trace-java#11658
(HEAD 8491123c5d):

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

All 18 cases execute and pass — delta-varint codec, ffe_flags_enc serial-ID combination

  • child-span→root propagation + 200-ID cap, ffe_subjects_enc SHA256-hashed targeting keys
    with doLog gating + 10-subject / 20-experiments-per-subject caps, and ffe_runtime_defaults
    fallback + 64-char truncation + 5-key cap.

Enable tests/parametric/test_ffe/test_span_enrichment.py for the Java
tracer (DataDog/dd-trace-java#11658), which adds FFE APM feature-flag
span enrichment behind DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED.

- FeatureFlagEvaluatorController: re-activate the caller-supplied root span
  (span_id) around the OpenFeature evaluation so the ffe_* tags land on the
  test's root span. span_id arrives as a decimal string and is resolved via
  the OpenTracing registry (DDSpanId.from); unknown/unparsable ids skip
  activation and never throw.
- manifests/java.yml: declare the enrichment suite at v1.64.0 (the release
  that ships the feature).
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

manifests/java.yml                                                      @DataDog/asm-java @DataDog/apm-java
utils/build/docker/java/parametric/src/main/java/com/datadoghq/trace/controller/FeatureFlagEvaluatorController.java  @DataDog/apm-java @DataDog/asm-java @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

🚦 16 Pipeline jobs failed

Testing the test | System Tests (java, dev) / End-to-end #1 / akka-http 1   View in Datadog   GitHub Actions

Testing the test | System Tests (java, dev) / End-to-end #1 / jersey-grizzly2 1   View in Datadog   GitHub Actions

Testing the test | System Tests (java, dev) / End-to-end #1 / play 1   View in Datadog   GitHub Actions

View all 16 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9f156eb | 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