Skip to content

feat: Support OpenFeature tracking - #50

Merged
kinyoklion merged 2 commits into
mainfrom
devin/openfeature-python-tracking
Aug 25, 2026
Merged

feat: Support OpenFeature tracking#50
kinyoklion merged 2 commits into
mainfrom
devin/openfeature-python-tracking

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Aug 19, 2026

Copy link
Copy Markdown
Member

Implements the OpenFeature tracking API (spec §6) in the provider, matching the behavior of the Java, .NET, and Node providers.

  • client.track(...) previously no-opped silently: the OpenFeature Python SDK only forwards tracking to providers that implement track (spec 6.1.4), so custom/experimentation events were being dropped with no error.
  • TrackingEventDetails.attributes map to the LD event data, and TrackingEventDetails.value maps to metric_value.
  • A track call without an evaluation context logs at info level and sends nothing, since LaunchDarkly requires a context to attribute the event to.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

None; found while auditing the LaunchDarkly OpenFeature providers for missing spec features.

Describe the solution you've provided

LaunchDarklyProvider.track converts the OpenFeature evaluation context to an ldclient.Context with the existing EvaluationContextConverter and then calls the narrowest LDClient.track overload that fits the details supplied: name only, name + data, or name + data + metric value.

Describe alternatives you've considered

Sending an event with an empty/invalid context when no context is supplied, which would produce events LaunchDarkly cannot attribute. The Java provider already logs and skips in this case, so this follows that precedent.

Additional context

Implementation details

TrackingEventDetails.attributes defaults to {} rather than None, so an empty attribute map is normalized to None to avoid sending an empty data object. Tests patch LDClient.track and assert the exact argument shape for each of the four combinations (no context, no details, attributes only, value + attributes, value only).

Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Requested by: @kinyoklion


Note

Overview
Implements OpenFeature spec tracking on LaunchDarklyProvider so client.track(...) forwards custom events to LaunchDarkly instead of being dropped when the provider had no track implementation.

track converts the OpenFeature EvaluationContext via the existing converter and calls LDClient.track with the right arity: event name only, plus data from TrackingEventDetails.attributes, and/or metric_value from TrackingEventDetails.value (empty attribute maps are treated as no data). Calls without an evaluation context log at info on launchdarkly-openfeature-server and send nothing.

Dependency: openfeature-sdk minimum is raised from 0.8.0 to 0.9.0. Tests mock LDClient.track for the no-context, no-details, attributes-only, value-only, and value+attributes paths.

Reviewed by Cursor Bugbot for commit 9d846a4. Bugbot is set up for automated code reviews on this repo. Configure here.

@kinyoklion kinyoklion self-assigned this Aug 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor

@cursor review

@kinyoklion
kinyoklion marked this pull request as ready for review August 19, 2026 16:25
@kinyoklion
kinyoklion requested a review from a team as a code owner August 19, 2026 16:26

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 79b09c0. Configure here.

Comment thread ld_openfeature/provider.py
@devin-ai-integration devin-ai-integration Bot added the devin-pr Pull request created by Devin AI label Aug 19, 2026
devin-ai-integration Bot and others added 2 commits August 25, 2026 16:26
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/openfeature-python-tracking branch from 4042b50 to 9d846a4 Compare August 25, 2026 16:26
@kinyoklion
kinyoklion merged commit 9395775 into main Aug 25, 2026
13 checks passed
@kinyoklion
kinyoklion deleted the devin/openfeature-python-tracking branch August 25, 2026 21:43
kinyoklion pushed a commit that referenced this pull request Aug 31, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.7.0](0.6.0...0.7.0)
(2026-08-31)


### Features

* Populate OpenFeature flag metadata from the evaluation reason
([#53](#53))
([11ae1a6](11ae1a6))
* Report provider name and version to LaunchDarkly
([#51](#51))
([4290b8a](4290b8a))
* Support OpenFeature tracking
([#50](#50))
([9395775](9395775))


### Bug Fixes

* Do not report a failed initialization as a fatal error
([#56](#56))
([946a515](946a515))
* Do not report a permanent data source failure as fatal
([#52](#52))
([15014c1](15014c1))
* Map the WRONG_TYPE error kind to TYPE_MISMATCH
([#57](#57))
([17478dc](17478dc))


### Documentation

* Add an OpenFeature feature matrix to the README
([#58](#58))
([6c31554](6c31554))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> This is a **Release Please** cut that moves the project from **0.6.0**
to **0.7.0** by updating version fields in `pyproject.toml`,
`ld_openfeature/version.py`, `docs/conf.py`, and
`.release-please-manifest.json`.
> 
> It also **adds the 0.7.0 section to `CHANGELOG.md`**, which documents
what ships in this release (not new code in this diff): OpenFeature
**tracking**, **flag metadata from evaluation reason**, **provider
name/version** sent to LaunchDarkly, fixes for **non-fatal** failed init
and permanent data-source failures, **`WRONG_TYPE` → `TYPE_MISMATCH`**
mapping, and a README **OpenFeature feature matrix**.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
12fafea. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devin-pr Pull request created by Devin AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants