-
Notifications
You must be signed in to change notification settings - Fork 74
[Flags] Merge OpenFeature (feature/flags-ofeat) into develop #3135
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
base: develop
Are you sure you want to change the base?
Conversation
[flags] feat: scaffold openfeature provider module Co-authored-by: typotter <tyler.potter@datadoghq.com>
Implements state observation API for FlagsClient: - Add FlagsClientState sealed class (NotReady, Reconciling, Ready, Stale, Error) - Add FlagsStateListener interface for state change callbacks - Add StateObservable interface bundling getCurrentState, addListener, removeListener, and Flow - Implement FlagsStateManager with ExecutorService for ordered state notifications - Add synchronized blocks for defensive thread safety - Expose state via client.state property - Add StateFlow support for Kotlin coroutines - Ensure Java compatibility - Update NoOpFlagsClient with Ready state - Add comprehensive tests PR #3025
…tate feat: State change notification for flags client (for OpenFeature)
Adds Map<String, Any?> overload for resolveStructureValue(), enabling cleaner API for structured flags using Kotlin collections instead of JSON types. API (backward compatible): - resolveStructureValue(flagKey, JSONObject): JSONObject (existing) - resolveStructureValue(flagKey, Map): Map (new overload) The Map overload returns only primitives, null, nested Maps, and Lists - no JSONObject or JSONArray types. Implementation: - JsonExtensions.kt: Recursive bidirectional Map↔JSON conversion - String.toMap(): Direct JSON string → Map parsing - FlagValueConverter: Recognizes Map::class for OBJECT type - DatadogFlagsClient: Delegates to resolveValue with conversion - NoOpFlagsClient: Returns default map Benefits: - Backward compatible - existing JSONObject API unchanged - Type determines format - input type matches output type - Enables OpenFeature integration without JSON conversion issues
Adds JSONObject and JSONArray method calls used in JsonExtensions.kt: - JSONObject.constructor(String): Parse JSON strings - JSONObject.get/put: Get and set values - JSONArray.get/put: Get and add elements These methods are used for recursive Map↔JSON conversion and are safe within the context of the conversion logic.
feat: resolve map of primitives Co-authored-by: typotter <tyler.potter@datadoghq.com>
…feature Resolved conflicts: - FlagValueConverter.kt: Auto-resolved via rerere - NoOpFlagsClientTest.kt: Kept Map overload test from feature branch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
chore: rebase flagging-ofeat feature branch on latest from develop Co-authored-by: typotter <tyler.potter@datadoghq.com> Co-authored-by: dd-mergequeue[bot] <121105855+dd-mergequeue[bot]@users.noreply.github.com> Co-authored-by: satween <1608994+satween@users.noreply.github.com> Co-authored-by: 0xnm <4046447+0xnm@users.noreply.github.com> Co-authored-by: aleksandr-gringauz <aleksandr.gringauz@datadoghq.com> Co-authored-by: ambushwork <luyi1022@outlook.com> Co-authored-by: jonathanmos <48201295+jonathanmos@users.noreply.github.com> Co-authored-by: kikoveiga <francisco.veiga@datadoghq.com> Co-authored-by: awforsythe <alex.forsythe@datadoghq.com>
Implements OpenFeature Provider for Datadog Feature Flags SDK, enabling standardized feature flag management with vendor-neutral API. Key components: - DatadogFlagsProvider: Spec-compliant provider with blocking lifecycle - FlagsClient.asOpenFeatureProvider(): Extension function for wrapping clients - Type converters: Bidirectional JSON ↔ OpenFeature Value conversion - Event observation: Filtered state change events via Kotlin Flow OpenFeature spec compliance: - Blocking initialize() and onContextSet() (spec 1.7) - Proper event filtering (NotReady/Reconciling handled by SDK) - Static-context paradigm implementation - Error code mapping NotReady state clarifications: - Enhanced FlagsClientState.NotReady documentation - NoOpFlagsClient returns NotReady (not Error) as appropriate state - Aligns with OpenFeature NOT_READY semantics Dependencies: - dev.openfeature:kotlin-sdk-android:0.6.2 (118 Kb) - kotlinx-coroutines-core-jvm:1.7.3 (1514 Kb) - kotlinx-coroutines-test:1.7.3 (test only) - Total transitive dependencies: 3 Mb Test coverage: - 147 unit tests covering all provider methods - Type conversion edge cases - Blocking behavior verification - Event emission and filtering
- Add resolveStructureValue(Map) overload that returns pure Kotlin collections - Implement JsonExtensions with bidirectional Map<->JSONObject conversion - Add comprehensive test coverage for Map API - Update FlagValueConverter to support all Map implementations - Add detekt safe calls configuration for JSON methods The Map API provides better Kotlin integration by returning nested Maps and Lists instead of JSONObject/JSONArray types. Both APIs coexist for compatibility.
…on-ofeat [Flags] fix: add STATIC resolution reason Co-authored-by: typotter <tyler.potter@datadoghq.com>
[Flags] feat: Add Openfeature Flags to test app. Co-authored-by: typotter <tyler.potter@datadoghq.com>
|
🎯 Code Coverage 🔗 Commit SHA: 223d137 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3135 +/- ##
===========================================
+ Coverage 70.73% 70.81% +0.08%
===========================================
Files 893 899 +6
Lines 33000 33138 +138
Branches 5549 5592 +43
===========================================
+ Hits 23341 23465 +124
- Misses 8102 8109 +7
- Partials 1557 1564 +7
🚀 New features to boost your workflow:
|
0xnm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a new module to the Gitlab CI setup as well for it to be published? Or it will be in another PR?
Also let's wait for the @DataDog/documentation review of README and we are good to go.
|
|
||
| **Important notes:** | ||
| - The targeting key must be consistent for the same user or entity to ensure consistent flag evaluation across requests. | ||
| - For anonymous users, use a **persistent UUID** as the targeting key (store it in `SharedPreferences`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: customers may use any other persistent storage, not necessary it should be SharedPreferences
I thought the recent changes (#3122) to the ci pipeline included everything? @aleksandr-gringauz to confirm? |
|
@typotter you are completely right, I forgot about this change. No need to to any changes in Gitlab CI pipeline then. |
Co-authored-by: Nikita Ogorodnikov <4046447+0xnm@users.noreply.github.com>
|
Thanks guys. ptal for the recent changes |
|
sorry @0xnm - just pushed a docs tweak I missed. |
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings. Use ⏳ Processing |
What does this PR do?
Adds comprehensive README documentation for the
dd-sdk-android-flags-openfeaturemodule.Motivation
All code in this PR is from the approved
feature/flags-ofeatbranch. This PR only adds the missing README.md file for the OpenFeature provider module.Additional Notes
The README provides: