Skip to content
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

feat(go-feature-flag): Support exporter metadata #45

Merged
merged 2 commits into from
Jan 25, 2025

Conversation

thomaspoignant
Copy link
Member

This PR

In this PR we support exporterMetadata that will allow to add static information that will be added to your feature event sent to the GO Feature Flag exporter.

In this PR we add those exporter metadata to the evaluation context in order to pass them to GO Feature Flag relay-proxy.

Related Issues

thomaspoignant/go-feature-flag#2983

Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
@@ -35,6 +35,11 @@ def evaluate(flag_key:, default_value:, allowed_classes:, evaluation_context: ni
evaluation_context = OpenFeature::SDK::EvaluationContext.new if evaluation_context.nil?
validate_parameters(flag_key, evaluation_context)

# enrich the evaluation context with the exporter_metadata
@options.exporter_metadata ||= {}
@options.exporter_metadata.merge!({"openfeature" => true, "provider" => "ruby"})
Copy link
Member Author

Choose a reason for hiding this comment

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

Those are default exporter_metadata values that are added for every evaluation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I need them in the GO Feature Flag server, and since I am using the OFREP API and I have no other fields than the context to add those extra informations.

Copy link
Member Author

@thomaspoignant thomaspoignant Jan 24, 2025

Choose a reason for hiding this comment

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

I could have put it as a header, but the problem is the limit in header size that we may reach.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. That's a clever workaround 😄

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

Why are you adding exporter metadata to the context?

@maxveldink
Copy link
Member

Will give this a review today when I have a chance

Copy link
Member

@maxveldink maxveldink left a comment

Choose a reason for hiding this comment

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

🦑 Just a few small comments, but nothing blocking from me!

Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
@thomaspoignant thomaspoignant merged commit 04754fd into main Jan 25, 2025
11 checks passed
@thomaspoignant thomaspoignant deleted the goff-exporter-metadata branch January 25, 2025 09:04
thomaspoignant pushed a commit that referenced this pull request Jan 27, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.1.3](openfeature-go-feature-flag-provider/v0.1.2...openfeature-go-feature-flag-provider/v0.1.3)
(2025-01-25)


### ✨ New Features

* **go-feature-flag:** Support exporter metadata
([#45](#45))
([04754fd](04754fd))

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

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
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.

3 participants