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: add Flipt provider #178

Closed

Conversation

dmitryrogov
Copy link

This PR

Adding Flipt provider integration.

How to test

Run Flipt feature server locally

docker run -d  -p 8080:8080  -p 9000:9000 -v $HOME/flipt:/var/opt/flipt docker.flipt.io/flipt/flipt:latest

@beeme1mr
Copy link
Member

Hey @dmitryrogov, thanks for the PR. @toddbaert, @askpt, or @markphelps could someone please review this PR?

Copy link

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

thank you for taking this on @dmitryrogov !!

/* Or create config directly:
var config = new FliptProviderConfiguration
{
ServiceUri = new Uri("http://localhost:9000"),

Choose a reason for hiding this comment

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

I think we'll want to support authentication as well, likely with some helpers that can add either clientToken authentication (https://docs.flipt.io/authentication/using-tokens) or JWT authentication (https://docs.flipt.io/authentication/using-jwts)

The only difference really is the value of the Authorization header that is sent to Flipt:

  • Client Token: Authentication: Bearer {token}
  • JWT: Authentication: JWT {token}

Choose a reason for hiding this comment

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

also support for our authentication methods still needs to be added @dmitryrogov

{
_configuration = configuration;
var channel = GrpcChannel.ForAddress(configuration.ServiceUri);
_client = new EvaluationServiceClient(channel);

Choose a reason for hiding this comment

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

we may want to think about making a HTTP client and making that the default as GRPC requires HTTP2 and might not work in all environments.

I realize making an HTTP C# client for Flipt is not a small undertaking though, we've had this issue open for a bit in our server-side SDK monorepo: flipt-io/flipt-server-sdks#86

Copy link
Author

Choose a reason for hiding this comment

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

That's true. It would be great to use a client interface instead of the implementation itself (GRPC client SDK, HTTP client SDK or server SDK), but the library doesn't support that at the moment.
For now I can I suggest either modifying the repository flipt-grpc-dotnet by adding a GRPC client interface, or making this constructor public

Choose a reason for hiding this comment

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

Yeah we actually do something similar in our Go Open Feature provider, which supports both GRPC and HTTP

There its all based on the protocol in the address / URL string for which transport to use: https://github.com/open-feature/go-sdk-contrib/tree/main/providers/flipt#configuration

https://github.com/open-feature/go-sdk-contrib/blob/main/providers/flipt/pkg/service/transport/service.go#L152

We could do something similar here, where at first we would only support the GRPC transport like you have done, but once we ideally have a C# REST/HTTP SDK then we can add support here in a non-breaking way, by checking the protocol.

Choose a reason for hiding this comment

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

I think this still needs addressing @dmitryrogov

@dmitryrogov dmitryrogov requested a review from a team as a code owner April 30, 2024 13:17
@toddbaert
Copy link
Member

Sorry I've been slow on this one. I'll get to it first thing Monday.

@@ -0,0 +1 @@
0.0.1
Copy link
Member

Choose a reason for hiding this comment

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

Also add an entry in the release-plz-manifest with a version number matching this, or it will release the first version as 1.0.0.

Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

Sorry this took so long, this looks good to me, and I really tried to find something wrong. If @markphelps has no objections I'm OK with merging. We can also add it to the ecosystem.

One important note about this, though.

Copy link

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

i think theres still a few items that could use some 👀 before merging

/* Or create config directly:
var config = new FliptProviderConfiguration
{
ServiceUri = new Uri("http://localhost:9000"),

Choose a reason for hiding this comment

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

also support for our authentication methods still needs to be added @dmitryrogov

{
_configuration = configuration;
var channel = GrpcChannel.ForAddress(configuration.ServiceUri);
_client = new EvaluationServiceClient(channel);

Choose a reason for hiding this comment

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

I think this still needs addressing @dmitryrogov

```

## Boolean flag evaluation
To perform Boolean flag evaluation, such as `GetBooleanValue` or `GetBooleanDetail` you can utilize [Boolean Evaluation](https://docs.flipt.io/reference/evaluation/boolean-evaluation) or [Variant Evaluation](https://docs.flipt.io/reference/evaluation/variant-evaluation) APIs.

Choose a reason for hiding this comment

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

this seems a bit odd, wouldnt we want to rely on boolean flags always for GetBooleanX calls ?

@beeme1mr
Copy link
Member

Closing in favor of #178

@beeme1mr beeme1mr closed this Oct 17, 2024
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.

8 participants