Skip to content
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

Add RegisterAll API to enable monitoring collections of key-values for refresh #574

Open
wants to merge 45 commits into
base: preview
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a6e3300
WIP
amerjusupovic Apr 3, 2024
15c53fe
WIP testing out client extensions methods
amerjusupovic Apr 4, 2024
75a01eb
WIP added selectors to multikeywatchers
amerjusupovic Apr 5, 2024
f1b07b4
remove unused property
amerjusupovic Apr 5, 2024
25c262c
WIP check for registerall changes to change refreshall
amerjusupovic Apr 9, 2024
302140b
WIP
amerjusupovic Apr 9, 2024
cc1bc58
WIP fixing types and reslving errors
amerjusupovic Apr 10, 2024
28ecc05
WIP fixing client extensions class
amerjusupovic Apr 12, 2024
38ba768
WIP
amerjusupovic Apr 15, 2024
67ec320
Merge branch 'preview' of https://github.com/Azure/AppConfiguration-D…
amerjusupovic Apr 24, 2024
9f4c1de
WIP update feature flag logic
amerjusupovic Apr 24, 2024
937e012
WIP client extensions
amerjusupovic Apr 25, 2024
7e17870
WIP reload all flags on change
amerjusupovic Apr 26, 2024
f4c17ae
WIP
amerjusupovic Apr 29, 2024
65de1cd
WIP fixing tests to return response for getconfigurationsettingsasync
amerjusupovic May 29, 2024
25c477b
WIP etag for tests
amerjusupovic May 31, 2024
913587e
fix watchedcollections null
amerjusupovic Jun 20, 2024
5f84295
WIP tests, working for examples
amerjusupovic Jun 20, 2024
e18a835
remove unused variables
amerjusupovic Jun 20, 2024
d41499e
update to newest sdk version, remove unused
amerjusupovic Jun 20, 2024
85d9909
Merge branch 'preview' of https://github.com/Azure/AppConfiguration-D…
amerjusupovic Jul 1, 2024
d6ac25b
WIP fixing tests
amerjusupovic Jul 1, 2024
5410b5d
WIP reworking testing to work with new etag approach
amerjusupovic Jul 1, 2024
fc752d3
tests passing, fix mockasyncpageable
amerjusupovic Jul 2, 2024
8b02c76
update sdk package version
amerjusupovic Jul 3, 2024
3ebf1e4
fix loghelper, tests
amerjusupovic Jul 3, 2024
26d3391
WIP fixing aspages tests
amerjusupovic Jul 8, 2024
aa037b6
revert watchesfeatureflags test
amerjusupovic Jul 11, 2024
415c577
update test again
amerjusupovic Jul 11, 2024
57f5b80
WIP
amerjusupovic Jul 12, 2024
7ac2cd5
fixing watchconditions
amerjusupovic Jul 12, 2024
bbdac93
Merge branch 'preview' of https://github.com/Azure/AppConfiguration-D…
amerjusupovic Jul 12, 2024
ec9a9da
separate selected key value collections from feature flag collections…
amerjusupovic Jul 15, 2024
e6aadf4
comment and naming updates
amerjusupovic Jul 15, 2024
a122a10
Merge branch 'preview' into ajusupovic/collection-monitoring
amerjusupovic Jul 17, 2024
36f0b80
fixing unit tests, namespace of defining/calling code needs to be same
amerjusupovic Jul 22, 2024
ba8ad5f
Merge branch 'preview' into ajusupovic/collection-monitoring
amerjusupovic Jul 25, 2024
13db869
fixing tests using AsPages
amerjusupovic Jul 25, 2024
d39a767
Merge branch 'ajusupovic/collection-monitoring' of https://github.com…
amerjusupovic Jul 25, 2024
113143a
fix tests with pageablemanager
amerjusupovic Aug 1, 2024
ebae7c9
Merge branch 'preview' of https://github.com/Azure/AppConfiguration-D…
amerjusupovic Aug 1, 2024
05ede06
format
amerjusupovic Aug 1, 2024
e584d6c
fix tests
amerjusupovic Aug 2, 2024
76f369b
fix tests
amerjusupovic Aug 2, 2024
4e0f949
Merge branch 'preview' of https://github.com/Azure/AppConfiguration-D…
amerjusupovic Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ public class AzureAppConfigurationOptions
private static readonly TimeSpan MaxRetryDelay = TimeSpan.FromMinutes(1);

private List<KeyValueWatcher> _changeWatchers = new List<KeyValueWatcher>();
private List<KeyValueWatcher> _multiKeyWatchers = new List<KeyValueWatcher>();
private List<KeyValueWatcher> _featureFlagWatchers = new List<KeyValueWatcher>();
private List<IKeyValueAdapter> _adapters;
private List<Func<ConfigurationSetting, ValueTask<ConfigurationSetting>>> _mappers = new List<Func<ConfigurationSetting, ValueTask<ConfigurationSetting>>>();
private List<KeyValueSelector> _kvSelectors = new List<KeyValueSelector>();
private List<KeyValueSelector> _featureFlagSelectors = new List<KeyValueSelector>();
private IConfigurationRefresher _refresher = new AzureAppConfigurationRefresher();

// The following set is sorted in descending order.
Expand Down Expand Up @@ -66,6 +67,16 @@ public class AzureAppConfigurationOptions
/// </summary>
internal IEnumerable<KeyValueSelector> KeyValueSelectors => _kvSelectors;

/// <summary>
/// A collection of <see cref="KeyValueSelector"/>.
/// </summary>
internal IEnumerable<KeyValueSelector> FeatureFlagSelectors => _featureFlagSelectors;

/// <summary>
/// The configured options for refresh.
/// </summary>
internal AzureAppConfigurationRefreshOptions RefreshOptions { get; private set; } = new AzureAppConfigurationRefreshOptions();

/// <summary>
/// A collection of <see cref="KeyValueWatcher"/>.
/// </summary>
Expand All @@ -74,7 +85,7 @@ public class AzureAppConfigurationOptions
/// <summary>
/// A collection of <see cref="KeyValueWatcher"/>.
/// </summary>
internal IEnumerable<KeyValueWatcher> MultiKeyWatchers => _multiKeyWatchers;
internal IEnumerable<KeyValueWatcher> FeatureFlagWatchers => _featureFlagWatchers;

/// <summary>
/// A collection of <see cref="IKeyValueAdapter"/>.
Expand All @@ -101,6 +112,12 @@ internal IEnumerable<IKeyValueAdapter> Adapters
/// <remarks>This property is used only for unit testing.</remarks>
internal IConfigurationClientManager ClientManager { get; set; }

/// <summary>
/// An optional class used to process pageable results from Azure App Configuration.
/// </summary>
/// <remarks>This property is only set outside of this class if it's used for unit testing.</remarks>
internal ConfigurationSettingPageableManager PageableManager { get; set; } = new ConfigurationSettingPageableManager();

/// <summary>
/// An optional timespan value to set the minimum backoff duration to a value other than the default.
/// </summary>
Expand Down Expand Up @@ -212,7 +229,7 @@ public AzureAppConfigurationOptions SelectSnapshot(string name)
/// <summary>
/// Configures options for Azure App Configuration feature flags that will be parsed and transformed into feature management configuration.
/// If no filtering is specified via the <see cref="FeatureFlagOptions"/> then all feature flags with no label are loaded.
/// All loaded feature flags will be automatically registered for refresh on an individual flag level.
/// All loaded feature flags will be automatically registered for refresh as a collection.
/// </summary>
/// <param name="configure">A callback used to configure feature flag options.</param>
public AzureAppConfigurationOptions UseFeatureFlags(Action<FeatureFlagOptions> configure = null)
Expand Down Expand Up @@ -246,16 +263,19 @@ public AzureAppConfigurationOptions UseFeatureFlags(Action<FeatureFlagOptions> c
var featureFlagFilter = featureFlagSelector.KeyFilter;
var labelFilter = featureFlagSelector.LabelFilter;

Select(featureFlagFilter, labelFilter);
_featureFlagSelectors.AppendUnique(new KeyValueSelector
{
KeyFilter = featureFlagFilter,
LabelFilter = labelFilter
});

_multiKeyWatchers.AppendUnique(new KeyValueWatcher
_featureFlagWatchers.AppendUnique(new KeyValueWatcher
{
Key = featureFlagFilter,
Label = labelFilter,
// If UseFeatureFlags is called multiple times for the same key and label filters, last refresh interval wins
RefreshInterval = options.RefreshInterval
});

}

return this;
Expand Down Expand Up @@ -390,6 +410,8 @@ public AzureAppConfigurationOptions ConfigureRefresh(Action<AzureAppConfiguratio
_changeWatchers.Add(item);
}

RefreshOptions = refreshOptions;

return this;
}

Expand Down
Loading
Loading