Comments (4)
Looks like this is by design :(. Not perfect imo.
Here is the code
public async Task<bool> IsEnabledAsync<TContext>(string feature, TContext context)
{
//
// First, check local cache
if (_flagCache.ContainsKey(feature))
{
return _flagCache[feature];
}
bool enabled = await _featureManager.IsEnabledAsync(feature, context).ConfigureAwait(false);
_flagCache[feature] = enabled;
return enabled;
}
from featuremanagement-dotnet.
The IFeatureManagerSnapshot is purposefully naïve when it comes to feature contexts. We would need a way to check for equality between contexts to be able to do anything further, and this would've required every context to implement an interface that we provide. This is not always possible so we decided not to impose this limitation. Our thoughts were that in general, if IFeatureManagerSnapshot would be useful in combination with feature contexts, then the lifetime of the feature manager snapshot would be in line with the lifetime of the feature context.
from featuremanagement-dotnet.
Another option we have is to allow Object.Equals to play the role of establishing context equality. This may solve the problem.
I do want to call out another factor that was considered. Caching an object passed in while evaluating the feature may have unintended consequences since callers might not necessarily be expecting the lifetime of the object to now be tied to the snapshot. It's something we'd want to consider if we did take the approach I just mentioned.
from featuremanagement-dotnet.
Thanks @jimmyca15, I guess that is fair enough. It would be great so see a bit more sophistication in how the manager operates, but I suppose I can live with it the way it is now.
I did experiment with Object.Equals
as I was formulating the linked PR, but it could be costly and since the contexts are not so strictly defined, it could lead to the equality comparisons being open to interpretation by engineers. I proposed a simple solution which just requires contexts to have IDs so that they can be easily compared with no ambiguity to what is actually being compared. Not feeling too strongly about this change, but I'm sure it is going to prove useful to some. I will close the PR as I plan to close this issue as well.
from featuremanagement-dotnet.
Related Issues (20)
- 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
- Bug 4.0.0-preview: NullReferenceException when TargetingContext.UserId is null and TargetingEvaluationOption.IgnoreCase = true
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.