Skip to content

Resolve Feature Flags enablement from instrumenter config - #12845

Open
PerfectSlayer wants to merge 6 commits into
masterfrom
bbujon/ffe-agent-config
Open

PerfectSlayer wants to merge 6 commits into
masterfrom
bbujon/ffe-agent-config

Conversation

@PerfectSlayer

@PerfectSlayer PerfectSlayer commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

What Does This Do

Moves the Feature Flags configuration resolution (product switch and configuration source) to InstrumenterConfig, parsing the source as a FeatureFlaggingSource enum, and adds the FEATURE_FLAGS instrumentation target system. The agent detects the product activation in Agent.start() like the other products.

Motivation

The upcoming dd-openfeature-connector instrumentation needs to be gated on Feature Flags being enabled. This is the first PR of the stack that makes dd-openfeature a standalone SDK (APMLP-1512).

Additional Notes

Config delegates to InstrumenterConfig and still returns the source as a string until #12844.

Stack

The full change is in #12709. It was split into this stack to ease the review.

  1. Resolve Feature Flags enablement from instrumenter config #12845 👈 this PR
  2. Add dd-openfeature SDK flag configuration and evaluation core #12840
  3. Add dd-openfeature SDK settings and configuration delivery #12841
  4. Add dd-openfeature SDK exposure and flag evaluation pipelines #12842
  5. Add dd-openfeature SDK OpenFeature provider #12843
  6. Connect the dd-openfeature SDK to the agent #12844
  7. Add agentless and standalone OpenFeature smoke tests #12846

Jira ticket: APMLP-1512

🤖 Generated with Claude Code

@datadog-official

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.96 s 13.94 s [-0.8%; +1.1%] (no difference)
startup:insecure-bank:tracing:Agent 12.86 s 13.00 s [-1.5%; -0.5%] (maybe better)
startup:petclinic:appsec:Agent 17.09 s 17.03 s [-0.5%; +1.1%] (no difference)
startup:petclinic:iast:Agent 16.87 s 16.36 s [-1.2%; +7.4%] (no difference)
startup:petclinic:profiling:Agent 16.86 s 16.82 s [-0.9%; +1.3%] (no difference)
startup:petclinic:sca:Agent 17.02 s 16.24 s [-0.8%; +10.4%] (unstable)
startup:petclinic:tracing:Agent 16.05 s 16.02 s [-0.5%; +0.8%] (no difference)

Commit: 6b3d5a12 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@PerfectSlayer
PerfectSlayer marked this pull request as ready for review October 13, 2026 07:48
@PerfectSlayer
PerfectSlayer requested review from a team as code owners October 13, 2026 07:48
@PerfectSlayer
PerfectSlayer requested review from sarahchen6 and removed request for a team October 13, 2026 07:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-10-13T07:54:32.534820Z 0b5a6d8 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-13T07:55:25.994032Z 0b5a6d8 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.

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

Feature-flag enablement retains the existing resolver precedence after moving into InstrumenterConfig. Source inspection of configuration resolution, startup ordering, and target-system filtering found no reportable regression.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 0b5a6d8

@sarahchen6 sarahchen6 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

private static boolean agentlessLogSubmissionEnabled = false;
private static boolean appLogsCollectionEnabled = false;
private static boolean featureFlaggingEnabled = false;
private static volatile boolean featureFlaggingEnabled = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just wondering - how did you know to make this volatile?

@PerfectSlayer PerfectSlayer Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is now set in another thread, no longer initialize in Agent.start() like the other.
I already verified it because I find it weird myself, but having the same question from you again makes me think there is something wrong on the design. I'll keep refining it. Good call.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The feature flagging config module is no longer needed with this new design. You raised concerned in the past about adding to the internal-api module so I went ahead and simplified the config as any other product - Config/InstrumenterConfig logic + config keys in a dedicated class in the public API.
The product activation detection was also simplified in agent to align with the other product behavior, but the overall FFE config resolution is still in place later down in the product itself.

@@ -276,6 +270,12 @@ private InstrumenterConfig() {
CODE_ORIGIN_FOR_SPANS_INTERFACE_SUPPORT,
DEFAULT_CODE_ORIGIN_FOR_SPANS_INTERFACE_SUPPORT);
traceEnabled = configProvider.getBoolean(TRACE_ENABLED, DEFAULT_TRACE_ENABLED);
featureFlaggingEnabled =
resolveConfiguration(
configProvider.getBoolean(FEATURE_FLAGS_ENABLED),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A Codex review pointed out that previously the parser needed exactly 1 or true for feature flags to be enabled, but now empty or whitespace-only values will also result in enabling this flagwith ConfigProvider.getBoolean(). Setting -Ddd.feature.flags.enabled= probably isn't likely, but should we preserve the previous behavior just in case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For a bit of context, this is an issue with the current implementation on master: (2 AI bullet points below for context)

  • Master wasn't consistent with itself. Its Config already read this setting with configProvider.getBoolean(FEATURE_FLAGS_ENABLED), with the same blank-means-unset rule. On master, -Ddd.feature.flags.enabled= disabled the product at startup while Config.isFeatureFlaggingProviderEnabled() reported it enabled. Resolve Feature Flags enablement from instrumenter config #12845 removes that split.
  • The SDK does the same. Settings.getBoolean in dd-openfeature treats blank as unset, and ConfigurationResolutionParityTest relies on the agent and the SDK resolving the same way. Restoring the old behaviour in the agent alone would break that parity.

Overall, I went for:

  1. consistency - having the product activation and flag parsing as any other product to avoid surprising customers
  2. simplicity - reuse the existing mechanism in order to have the less code duplication and later maintenance.

I also turned the source to an enum and use the default enum parsing behavior for config following those two principles.

@PerfectSlayer
PerfectSlayer requested a review from a team as a code owner October 14, 2026 05:30
@PerfectSlayer
PerfectSlayer requested review from danyal002 and leoromanovsky and removed request for a team October 14, 2026 05:30

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

An explicit Feature Flags configuration source no longer overrides a disabled deprecated provider toggle at bootstrap, so an otherwise enabled subsystem never starts.

Open Bits AI session

🤖 Bits Code Review · Commit 670baa8

Comment thread dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java Outdated
PerfectSlayer and others added 4 commits October 14, 2026 08:56
Move the Feature Flags enablement resolution to InstrumenterConfig and
add the FEATURE_FLAGS instrumentation target system, so instrumentations
can be gated on the product being enabled. The agent now reads it from
Config instead of resolving the settings itself at premain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the Feature Flags product activation in Agent.start() with the
other products, so it no longer needs to be volatile.
Resolve the product switch and configuration source once in
InstrumenterConfig, with Config delegating to it, instead of resolving
them twice through feature-flagging-config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-written source normalization with the agent enum
config parsing. A blank source is unset, and an unknown or padded one is
invalid. Config keeps exposing the source as a string for the existing
feature flagging code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checking the deprecated experimental toggle at agent start disabled the
product even when an explicit configuration source wins over it. Only
check the product switch there, and let the feature flagging system
apply the full configuration resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PerfectSlayer
PerfectSlayer force-pushed the bbujon/ffe-agent-config branch from 45abc33 to 118201b Compare October 14, 2026 07:06
InstrumenterConfig is initialized at native-image build time and now
holds a FeatureFlaggingSource value, so the enum must be initialized at
build time too, like the other config enums.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PerfectSlayer
PerfectSlayer requested a review from a team as a code owner October 14, 2026 08:03
@PerfectSlayer
PerfectSlayer requested review from ygree and removed request for a team October 14, 2026 08:03

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

Explicit disablement retains precedence over source selection and the legacy toggle, and the new instrumentation target uses resolved enablement. Runtime behavior was assessed from source only.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 6b3d5a1

@PerfectSlayer

Copy link
Copy Markdown
Collaborator Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-14 09:37:01 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-10-14 09:37:11 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

Use /merge -c to cancel this operation!


⏳ Waiting for pull request to become mergeable

This branch has not been deployed

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

Labels

comp: openfeature OpenFeature tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants