-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add Tracking API #81
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
Conversation
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.
Summary of Changes
Hello @MaelRB, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the OpenFeature Swift SDK by integrating the Tracking API. This feature allows developers to associate user actions and application states with feature flag evaluations, which is vital for robust experimentation and collecting telemetry. The changes introduce new core components for tracking, seamlessly integrate them into existing client and provider interfaces without breaking changes, and ensure that evaluation contexts are correctly merged for comprehensive data capture during tracking events.
Highlights
- Tracking API Implementation: The OpenFeature Swift SDK now includes a comprehensive Tracking API, fully adhering to the OpenFeature specifications for associating user actions with feature flag evaluations.
- New Protocols and Structures: Introduced
TrackingandTrackingEventDetailsprotocols, along with theImmutableTrackingEventDetailsstruct, to define and manage tracking event data. - Client and Provider Integration: The
Clientprotocol now conforms toTracking, andOpenFeatureClienthas been extended withtrackmethods. TheFeatureProviderprotocol includes a newtrackmethod with a default no-op implementation for extensibility. - Evaluation Context Merging: Enhanced
OpenFeatureClientwith logic to merge API-level and invocation-level evaluation contexts when reporting track events, ensuring comprehensive context capture. - Documentation and Tests: The
README.mdhas been updated to reflect the availability of the Tracking API with code examples. New unit tests have been added to validate the tracking functionality, context merging, and theImmutableTrackingEventDetailsstruct.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
b5ccc99 to
9e46ebf
Compare
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.
Code Review
This pull request introduces the Tracking API, aligning the Swift SDK with the OpenFeature specification. The changes include new protocols (Tracking, TrackingEventDetails), concrete implementations (ImmutableTrackingEventDetails), and updates to the Client and FeatureProvider to support tracking events. The implementation is well-structured, with good separation of concerns and comprehensive test coverage for the new functionality. I've identified a potential issue in the context merging logic and a couple of areas for minor code simplification. Overall, this is a great addition to the SDK.
Signed-off-by: Mael RB <mael.rb@outlook.com>
Signed-off-by: Mael RB <mael.rb@outlook.com>
Signed-off-by: Mael RB <mael.rb@outlook.com>
9e46ebf to
8746829
Compare
Signed-off-by: Mael RB <mael.rb@outlook.com>
beeme1mr
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.
Approving from an OpenFeature spec perspective, thanks.
nicklasl
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.
Looks good, thanks for contributing!
🤖 I have created a release *beep* *boop* --- ## [0.5.0](0.4.0...0.5.0) (2025-11-12) ### ⚠ BREAKING CHANGES * add provider event details ([#77](#77)) ### 🐛 Bug Fixes * Prevent race condition on updateContext ([#84](#84)) ([dd23929](dd23929)) ### ✨ New Features * add multiprovider ([#78](#78)) ([869b90a](869b90a)) * add provider event details ([#77](#77)) ([56b477e](56b477e)) * add Tracking API ([#81](#81)) ([c14b0cd](c14b0cd)) * Allow FlagEvaluationDetails to be a public API ([#79](#79)) ([0b07a8f](0b07a8f)) ### 📚 Documentation * Update docs with ImmutableContext ([#72](#72)) ([28ccd3e](28ccd3e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…w outputs (#92) <!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> Latest GitHub Release/SPM Version: [0.5.0](https://github.com/open-feature/swift-sdk/releases/tag/0.5.0) Latest Published CocoaPods Version: 0.3.0 (because [the workflow has been getting skipped during releases](https://github.com/open-feature/swift-sdk/actions/runs/19297891762)) <img width="1626" height="107" alt="image" src="https://github.com/user-attachments/assets/5678eec0-ba7f-49c2-b6ff-e6adf7e053a8" /> - fixes CocoaPods publishing by correcting release-please workflow outputs which were causing publication to be skipped - removes incorrect namespace prefix from workflow outputs (`OpenFeature--release_created` → `release_created`) - updates comment to align with behavior for simple release type with root path ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> Fixes #91 ### Notes <!-- any additional notes for this PR --> The workflow was incorrectly using namespaced outputs like `steps.release.outputs['OpenFeature--release_created']`, but the simple release type with root path (`.`) doesn't actually namespace outputs. This caused the CocoaPods job condition to evaluate to false, skipping publication. Verified by examining workflow logs from the 0.5.0 release which show actual outputs are `release_created`, `version`, etc. without namespace prefixes. ``` % gh run list --workflow release-please.yaml --limit 3 STATUS TITLE WORKFLOW BRANCH EVENT ID ELAPSED AGE ✓ chore(deps): update amannn/action-semantic-pull-request action to v6 … Run Release Please main push 19442473525 16s about 17 days ago ✓ chore: update copyright and gitignore (#88) Run Release Please main push 19442153404 23s about 17 days ago ✓ chore(main): release 0.5.0 (#73) Run Release Please main push 19297891762 17s about 22 days ago % gh run view 19297891762 --log | grep -A10 -B10 "release_created\|Dump Release Please Output" release-please UNKNOWN STEP 2025-11-12T12:45:25.8719301Z ❯ targetBranch: main release-please UNKNOWN STEP 2025-11-12T12:45:25.8721712Z ❯ commits: 0 release-please UNKNOWN STEP 2025-11-12T12:45:25.8725336Z ✔ Considering: 0 commits release-please UNKNOWN STEP 2025-11-12T12:45:25.8726276Z ✔ No commits for path: ., skipping release-please UNKNOWN STEP 2025-11-12T12:45:25.8955456Z ##[group]Run echo "$RELEASE_PLEASE_OUTPUT" release-please UNKNOWN STEP 2025-11-12T12:45:25.8955895Z echo "$RELEASE_PLEASE_OUTPUT" release-please UNKNOWN STEP 2025-11-12T12:45:25.8993497Z shell: /usr/bin/bash -e {0} release-please UNKNOWN STEP 2025-11-12T12:45:25.8993806Z env: release-please UNKNOWN STEP 2025-11-12T12:45:25.8999929Z RELEASE_PLEASE_OUTPUT: { release-please UNKNOWN STEP "releases_created": "true", release-please UNKNOWN STEP "release_created": "true", release-please UNKNOWN STEP "id": "261739650", release-please UNKNOWN STEP "name": "v0.5.0", release-please UNKNOWN STEP "tag_name": "0.5.0", release-please UNKNOWN STEP "sha": "d71686219a65ab78f77923ceb0e2ea549e1e50ef", release-please UNKNOWN STEP "body": "## [0.5.0](0.4.0...0.5.0) (2025-11-12)\n\n\n### ⚠ BREAKING CHANGES\n\n* add provider event details ([#77](https://github.com/open-feature/swift-sdk/issues/77))\n\n### 🐛 Bug Fixes\n\n* Prevent race condition on updateContext ([#84](#84)) ([dd23929](https://github.com/open-feature/swift-sdk/commit/dd239294e127ebf598f38227e4b9a85447576aff))\n\n\n### ✨ New Features\n\n* add multiprovider ([#78](#78)) ([869b90a](https://github.com/open-feature/swift-sdk/commit/869b90a7bf0c98368fe5b49f6c852178ba299ad7))\n* add provider event details ([#77](#77)) ([56b477e](https://github.com/open-feature/swift-sdk/commit/56b477e69250bc52feab0c9838234843d83b5732))\n* add Tracking API ([#81](#81)) ([c14b0cd](https://github.com/open-feature/swift-sdk/commit/c14b0cd6624c04801d16a801e4cf3412d522e4bd))\n* Allow FlagEvaluationDetails to be a public API ([#79](#79)) ([0b07a8f](https://github.com/open-feature/swift-sdk/commit/0b07a8ff1e790fe57de4608ff7ae2edaa8fdb48d))\n\n\n### 📚 Documentation\n\n* Update docs with ImmutableContext ([#72](#72)) ([28ccd3e](28ccd3e))", release-please UNKNOWN STEP "html_url": "https://github.com/open-feature/swift-sdk/releases/tag/0.5.0", release-please UNKNOWN STEP "draft": "false", release-please UNKNOWN STEP "upload_url": "https://uploads.github.com/repos/open-feature/swift-sdk/releases/261739650/assets{?name,label}", release-please UNKNOWN STEP "path": ".", release-please UNKNOWN STEP "version": "0.5.0", release-please UNKNOWN STEP "major": "0", release-please UNKNOWN STEP "minor": "5", release-please UNKNOWN STEP "patch": "0", release-please UNKNOWN STEP "paths_released": "[\".\"]" release-please UNKNOWN STEP } release-please UNKNOWN STEP 2025-11-12T12:45:25.9006547Z ##[endgroup] ... ``` ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> - Update the `COCOAPODS_TRUNK_TOKEN` repository secret with a fresh trunk token [as described in OWNERS.md](https://github.com/open-feature/swift-sdk/blob/main/OWNERS.md) if hasn't been kept up to date - The token expires every 128 days, and the `0.3.0` release was a while ago ``` % bundle exec pod trunk info OpenFeature OpenFeature - Versions: - 0.3.0 (2024-05-23 16:00:30 UTC) - Owners: - OpenFeature <openfeature-core@groups.io> ``` ### How to test <!-- if applicable, add testing instructions under this section --> - Monitor next release to confirm CocoaPods publishing works Signed-off-by: Sameeran Kunche <sameeran.kunche@datadoghq.com>
This PR
Related Issues
Fixes 51