-
Couldn't load subscription status.
- Fork 203
FMEPRD-282 Add OpenFeature Documentation and Release Notes #11760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alai97
wants to merge
10
commits into
main
Choose a base branch
from
add-openfeature-sdk-section
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+910
−38
Open
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fd104aa
FMEPRD-282
alai97 23272cd
Add Traffic Types Doc Link
alai97 1d10fa9
Wording Nit
alai97 6b0e40f
SME Review
alai97 42983f3
Merge branch 'main' into add-openfeature-sdk-section
alai97 710d1ca
SME Review
alai97 d128211
SME Review
alai97 52bf823
Consistency Nit
alai97 81d456b
Bump Version
alai97 04e6ccd
Bump Release Date
alai97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
177 changes: 177 additions & 0 deletions
177
...anagement-experimentation/20-sdks-and-infrastructure/openfeature/android-sdk.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| --- | ||
| title: OpenFeature Provider for Android SDK | ||
| sidebar_label: Android OpenFeature Provider | ||
| sidebar_position: 1 | ||
| description: Integrate OpenFeature with Harness FME in your Android applications to evaluate feature flags, manage contexts, and track events using a standardized SDK. | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| The <Tooltip id="fme.openfeature.provider">Android OpenFeature Provider</Tooltip> allows your Android applications to integrate with Harness FME using a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Android SDK. | ||
|
|
||
| This page walks you through installing, configuring, and using the Android OpenFeature provider to evaluate <Tooltip id="fme.openfeature.feature-flag">feature flags</Tooltip> in your Android applications. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| Before you begin, ensure you have the following: | ||
|
|
||
| - A valid [Harness FME SDK key](/docs/feature-management-experimentation/sdks-and-infrastructure/#api-keys) for your project | ||
| - An Android project targeting API Level 21 (Android 5.0 Lollipop) or later | ||
| - Access to your project's `build.gradle` or `build.gradle.kts` file to add the provider dependency | ||
|
|
||
| ### Version compatibility | ||
|
|
||
| | Component | Minimum Version | | ||
| | --------------------------------- | ----------------------------------- | | ||
| | Android | API Level 21 (Android 5.0 Lollipop) | | ||
| | `split-openfeature-provider-android` | ≥ 1.0.0 | | ||
| | OpenFeature Kotlin SDK | ≥ 1.0.0 | | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Install the provider and dependencies | ||
|
|
||
| Add the Harness FME OpenFeature provider dependency to your application's `build.gradle.kts` file. | ||
|
|
||
| ```kotlin | ||
| dependencies { | ||
| implementation("io.split.openfeature:split-openfeature-android:1.0.0") | ||
| } | ||
| ``` | ||
|
|
||
| Or, if you're using the Groovy DSL (`build.gradle`): | ||
|
|
||
| ```groovy | ||
| dependencies { | ||
| implementation 'io.split.openfeature:split-openfeature-android:1.0.0' | ||
| } | ||
| ``` | ||
|
|
||
| ## Initialize the provider | ||
|
|
||
| The FME OpenFeature provider requires an Android application `Context` (for SDK initialization) and your Harness FME SDK Key. | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```kotlin | ||
| import dev.openfeature.kotlin.sdk.OpenFeatureAPI | ||
| import dev.openfeature.kotlin.sdk.ImmutableContext | ||
| import io.split.openfeature.android.provider.SplitProvider | ||
|
|
||
| // Create provider configuration | ||
| val config = SplitProvider.Config( | ||
| applicationContext = applicationContext, | ||
| sdkKey = "YOUR_SDK_KEY" | ||
| ) | ||
|
|
||
| // Create the FME provider | ||
| val provider = SplitProvider(config = config) | ||
|
|
||
| // Set the provider with an initial context containing a targeting key | ||
| val initialContext = ImmutableContext(targetingKey = "user-123") | ||
| OpenFeatureAPI.setProvider(provider, initialContext = initialContext) | ||
|
|
||
| // Get a client and evaluate flags | ||
| val client = OpenFeatureAPI.getClient() | ||
| val showNewFeature = client.getBooleanValue("new-feature", false) | ||
| ``` | ||
|
|
||
| ## Construct an evaluation context | ||
|
|
||
| To evaluate flags, you'll need to provide an <Tooltip id="fme.openfeature.evaluation-context">evaluation context</Tooltip> with a <Tooltip id="fme.openfeature.targeting-key">targeting key</Tooltip>. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting. | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| For example: | ||
|
|
||
| ```kotlin | ||
| val context = ImmutableContext( | ||
| targetingKey = "user-123", | ||
| attributes = mapOf( | ||
| "email" to Value.String("[email protected]"), | ||
| "age" to Value.Integer(30), | ||
| "plan" to Value.String("premium") | ||
| ) | ||
| ) | ||
|
|
||
| val client = OpenFeatureAPI.getClient() | ||
| val result = client.getBooleanDetails("premium-feature", false, context) | ||
| ``` | ||
|
|
||
| To set a targeting key during initialization: | ||
|
|
||
| ```kotlin | ||
| val initialContext = ImmutableContext(targetingKey = "user-123") | ||
| OpenFeatureAPI.setProvider(provider, initialContext = initialContext) | ||
| ``` | ||
|
|
||
| To change a targeting key at runtime: | ||
|
|
||
| ```kotlin | ||
| val newContext = ImmutableContext(targetingKey = "user-456") | ||
| OpenFeatureAPI.setEvaluationContext(newContext) | ||
| ``` | ||
|
|
||
| ## Observe provider events | ||
|
|
||
| The FME OpenFeature provider emits <Tooltip id="fme.openfeature.events">events</Tooltip> when provider state changes (for example, when flags update, configuration changes, or errors) occur. You can observe these events to react dynamically in your application. | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```kotlin | ||
| import dev.openfeature.kotlin.sdk.events.OpenFeatureProviderEvents | ||
| import kotlinx.coroutines.launch | ||
|
|
||
| // Observe provider events | ||
| lifecycleScope.launch { | ||
| provider.observe().collect { event -> | ||
| when (event) { | ||
| is OpenFeatureProviderEvents.ProviderReady -> { | ||
| // Provider is ready to evaluate flags | ||
| Log.d("Split", "Provider is ready") | ||
| } | ||
| is OpenFeatureProviderEvents.ProviderConfigurationChanged -> { | ||
| // Flag configuration has been updated | ||
| Log.d("Split", "Configuration changed") | ||
| } | ||
| is OpenFeatureProviderEvents.ProviderStale -> { | ||
| // Provider is serving cached data | ||
| Log.d("Split", "Provider is stale") | ||
| } | ||
| is OpenFeatureProviderEvents.ProviderError -> { | ||
| // An error occurred | ||
| Log.e("Split", "Provider error: ${event.error}") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Track events | ||
|
|
||
| The FME OpenFeature provider supports tracking events such as user actions or conversions. To enable event tracking, set a [`TrafficType`](/docs/feature-management-experimentation/management-and-administration/fme-settings/traffic-types/) in the evaluation context. | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```kotlin | ||
| // Set context with trafficType | ||
| val context = ImmutableContext(targetingKey = "user-123") | ||
| .withTrafficType("user") | ||
|
|
||
| OpenFeatureAPI.setEvaluationContext(context) | ||
|
|
||
| // Track an event | ||
| val client = OpenFeatureAPI.getClient() | ||
| client.track("button_clicked") | ||
|
|
||
| // Track with a value | ||
| client.track( | ||
| "purchase_completed", | ||
| TrackingEventDetails(value = 99.99) | ||
| ) | ||
|
|
||
| // Track with properties | ||
| client.track( | ||
| "page_viewed", | ||
| TrackingEventDetails( | ||
| structure = ImmutableStructure( | ||
| mapOf( | ||
| "page" to Value.String("home"), | ||
| "referrer" to Value.String("google") | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
| ``` | ||
|
|
||
| For more information, see the [Harness FME Android OpenFeature Provider GitHub repository](https://github.com/splitio/split-openfeature-provider-android/). | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
66 changes: 66 additions & 0 deletions
66
...ture-management-experimentation/20-sdks-and-infrastructure/openfeature/index.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| title: OpenFeature Providers | ||
| id: index | ||
| slug: /feature-management-experimentation/sdks-and-infrastructure/openfeature | ||
| sidebar_position: 1 | ||
| description: Learn about using Harness OpenFeature providers for feature management. | ||
| --- | ||
|
|
||
| ## Overview | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [OpenFeature](https://openfeature.dev/docs/reference/intro) offers a standardized, vendor-agnostic SDK for feature flagging that can integrate with a variety of third-party providers. Whether you're using an open-source or commercial solution, self-hosted or cloud-hosted, OpenFeature gives developers a unified API for consistent feature flag evaluation. | ||
|
|
||
| OpenFeature SDKs provide flexible abstractions that make it easy to integrate feature flags into any application. Within your application, the feature flagging client uses the OpenFeature SDK to evaluate <Tooltip id="fme.openfeature.feature-flag">feature flags</Tooltip> through the <Tooltip id="fme.openfeature.evaluation-api">Evaluation API</Tooltip>. | ||
|
|
||
| Each flag evaluation passes an <Tooltip id="fme.openfeature.evaluation-context">evaluation context</Tooltip>, which provides relevant data about the application or user. | ||
|
|
||
| ```mermaid | ||
| flowchart LR | ||
| %% Outer app box | ||
| subgraph YourApp["Your App"] | ||
| style YourApp fill:#D0E4FF,stroke:#0000FF,stroke-width:2px | ||
|
|
||
| %% Feature Flagging Client (yellow dotted box) | ||
| subgraph FeatureFlagClient["Feature Flagging Client"] | ||
| style FeatureFlagClient stroke:#FFD700,stroke-dasharray: 5 5 | ||
|
|
||
| %% Puzzle piece: OpenFeature SDK | ||
| subgraph OpenFeatureSDK["OpenFeature SDK"] | ||
| style OpenFeatureSDK fill:#FFFF99,stroke:#FFD700 | ||
|
|
||
| %% Flag Evaluation API inside SDK | ||
| FlagEvalAPI["Flag Evaluation API"] | ||
| end | ||
|
|
||
| %% OpenFeature Provider in second half of puzzle piece | ||
| OpenFeatureProvider["Harness FME <br> OpenFeature Provider"] | ||
| end | ||
|
|
||
| %% Arrows from Flag Eval through Eval Context directly into FlagEvalAPI | ||
| FlagEval1["Flag Eval"] --> EvalCtx1["Eval Context"] --> FlagEvalAPI | ||
| FlagEval2["Flag Eval"] --> EvalCtx2["Eval Context"] --> FlagEvalAPI | ||
| end | ||
|
|
||
| %% External Harness FME Service in cloud | ||
| HarnessFME["Harness FME Service"]:::cloudStyle | ||
|
|
||
| %% Bidirectional arrow between OpenFeature Provider and Harness FME | ||
| OpenFeatureProvider <--> HarnessFME | ||
|
|
||
| %% Styling for cloud | ||
| classDef cloudStyle fill:#A4E5A4,stroke:#2E8B57,stroke-width:2px,shape:cloud | ||
| ``` | ||
|
|
||
| <br /> | ||
alai97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The <Tooltip id="fme.openfeature.provider">OpenFeature Provider</Tooltip> wraps the Harness FME SDK, bridging the OpenFeature SDK with the Harness Feature Management & Experimentation (FME) service. The provider maps OpenFeature's standardized interface to the FME SDK, which handles communication with Harness services to evaluate feature flags and retrieve configuration updates. | ||
|
|
||
| ## Use OpenFeature SDKs | ||
|
|
||
| Harness FME offers official OpenFeature providers for the following SDKs. | ||
|
|
||
| import { Section, openfeatureSDKs } from '@site/src/components/Docs/data/fmeOpenfeature'; | ||
alai97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <Section items={openfeatureSDKs} /> | ||
|
|
||
| You can use these providers instead of the Harness FME SDK in your application. | ||
141 changes: 141 additions & 0 deletions
141
...e-management-experimentation/20-sdks-and-infrastructure/openfeature/java-sdk.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| --- | ||
| title: OpenFeature Provider for Java SDK | ||
| sidebar_label: Java OpenFeature Provider | ||
| sidebar_position: 3 | ||
| description: Integrate OpenFeature with Harness FME in your Java applications to evaluate feature flags, manage contexts, and track events using a standardized SDK. | ||
| --- | ||
|
|
||
| ## Overview | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The <Tooltip id="fme.openfeature.provider">Java OpenFeature Provider</Tooltip> allows your Java applications to integrate with Harness FME using a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Java SDK. | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This page walks you through installing, configuring, and using the Java OpenFeature provider to evaluate <Tooltip id="fme.openfeature.feature-flag">feature flags</Tooltip> in your Java applications. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| Before you begin, ensure you have the following: | ||
|
|
||
| - A valid [Harness FME SDK key](/docs/feature-management-experimentation/sdks-and-infrastructure/#api-keys) for your project | ||
| - A Java environment running version 11 or later | ||
| - Access to your Maven build configuration | ||
|
|
||
| ### Version compatibility | ||
|
|
||
| | Component | Minimum Version | | ||
| | ---------------------------------------- | ---------------- | | ||
| | Java | 11+ | | ||
| | `split-openfeature-provider-java` | ≥ 1.2.1 | | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | OpenFeature Java SDK | ≥ 1.0.0 | | ||
|
|
||
| ## Install the provider and dependencies | ||
|
|
||
| Add the Harness FME OpenFeature provider dependency to your Maven build configuration. | ||
|
|
||
| ```java | ||
| <dependency> | ||
| <groupId>io.split.openfeature</groupId> | ||
| <artifactId>split-openfeature-provider</artifactId> | ||
| <version>1.2.1</version> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| ## Initialize the provider | ||
|
|
||
| You can instantiate and register the provider using your Harness FME SDK key. | ||
|
|
||
| ```java | ||
| import dev.openfeature.sdk.OpenFeatureAPI; | ||
| import io.split.openfeature.SplitProvider; | ||
|
|
||
| OpenFeatureAPI api = OpenFeatureAPI.getInstance(); | ||
| api.setProviderAndWait(new SplitProvider("<YOUR_API_KEY>")); | ||
| ``` | ||
|
|
||
| Alternatively, if you want more control or need [advanced initialization](/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/java-sdk/#configuration), you can create a `SplitClient` and provide it directly: | ||
|
|
||
| ```java | ||
| import dev.openfeature.sdk.OpenFeatureAPI; | ||
| import io.split.openfeature.SplitProvider; | ||
| import io.split.client.SplitClient; | ||
| import io.split.client.SplitClientConfig; | ||
| import io.split.client.SplitFactoryBuilder; | ||
|
|
||
| OpenFeatureAPI api = OpenFeatureAPI.getInstance(); | ||
|
|
||
|
|
||
| SplitClientConfig config = SplitClientConfig.builder() | ||
| .setBlockUntilReadyTimeout(10000) | ||
| .build(); | ||
| SplitClient splitClient = SplitFactoryBuilder.build("<YOUR_API_KEY>", config).client(); | ||
| api.setProviderAndWait(new SplitProvider(splitClient)); | ||
| ``` | ||
|
|
||
| ## Construct an evaluation context | ||
|
|
||
| To evaluate flags, you'll need to provide an <Tooltip id="fme.openfeature.evaluation-context">evaluation context</Tooltip> with a <Tooltip id="fme.openfeature.targeting-key">targeting key</Tooltip>. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting. | ||
|
|
||
| For example: | ||
|
|
||
| ```java | ||
| Client client = api.getClient("CLIENT_NAME"); | ||
|
|
||
| EvaluationContext context = new MutableContext("<TARGETING_KEY>"); | ||
| Boolean boolValue = client.getBooleanValue("boolFlag", false, context); | ||
| ``` | ||
|
|
||
| If the same targeting key is reused across evaluations, set the context at the client or API level: | ||
|
|
||
| ```java | ||
| EvaluationContext context = new MutableContext("<TARGETING_KEY>"); | ||
| client.setEvaluationContext(context) | ||
| ``` | ||
|
|
||
| Or globally: | ||
|
|
||
| ```java | ||
| EvaluationContext context = new MutableContext("<TARGETING_KEY>"); | ||
| OpenFeatureAPI.getInstance().setEvaluationContext(context) | ||
| ``` | ||
|
|
||
| Once the context is set at the client or API level, you don’t need to provide it for each evaluation. | ||
|
|
||
| ## Evaluate with details | ||
|
|
||
| Use the `get*Details(...)` APIs to get flag values and metadata (such as variant, reason, error code, and configuration). The FME treatment configuration is returned as a raw JSON string under `flagMetadata["config"]`. | ||
|
|
||
| For example: | ||
|
|
||
| ```java | ||
| // boolean/string/number/object all have *Details variants: | ||
| FlagEvaluationDetails<String> details = | ||
| client.getStringDetails("my-flag", "fallback", ctx); | ||
|
|
||
| String jsonConfig = details.getFlagMetadata().getString("config"); // ← Split treatment config | ||
| ``` | ||
|
|
||
| ## Track events | ||
|
|
||
| The FME OpenFeature provider supports tracking user actions or conversion <Tooltip id="fme.openfeature.events">events</Tooltip> directly from your Java application. | ||
alai97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| To enable event tracking, your evaluation context must include the following: | ||
|
|
||
| - A non-empty `targetingKey` | ||
| - A [`trafficType`](/docs/feature-management-experimentation/management-and-administration/fme-settings/traffic-types/) (for example, `"user"` or `"account"`) | ||
| - A non-blank event name | ||
|
|
||
| Optionally, you can include a numeric value and additional event properties. For more information, see [Sending Events](https://developer.harness.io/docs/feature-management-experimentation/api/events/#event-record-fields). | ||
|
|
||
| For example: | ||
|
|
||
| ```java | ||
| MutableContext ctx = new MutableContext("user-123"); | ||
| ctx.add("trafficType", new Value("user")); | ||
|
|
||
| TrackingEventDetails details = new MutableTrackingEventDetails(19.99) | ||
| .add("plan", new Value("pro")) | ||
| .add("coupon", new Value("WELCOME10")); | ||
|
|
||
| client.track("checkout.completed", ctx, details); | ||
| ``` | ||
|
|
||
| For more information, see the [Harness FME Java OpenFeature Provider GitHub repository](https://github.com/splitio/split-openfeature-provider-java). | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.