-
Notifications
You must be signed in to change notification settings - Fork 32
feat: Adding OpenFeature provider for AWS AppConfig #310
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
base: main
Are you sure you want to change the base?
feat: Adding OpenFeature provider for AWS AppConfig #310
Conversation
86985c4
to
bf18ec7
Compare
…feature#302) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
ab70ff4
to
253c92d
Compare
Hey @wani-guanxi, sorry for the delay. I'll try and provide feedback in the next few days. |
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
…uteValue format, as supported by AWS app config. Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
… values Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
…o be supplied at the time of setup Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
… in cache Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Missed updating comments over the course of changes. Fixing that. Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
Signed-off-by: Ash.Wani <149169001+wani-guanxi@users.noreply.github.com>
ff6a6ae
to
c31db95
Compare
Sorry @wani-guanxi, this fell off my radar for a while. I'll try and take a look by the end of the week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. Just added a couple of comments and suggestions.
1-I noticed there is no try-catch
in the entire evaluation and there are a couple of potential exceptions that can happen. Could you please double check if there is no exception being thrown in the evaluation methods?
2-Please make sure to fully use Cancellation Tokens.
3-Check if all the classes need to be exposed and also seal them.
string pattern = @"^[^:]+:[^:]+(:[^:]+)?$"; | ||
var match = Regex.IsMatch(key, pattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please investigate using Source Generators for the Regex?
if (string.IsNullOrEmpty(applicationName)) | ||
throw new ArgumentNullException(nameof(applicationName)); | ||
|
||
if (string.IsNullOrEmpty(environmentName)) | ||
throw new ArgumentNullException(nameof(environmentName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it makes sense to throw ProviderFatalException
or other provider related exception.
if(structuredValues == null) return defaultValue; | ||
|
||
return structuredValues.TryGetValue(appConfigKey.AttributeKey, out var returnValue) ? returnValue : defaultValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return extra information (Flag not Found) in case we are resolving using the default flag.
/// <exception cref="AmazonAppConfigDataException">Thrown when there is an error retrieving the configuration from AWS AppConfig.</exception> | ||
private async Task<string> GetFeatureFlagsResponseJson(string configurationProfileId, EvaluationContext context = null) | ||
{ | ||
var response = await GetFeatureFlagsStreamAsync(configurationProfileId, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make use of the cancellation token here?
ConfigurationProfileIdentifier = configurationProfileId | ||
}; | ||
|
||
return await _appConfigRetrievalApi.GetLatestConfigurationAsync(profile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use cancellation token here?
/// <remarks> | ||
/// This method ensures proper cleanup of the memory cache when the instance is disposed. | ||
/// </remarks> | ||
public void Dispose() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot see any IDisposable
interface. Is it part of the IRetrievalApi
?
/// 4. DateTime | ||
/// 5. String (default fallback) | ||
/// </remarks> | ||
public static class FeatureFlagParser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be private?
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0;net7.0;net6.0;</TargetFrameworks> | ||
<LangVersion>7.3</LangVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line please.
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0;net7.0;net6.0;</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove net7.0
and net6.0
. Add net9.0
please
<ItemGroup> | ||
<PackageReference Include="AWSSDK.AppCOnfigData" Version="3.7.400.81" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.1" /> | ||
<PackageReference Include="Moq" Version="4.20.72" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use NSubstitute
instead.
This PR
Adding new project for AWS AppConfig provider implementation for OpenFeature. This allows to manage feature flags using AWS AppConfig.
Notes
Additional details about the package is in Readme file.
Follow-up Tasks
How to test
Testing instructions are available in Readme file under Setup section. Thing to note, this will require AWS account to generate access key and ID in order to talk to AWS AppConfig.