Comments (4)
Closing this for now.
from featuremanagement-dotnet.
Hello @pregoli ,
For console apps (and Azure Functions), I believe the only way to refresh is to explicitly call TryRefreshAsync. See the Azure Functions Guide for an example.
I'll continue to look into this, because it's not clear to me why the refresh is restricted in this way.
from featuremanagement-dotnet.
Thanks for your reply @rossgrambo but I think refreshing explicitely is not the way We or The consumers of this library aim to go. You could end up refreshing on a schedule way even when there's no need to refresh it because no changes happened on FFs values.
I think the current behavior is due to the refresh/trigger is happening within the ASP.Net pipeline middleware while in the backgroundservice is not.
Please keep us in the loop.
Thanks!
from featuremanagement-dotnet.
After syncing with some other members, I see now why it's built the way it is. Here's a summary of it, only a couple parts might be of interest to you.
The library that handles dynamic configurations (.AddAzureAppConfiguration()
) is our Provider Library.
This library reads from our server, and places it into Configuration for the app. Configuration is a part of .NET and can be thought of as a dictionary for traversing json-like data.
Configuration doesn't have a hook we could add a refresh check in, so when refreshing was built it used a timer approach and would update the config in a scheduled way. As you called out, this led to a bunch of refreshes for no reason. This was especially bad for stale apps, that continued to ping us without users or purpose.
The timer was replaced with a middleware. The middleware is setup via UseAzureAppConfiguration()
where it adds AzureAppConfigurationRefreshMiddleware to be invoked during http requests. To refresh, TryRefreshAsync
is called as an http request comes in. TryRefreshAsync
does nothing if we're still within the cache expiration interval, otherwise it checks for a refresh. This means it's safe to call it multiple times.
Console apps don't have a consistent workflow we can add a hook to in the same way. So the current state is to leave it to the developer to trigger the refresh appropriately. Allowing a flag to change mid-execution might not make sense for some apps.
Here's a guide for now to setup refreshing for a .NET Core app: https://learn.microsoft.com/en-us/azure/azure-app-configuration/enable-dynamic-configuration-dotnet-core?tabs=core6x
All of that to say, I think you should add TryRefreshAsync()
above your IsEnabledAsync()
check. Because it's ignored when the cache hasn't expired, it should be safe to do. Alternatively, you could write a helper method that does the refresh and IsEnabled call.
I could see a world where we add a TryRefreshAsync
onto calls to IsEnabledAsync
as a part of FeatureManagement. This would add a dependency between FeatureManagement and the Provider which hasn't existed, and there are other concerns like flag flipping mid execution. Currently there's a clear separation of the libraries: FeatureManagement just reads from the Configuration, while the Provider manages updating the Configuration.
from featuremanagement-dotnet.
Related Issues (20)
- Suggest to have app.UseFeatureManagement HOT 8
- Silent failure in TargetingTelemetryInitializer HOT 10
- The TargetingId should be included in the FeatureEvaluation event even if it's null/empty. HOT 5
- Targeting evaluation is CPU dependent. HOT 4
- Remove the support for variants and telemetry from the .NET feature flag schema HOT 14
- Include Targeting Information on outgoing telemetry HOT 2
- Support .NET 8 Targeting framework in Microsoft.FeatureManagement.Telemetry.ApplicationInsights.AspNetCore
- Target netstandard2.* in Microsoft.FeatureManagement.Telemetry.ApplicationInsights
- The approach to telemetry (using custom `ITelemetryPublisher`) seems overengineered and counter to modern OpenTelemetry abstractions HOT 37
- Add Default Http Targeting Context Accessor
- Consider moving `TargetingHttpContextMiddleware` to the App Insights package HOT 2
- No instance of ITargetingContextAccessor is available for variant assignment. HOT 6
- FeatureManagerSnapshot should snapshot TargetingContext as well
- EvaluationDataToApplicationInsights example
- Can't Set FeatureFilters In FeatureManager In .NET Framework Application HOT 10
- Update Package metadata
- Add a link to preview on main readme HOT 1
- Cannot use the TargetingFilter in .NET class library project HOT 3
- Nuget "Microsoft.FeatureManagement.AspNetCore" Version 3.3.0 - Multiple feature filters match the configured filter named 'Microsoft.TimeWindow' HOT 8
- Consider using `TimeProvider` using Microsoft.Bcl.TimeProvider nuget package HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from featuremanagement-dotnet.