Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c2e18d7
Adding allocation id
rossgrambo Oct 18, 2024
1c2c525
serialize with sorted keys
SamSadfa Oct 21, 2024
cb4e615
use string empty
SamSadfa Oct 21, 2024
49ef1fc
nit
SamSadfa Oct 21, 2024
86fde17
rename ff id to TelemetryVariantPercentile
SamSadfa Oct 21, 2024
c191d7f
add more values
SamSadfa Oct 21, 2024
603cd0f
dotnet format
SamSadfa Oct 21, 2024
35386d0
Version bump
rossgrambo Oct 23, 2024
51d4ad7
Merge pull request #600 from Azure/rossgrambo/allocation_id
samsadsam Oct 23, 2024
0619626
Merge branch 'preview' into rossgrambo/merge-main-to-preview
rossgrambo Oct 23, 2024
9216437
Merge pull request #604 from Azure/rossgrambo/merge-main-to-preview
rossgrambo Oct 23, 2024
dbadbb9
Merge branch 'preview' into rossgrambo/version-bump-8.1.0-preview
rossgrambo Oct 23, 2024
4b5e523
Merge pull request #603 from Azure/rossgrambo/version-bump-8.1.0-preview
rossgrambo Oct 23, 2024
5e6a012
Add `RegisterAll` API to enable monitoring collections of key-values …
amerjusupovic Jan 22, 2025
6dc9ae2
Give the users the ability to have control over ConfigurationClient i…
amerjusupovic Feb 6, 2025
68f4b8f
first draft tag filtering support
amerjusupovic Feb 28, 2025
3b12ee4
add alternate APIs
amerjusupovic Feb 28, 2025
7bdb2d0
change to use ienumerable
amerjusupovic Mar 6, 2025
0cfdec6
update featureflagoptions to match main options
amerjusupovic Mar 6, 2025
acc131f
update keyvalueselector equals and hashcode
amerjusupovic Mar 6, 2025
6d6f9d3
update param comments for selects
amerjusupovic Mar 11, 2025
6da33d2
merge with conflicts
samsadsam Mar 12, 2025
4ab2dda
fix merge conflict errors
samsadsam Mar 12, 2025
8745c9d
add validation for tagsfilter param, add to comment
amerjusupovic Mar 17, 2025
f0724cd
edit error message for format
amerjusupovic Mar 17, 2025
6b0aaa4
edit comment
amerjusupovic Mar 18, 2025
c243aa8
add unit tests
amerjusupovic Mar 18, 2025
b50529e
remove unused file
amerjusupovic Mar 18, 2025
d5dc83d
Merge branch 'main' into user/samisadfa/merge-main-to-preview
samsadsam Mar 18, 2025
c2e3558
revert versions
samsadsam Mar 18, 2025
a7e3a69
update tests to include feature flag select
amerjusupovic Mar 18, 2025
258452d
merge with main
samsadsam Mar 18, 2025
959d7af
add refresh test
amerjusupovic Mar 18, 2025
1fc066b
ff only refresh test
amerjusupovic Mar 18, 2025
d8a421a
update equals for selector
amerjusupovic Mar 18, 2025
eee46a4
fix equals
amerjusupovic Mar 18, 2025
da49c32
update equals
amerjusupovic Mar 18, 2025
c3168a9
reorder properties in keyvalueselector
amerjusupovic Mar 18, 2025
573320e
Merge pull request #636 from Azure/user/samisadfa/merge-main-to-preview
samsadsam Mar 18, 2025
d7f5939
upgrade to 8.2.0-preview (#638)
samsadsam Mar 18, 2025
54c8a44
fix incorrect test
amerjusupovic Mar 18, 2025
91afa79
Merge branch 'preview' of https://github.com/Azure/AppConfiguration-D…
amerjusupovic Mar 18, 2025
7661b2c
fix equals for selector
amerjusupovic Mar 18, 2025
d108f64
update gethashcode for keyvalueselector
amerjusupovic Mar 20, 2025
f2191df
PR comments, in progress
amerjusupovic Mar 25, 2025
7387e28
update tests from PR comments
amerjusupovic Mar 25, 2025
17c6562
add validation for number of tags, add test
amerjusupovic Mar 26, 2025
e1930cd
rename tagsFilter to tagsFilters everywhere
amerjusupovic Apr 1, 2025
a3be952
fix usings, missing updates to ffoptions
amerjusupovic Apr 1, 2025
48be704
update ffoptions select again
amerjusupovic Apr 1, 2025
6b2e2a4
fix tests
amerjusupovic Apr 1, 2025
d3d9261
update sdk version
amerjusupovic Apr 2, 2025
76f73ea
update tagsfilters to tagfilters
amerjusupovic Apr 7, 2025
7ca2704
remove tagsfilters again
amerjusupovic Apr 7, 2025
9ac1ea1
PR comments
amerjusupovic Apr 15, 2025
4397a8e
PR comments
amerjusupovic Apr 17, 2025
d294da4
Merge branch 'main' of https://github.com/Azure/AppConfiguration-Dotn…
amerjusupovic Apr 24, 2025
d592329
Revert "Merge pull request #600 from Azure/rossgrambo/allocation_id"
amerjusupovic Apr 24, 2025
c465dda
Revert "Give the users the ability to have control over Configuration…
amerjusupovic Apr 24, 2025
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ await ExecuteWithFailOverPolicyAsync(clients, async (client) =>
{
KeyFilter = watcher.Key,
LabelFilter = watcher.Label,
TagFilters = watcher.Tags,
IsFeatureFlagSelector = true
}),
_ffEtags,
Expand Down Expand Up @@ -828,6 +829,14 @@ private async Task<Dictionary<string, ConfigurationSetting>> LoadSelected(
LabelFilter = loadOption.LabelFilter
};

if (loadOption.TagFilters != null)
{
foreach (string tagFilter in loadOption.TagFilters)
{
selector.TagsFilter.Add(tagFilter);
}
}

var matchConditions = new List<MatchConditions>();

await CallWithRequestTracing(async () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ public FeatureFlagOptions SetRefreshInterval(TimeSpan refreshInterval)
/// The label filter to apply when querying Azure App Configuration for feature flags. By default the null label will be used. Built-in label filter options: <see cref="LabelFilter"/>
/// The characters asterisk (*) and comma (,) are not supported. Backslash (\) character is reserved and must be escaped using another backslash (\).
/// </param>
public FeatureFlagOptions Select(string featureFlagFilter, string labelFilter = LabelFilter.Null)
/// <param name="tagFilters">
/// In addition to key and label filters, feature flags from Azure App Configuration can be filtered based on their tag names and values.
/// Each tag filter must follow the format "tagName=tagValue". Only those feature flags will be loaded whose tags match all the tags provided here.
/// Built in tag filter values: <see cref="TagValue"/>. For example, $"tagName={<see cref="TagValue.Null"/>}".
/// The characters asterisk (*), comma (,) and backslash (\) are reserved and must be escaped using a backslash (\).
/// Up to 5 tag filters can be provided. If no tag filters are provided, feature flags will not be filtered based on tags.
/// </param>
public FeatureFlagOptions Select(string featureFlagFilter, string labelFilter = LabelFilter.Null, IEnumerable<string> tagFilters = null)
{
if (string.IsNullOrEmpty(featureFlagFilter))
{
Expand All @@ -97,12 +104,24 @@ public FeatureFlagOptions Select(string featureFlagFilter, string labelFilter =
throw new ArgumentException("The characters '*' and ',' are not supported in label filters.", nameof(labelFilter));
}

if (tagFilters != null)
{
foreach (string tag in tagFilters)
{
if (string.IsNullOrEmpty(tag) || !tag.Contains('=') || tag.IndexOf('=') == 0)
{
throw new ArgumentException($"Tag filter '{tag}' does not follow the format \"tagName=tagValue\".", nameof(tagFilters));
}
}
}

string featureFlagPrefix = FeatureManagementConstants.FeatureFlagMarker + featureFlagFilter;

FeatureFlagSelectors.AppendUnique(new KeyValueSelector
{
KeyFilter = featureFlagPrefix,
LabelFilter = labelFilter,
TagFilters = tagFilters,
IsFeatureFlagSelector = true
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Data.AppConfiguration" Version="1.4.1" />
<PackageReference Include="Azure.Data.AppConfiguration" Version="1.6.0" />
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.7.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageReference Include="DnsClient" Version="1.7.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.6" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
using System;
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Models
{
/// <summary>
Expand All @@ -24,6 +28,11 @@ public class KeyValueSelector
/// </summary>
public string SnapshotName { get; set; }

/// <summary>
/// A filter that determines what tags to require when selecting key-values for the the configuration provider.
/// </summary>
public IEnumerable<string> TagFilters { get; set; }

/// <summary>
/// A boolean that signifies whether this selector is intended to select feature flags.
/// </summary>
Expand All @@ -40,7 +49,11 @@ public override bool Equals(object obj)
{
return KeyFilter == selector.KeyFilter
&& LabelFilter == selector.LabelFilter
&& SnapshotName == selector.SnapshotName;
&& SnapshotName == selector.SnapshotName
&& (TagFilters == null
? selector.TagFilters == null
: selector.TagFilters != null && new HashSet<string>(TagFilters).SetEquals(selector.TagFilters))
&& IsFeatureFlagSelector == selector.IsFeatureFlagSelector;
}

return false;
Expand All @@ -52,9 +65,22 @@ public override bool Equals(object obj)
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return (KeyFilter?.GetHashCode() ?? 0) ^
(LabelFilter?.GetHashCode() ?? 1) ^
(SnapshotName?.GetHashCode() ?? 2);
string tagFiltersString = string.Empty;

if (TagFilters != null && TagFilters.Any())
{
var sortedTags = new SortedSet<string>(TagFilters);

// Concatenate tags into a single string with a delimiter
tagFiltersString = string.Join("\n", sortedTags);
}

return HashCode.Combine(
KeyFilter,
LabelFilter,
SnapshotName,
tagFiltersString,
IsFeatureFlagSelector);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
using Microsoft.Extensions.Configuration.AzureAppConfiguration.Extensions;
using System;
using System.Collections.Generic;

namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Models
{
Expand All @@ -18,6 +19,11 @@ internal class KeyValueWatcher
/// </summary>
public string Label { get; set; }

/// <summary>
/// Tags of the key-value to be watched.
/// </summary>
public IEnumerable<string> Tags { get; set; }

/// <summary>
/// A flag to refresh all key-values.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
namespace Microsoft.Extensions.Configuration.AzureAppConfiguration
{
/// <summary>
/// Defines well known tag values that are used within Azure App Configuration.
/// </summary>
public class TagValue
{
/// <summary>
/// Matches null tag values.
/// </summary>
public const string Null = "\0";
}
}
Loading