Skip to content

feat: Support OpenFeature tracking - #50

Open
kinyoklion wants to merge 2 commits into
mainfrom
devin/openfeature-python-tracking
Open

feat: Support OpenFeature tracking#50
kinyoklion wants to merge 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 tracking on LaunchDarklyProvider so custom/experimentation events reach LaunchDarkly instead of being dropped when the provider had no track implementation.

track converts the OpenFeature evaluation context via the existing converter and calls LDClient.track with the minimal overload: name only, name + data (from TrackingEventDetails.attributes), or name + data + metric_value (from value). Empty attribute maps are treated as no data. Calls without an evaluation context log at info and send nothing, matching other LaunchDarkly OpenFeature providers.

The openfeature-sdk dependency is bumped to >=0.9.0 for TrackingEventDetails. Tests cover all argument combinations by mocking LDClient.track.

Reviewed by Cursor Bugbot for commit 4042b50. 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
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@devin-ai-integration devin-ai-integration Bot added the devin-pr Pull request created by Devin AI label Aug 19, 2026
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.

1 participant