feat(ffe): add runtime-backed PHP feature flag evaluation#3906
feat(ffe): add runtime-backed PHP feature flag evaluation#3906leoromanovsky wants to merge 24 commits into
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 782f622 | Docs | Datadog PR Page | Give us feedback! |
|
Benchmarks [ tracer ]Benchmark execution time: 2026-05-28 02:35:37 Comparing candidate commit 4cf261d in PR branch Found 1 performance improvements and 4 performance regressions! Performance is the same for 188 metrics, 1 unstable metrics. scenario:BM_TeaSapiSpindown
scenario:ContextPropagationBench/benchInject128Bit-opcache
scenario:ContextPropagationBench/benchInject64Bit-opcache
scenario:LogsInjectionBench/benchLogsInfoBaseline-opcache
scenario:LogsInjectionBench/benchLogsNullBaseline-opcache
|
…stone-1-runtime-evaluation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e55ebb976b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Feedback from @bwoebi addressed; retest with local build against ffe-dogfooding server with satisfactory results. |
Motivation
This PR adds real server-side PHP feature flag evaluation backed by Remote Config and the
libdatadognative evaluator. PHP 7 gets a Datadog API, PHP 8 can use the optional OpenFeature bridge, and both paths use the same live runtime evaluator.This is intentionally the evaluation layer only. Exposure delivery, exposure caching, and evaluation metrics land in the later hook, exposure, and metrics PRs.
Shared planning doc: https://docs.google.com/document/d/1NvMfTpZWLBlFmEFNjdnlMyeVpy5l7KD8qujGFco6w2w/edit?tab=t.0
Decisions
productionRuntime=falseremains a temporary guardrail while the hook, exposure delivery, and evaluation metrics layers are incomplete. The final production-ready PHP FFE stack should not ship with that warning enabled.bool,int,float,string) into the native evaluator. Nested arrays, objects, and null attribute values are dropped at the boundary.DDTrace\Testing\ffe_load_configexists only for local/canonical fixture tests.Where this PR fits in the stack
This is the bottom layer of the 4-PR stack. #3909 adds the shared hook, while #3910 (EVP exposures) and #3911 (OTLP metrics) build on top of that hook.
Where this PR fits in the target system
This PR contributes the in-PHP evaluation surface:
UserCode->OpenFeature Client(PHP 8) /DDTrace FeatureFlags Client(PHP 7 + 8), theDDTrace OpenFeature DataDogProvider, theNativeEvaluatorFFI bridge into libdatadog, and the Remote Config client for theFFE_FLAGSproduct.Changes
libdatadogFFE evaluator path and keeps PHP user-facing APIs as thin adapters over the native runtime.DDTrace\FeatureFlagsevaluation through live Remote Config.DDTrace\OpenFeatureprovider bridge.DataDog/ffe-system-test-datasubmodule and a native-runtime PHPT loop overufc-config.jsonandevaluation-cases/*.json.Not Included
Validation
php vendor/bin/phpunit --config phpunit.xml tests/api/Unit/FeatureFlags tests/OpenFeature/DataDogProviderTest.php: 29 tests / 87 assertions.make test_featureflags: 8 tests / 29 assertions.MAX_TEST_PARALLELISM=1 TESTS=tests/ext/ffe/native_bridge_evaluate.phpt make test_c: 1/1 passed.MAX_TEST_PARALLELISM=1 TESTS=tests/ext/ffe/system_test_data_evaluate.phpt make test_c: 1/1 passed.make test_internal_api_randomized: passed.Dogfooding Validation
See DataDog/ffe-dogfooding#68.
Ran the PHP 7 and PHP 8 servers locally; observed correct evaluations.