-
Notifications
You must be signed in to change notification settings - Fork 0
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
Better example? #24
Comments
Hey @HenrikDK 👋 Thanks for raising the issue and apologies for the lack of clarity in our docs. We lack any C# experience on the Flipt team, so could do with any and all help in getting something correct together. I've just taken a stab at an alternative, which is more inline with our Python example you linked here. using Grpc.Net.Client;
using Flipt;
namespace dotnetexperiment;
class Program
{
static void Main(string[] args)
{
var channel = GrpcChannel.ForAddress("http://localhost:9000");
var client = new Flipt.Evaluation.EvaluationService.EvaluationServiceClient(channel);
var request = new Flipt.Evaluation.EvaluationRequest {
NamespaceKey = "default",
FlagKey = "flag",
EntityId = "entity",
};
request.Context.Add("fizz", "buzz");
System.Console.WriteLine(client.Variant(request));
}
} I tested it locally and it evaluated as expected. If you think it fits the bill, I can get the docs and example updated. |
That looks better, much clearer :) 👍 from here. It could also be an idea to very explicitly illustrate usage in application code, ie how you fork your code based on a usage flag: Something like this. using Grpc.Net.Client;
using Flipt;
var channel = GrpcChannel.ForAddress("http://localhost:9000");
var flipt= new Flipt.Evaluation.EvaluationService.EvaluationServiceClient(channel);
var newHotFeature = new Flipt.Evaluation.EvaluationRequest {
NamespaceKey = "default",
FlagKey = "NewHotFeature",
EntityId = "entity",
};
newHotFeature.Context.Add("fizz", "buzz");
if(flipt.Variant(newHotFeature).Match)
{
//new code
}
else
{
//old code
} While not quite as elegant as other feature toggle solutions out there, it's not unworkable :) |
Thanks for the feedback and for raising this issue @HenrikDK 🙌🏻 We will update the readme now! Re @GeorgeMac 's comment:
If you can help contribute a REST evaluation SDK or potentially help us get started that would be amazing! As we have done very little C# dev on the team and would want someone with greater C# expertise to make it idiomatic |
Supports #24 Update the README to focus the illustration on how to evaluation a feature flag.
Supports #24 Update the basic example in line withe the README update. This centers the example around evaluation, instead of listing flags.
Hi
I'm evaluating using Flipt.io for use with my C# apps, while im somewhat dissapointed that a C# sdk didn't get first billing like python or java. I'm glad to see that a Grpc SDK is underway :)
I am confused by the example provided though:
It hard to get an idea of how the client works in a real usecase, as a typical client isn't interested in listing all flags and iterating through them?
Normally you would evaluate a specific flag that you address by name, and maybe provide other variables.
I had expected an example like the python one here https://github.com/flipt-io/flipt-server-sdks/tree/main/flipt-python
The text was updated successfully, but these errors were encountered: