Git Product home page Git Product logo

Comments (10)

jimmyca15 avatar jimmyca15 commented on June 8, 2024

I put together a .NET 6 app using the code you provided, and it works for me.

Are you using any label for your feature flags?

from featuremanagement-dotnet.

Vincentvwal avatar Vincentvwal commented on June 8, 2024

Yes we are using Labels.
When adding a feature flag without a label and using LabelFilter.Null this works on an key which has no label.

However, as the code above has a label, this does not work.

from featuremanagement-dotnet.

zhenlan avatar zhenlan commented on June 8, 2024

@Vincentvwal does the "Tip" in step 2 of the doc below help?

https://learn.microsoft.com/en-us/azure/azure-app-configuration/quickstart-feature-flag-aspnet-core?tabs=core6x#use-a-feature-flag

from featuremanagement-dotnet.

GWJYonder avatar GWJYonder commented on June 8, 2024

I am seeing the same behavior where the flags work as expected, except that the cache never updates to see changes occurring. Is this possibly because in my Dev environment I am using a Free version of Azure App Configuration rather than a paid one? Does it disallow updates so that the 1000 daily requests aren't used too quickly?

Edit: I realized that I could simply point to the prod App Configuration really quickly, that did not resolve the issue. If it matters I have not updated to .Net 6 yet, but given that the original poster was seeing it in 6 that may not be pertinent.

from featuremanagement-dotnet.

Vincentvwal avatar Vincentvwal commented on June 8, 2024

@zhenlan while the tip did not really help, i did notice something in step 2 itself.
When using the feature flags as follows it does not refresh them

options.Connect("connectionstring")
		.UseFeatureFlags(options => {
			options.CacheExpirationInterval = TimeSpan.FromSeconds(5);
		});

However, when doing it as follows it works

options.Connect("connectionstring")
		.UseFeatureFlags(options => {
			options.CacheExpirationInterval = TimeSpan.FromSeconds(5);
			options.Select(KeyFilter.Any, "testlabel");
		});

The key in this is the select filter in the UseFeatureFlags.
It will only refresh the keys if there is a keyselector in place.
If there is none, it will select the keys initially but never update them even when forcing it or changing the CacheExpirationInterval.
I don't know if this is indented behaviour?

@GWJYonder i'm guessing this is also your issue.
We are testing on the free tier as well.

from featuremanagement-dotnet.

GWJYonder avatar GWJYonder commented on June 8, 2024

Unfortunately that hasn't resolved my issue. At this point I have tried pretty much every combination I can think of:

  • Just UseFeatureFlags with no options (which I believe should have been enough for a 30 second refresh of all of the keys with no labels).
  • Setting just the CacheExpirationInterval
    • 5 seconds and 30 seconds
  • Solely performing the Select
  • Performing both
    • In each order because why not
    • as separate lines and chained together because why not
  • Gave all of my Feature Flags labels and filtered on the label.
  • Added in a RefreshOptions call even though we aren't using key-value configurations, just Feature Flags

In all scenarios the service connected to App Configuration and got the initial values, but never updated after that.

from featuremanagement-dotnet.

Vincentvwal avatar Vincentvwal commented on June 8, 2024

@GWJYonder
The following example is fully working:
https://gist.github.com/Vincentvwal/de817710c816866ad481f5a5bc82ba58

The feature was created as follows
image

from featuremanagement-dotnet.

GWJYonder avatar GWJYonder commented on June 8, 2024

Thanks, that helped me resolve it. My Startup.Configure call looked like this:

       public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider)
        {
            app.UseAzureAppConfiguration();

            CurrentEnvironment = env;
            if (env.IsDevelopment())
            {...}

            app.UseRouting();
            app.UseCors();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
            app.UseCorrelationId();
        }

I moved app.UseAzureAppConfiguration(); from the bottom of that method to the top and that resolved the issue. When I first added it in I was honestly a bit surprised it worked so low, but it did. I was not expecting partial functionality where the initial handshake and providers would work, and only the refreshes would fail.

Thanks for your help.

from featuremanagement-dotnet.

zhenlan avatar zhenlan commented on June 8, 2024

@Vincentvwal @GWJYonder glad it worked for you.

Just to answer/clarify a few questions along the way of this thread

  • The dynamic configuration and feature flags work with the free tier Azure App Configuration.
  • The UseFeatureFlags loads all feature flags with no labels by default. When labels are used, make sure you call FeatureFlagOptions.Select to specify the label.
  • Azure App Configuration middleware refreshes the configuration and feature flags. To ensure the middleware is triggered, call the app.UseAzureAppConfiguration() method as early as appropriate in your request pipeline so another middleware won't bypass it in your app. To learn more, see Request-driven configuration refresh.

from featuremanagement-dotnet.

jimmyca15 avatar jimmyca15 commented on June 8, 2024

Looks like everything in this thread has been resolved. Closing.

from featuremanagement-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.