Skip to content

feat: Add request id, version, id, and evaluation reason to $feature_flag_called events #75

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

Merged
merged 7 commits into from
Apr 18, 2025

Conversation

haacked
Copy link
Contributor

@haacked haacked commented Apr 16, 2025

💡 Motivation and Context

Add support for /decide?v=4 (see PostHog/posthog#29751). Similar to how it's done in PostHog/posthog-js-lite#427.

Updates to the $feature_flag_called event

When capturing the $feature_flag_called event, additional information are now captured:

The end result is $feature_flag_called events will have additional properties:

Property Name Descirption
$feature_flag_version The version of the feature flag. This is visible in the diffs of the feature flag activity log.
$feature_flag_reason The reason the feature flag matched or didn't match.
$feature_flag_id The database id of the feature flag (Just in case a flag was deleted and then recreated with the same key, we can determine the difference.
$feature_flag_request_id The id of the /decide request.

Backwards compatibility:

The changes are all backwards compatible with /decide?v=3.

💚 How did you test it?

Unit tests and manual tests.

@haacked haacked requested a review from dmarticus April 16, 2025 19:59
Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

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

this is banging, nice work! Thanks for getting us up to date on this SDK!

@haacked haacked merged commit 3100677 into master Apr 18, 2025
6 checks passed
@haacked haacked deleted the haacked/decide-v4 branch April 18, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants