Add OpenFeature provider - #70353
Closed
1fanwang wants to merge 1 commit into
Closed
Conversation
Introduce a provider for OpenFeature (https://openfeature.dev), the CNCF vendor-neutral feature-flag evaluation API. It lets DAG code and cluster policies evaluate flags against any OpenFeature backend (flagd, GrowthBook, Unleash, an in-house system) without changing call sites. Ships: - OpenFeatureHook: register a provider from a connection and evaluate boolean/string flags. - FeatureFlagSensor: wait until a flag is enabled for a targeting entity. - FractionalProvider: a dependency-free in-process provider for deterministic percentage rollouts, so a canary works without running a flag daemon. The hook can back a task_policy to progressively deliver a platform change to a DAG/task cohort with no core change (documented in the provider index). Signed-off-by: 1fanwang <1fannnw@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Airflow has no vendor-neutral way to evaluate feature flags. Teams that want to canary or
progressively roll out a change (a new operator behavior, a migration, an executor option) either
hard-code a specific vendor SDK inside a
PythonOperatoror write a bespoke hook per backend.OpenFeature is the CNCF standard for exactly this: one evaluation API with
a pluggable provider per backend (flagd, GrowthBook, Unleash, an in-house system).
What
A new
apache-airflow-providers-openfeatureprovider:OpenFeatureHook— registers an OpenFeature provider from a connection and evaluatesboolean/string flags with a targeting context.
FeatureFlagSensor— waits until a flag is enabled for a targeting entity, e.g. hold a task until arollout reaches its
dag_id.FractionalProvider— a dependency-free, in-process provider for deterministic percentage rollouts,so a canary works with no external flag daemon (mirrors flagd's fractional op).
The hook also backs a cluster-policy pattern (documented in the provider index): consult a flag from
task_policyinairflow_local_settings.pyto flip a cohort'spool/queueand ramp a platformchange like a canary, with no core change. That progressive-delivery use case is the point; the
sensor and hook are the building blocks.
Scope is intentionally small to open the discussion. Out of scope here: vendor-specific provider
adapters (those belong to each vendor or the user's own code), named-client multi-provider setups, and
any core change.
Tests
providers/openfeature/tests/unit— 11 unit tests: the fractional provider (determinism, rampdistribution, weighted variants), the hook (global-provider fallback, provider registration from a
connection, register-once), and the sensor (enabled, disabled, expected). Green on Airflow 3.2.2 with
openfeature-sdk 0.10.0.
Risk
Additive and opt-in: a new provider, nothing existing changes.
openfeature-sdkis the only newdependency and is pulled only when the provider is installed.
FractionalProvideris a convenience fortesting and simple rollouts; production points OpenFeature at a real backend.
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot CLI following the guidelines