November 3, 2022 — 6 min read
Announcing the Flipt OpenFeature Provider for Go
OpenFeature provides a unified API and SDK, and a developer-first, cloud-native implementation, with extensibility for open source and commercial offerings.
In short, OpenFeature provides a specification and implementation of a unified API to query and evaluate feature flags which abstract away the specific details of the backend responsible for storing and managing the flags themselves.
This allows the developers who are adding feature flags in their applications to use the OpenFeature SDK in their code and then register their feature flag management solution of choice as the 'provider', abstracting it away. The benefits of this are twofold:
- It guards against 'vendor lock-in' which would require a large code refactor if a team were to decide to switch from one feature flag solution to another down the road.
- It allows for common functionality to be shared and maintained by the community, which reduces the amount of duplication required as well as generally increases the quality and velocity of development. More on this later.
Before we get into more details of how OpenFeature works, it's important to define the key terminology and develop a shared model.
As mentioned above, OpenFeature has defined a specification that serves as a guide for how to think about OpenFeature from an end user perspective as well as how to implement a vendor specific library that OpenFeature can integrate with.
The specification defines 'providers' as the adaptive layer that translates to and from feature flag solutions, such as Flipt and other open source and commercial solutions. It's up to the community or the feature flag vendors/projects themselves to build these providers that conform to the OpenFeature Provider specification.
The Evaluation API is the primary interface to access and interact with feature flags in the OpenFeature ecosystem. The OpenFeature Evaluation API allows you to query feature flags given a
flagKey, default value, as well as an optional evaluation context. The evaluation context allows for the feature flag solution (provider) to make decisions based on configured rules, for example end-user targeting or percentage-based rollouts.
This maps nicely to how we think about evaluation at Flipt, where the integrator can provide as much or as little information as they need to make a decision for the purpose of flag evaluation.
Today we are happy to announce that we've open sourced the initial version of the OpenFeature Go Provider for Flipt! It supports both HTTP(s) and GRPC transports to connect to your Flipt instance and is highly configurable allowing you to bring your own HTTP or GRPC clients.
To ensure that we conform to the OpenFeature Provider specification, we even decided to pull in OpenFeature's own integration test suite into the repository. This move actually helped us find several bugs in our implementation, while exercising it as an end-user would.
To see our provider in action, checkout the example in our main repository which shows how to integrate OpenFeature + our provider into an example REST API project. Stay tuned for updated documentation, more examples, and future providers written in other languages. Also, if you are itching to write your own provider for Flipt in your language of choice, feel free to reach out in our Discord, we'd love to help!
Before wrapping up, I'd like to quickly go over one of what we think is the most powerful features of OpenFeature, the Hooks API. Hooks allow you to use a common API for performing actions at different stages of the evaluation lifecycle. By implementing Hooks that use the OpenFeature data model, the community can take advantage of shared implementations, preventing the need for duplicating effort for each provider. Some of the use cases for hooks include things like adding metrics and telemetry, request retries and circuit breaking, performing validation on data, and performing client side caching.
The OpenFeature team has released their own OpenTelemetry Hook for Go, allowing any integrator of the Go SDK to get OpenTelemetry traces with the evaluated feature flag data for free. In our example application for integrating the Flipt OpenFeature provider we wired up the OpenTelemetry hook with a few lines of code, resulting in some cool visualizations of our feature flag data:
We are looking forward to seeing what the community comes up with by leveraging hooks to provide common functionality for all implementers of the OpenFeature SDKs!
We love feature flags here at Flipt and think that we have just started to scratch the surface of what can be accomplished with their use in the software development lifecycle. With the introduction of the OpenFeature project, we hope that teams can begin to realize the full potential of feature flags in a way that is easy to implement and use. We're also very excited to see how the OpenFeature project evolves in regards to the CloudNative space, something we're also particularly interested in here at Flipt.
If you have any feedback on our provider, want us to prioritize specific language support, or just to learn more about how Flipt can help your organization get started with feature flags, please reach out either by joining our Discord or send us an email at firstname.lastname@example.org.