Azure / AppConfiguration-DotnetProvider

The .NET Standard configuration provider for Azure App Configuration
https://github.com/Azure/AppConfiguration
MIT License
80 stars 37 forks source link

Allow for alternative Prefix Trimming order #573

Open spencerr opened 1 month ago

spencerr commented 1 month ago

The current implementation of prefix trimming is backed by a SortedSet, removing the ability to trim prefixes in a specific order specified by the user.

I currently use a single App Configuration instance to serve configurations for multiple applications. The UI experience is not the best for displaying groups configurations by Label, so I utilize a prefix of {app-name}/ or shared/ and such to group these configurations and display in the hierarchy view. The downfall of this is when I need to trim the prefixes for when an app specifically overrides one of the shared values, I am unable to because of the automatic ordering of the SortedSet.

zhiyuanliang-ms commented 1 month ago

Hi, @spencerr IMO, label should be used for the scenario that you have different sets of configuration for different applications. Label should be used to group configurations.

The downfall of this is when I need to trim the prefixes for when an app specifically overrides one of the shared values, I am unable to because of the automatic ordering of the SortedSet.

I am digesting the issue. Does the following scenario match your issue?

You have App/Key1, Shared/Key1 and App/Key2 you want your App to use the value of App/Key1 and App/Key2. However, the Shared/Key1 will override the App/Key1 if you trimed the prefixes because "Shared/" place after "App/" in order.

The UI experience is not the best for displaying groups configurations by Label

May I ask what pain point you are experiencing now when you are using our Portal UI? If we are willing to make some improvement to portal UI, would you like to use label to group configuration?

Do you want to display all keyvalues with different labels at the same time, but they are all grouped by labels (rather than being sortied by key name)?

Something like:

- key1 `LabelA`
- key2 `LabelA`
...
- key1 `LabelB`
- key2 `LabelB`
...

Instead of


- key1 `LabelA`
- key1 `LabelB`
...
- key2 `LabelA`
- key2 `LabelB`
...
spencerr commented 1 month ago

Thanks for the reply @zhiyuanliang-ms

Yes, your scenario matches what I am describing.

In our setup, we have various "groups" of variables that we may share between applications. Think items like redis connection information, application urls, etc. We'd like centralize configurations in a single place so we are not duplicating these values across different app configuration instances per application, and to opt-in or control the shared variables an application is given.

Another additional limitation we run into is snapshots having a limit of 3 filters that can be applied. Right now I filter for the {app-name}/*, and shared/* and accept that all shared configurations will be retrieved, were as we'd like to be more granular with the items being pulled in and to be able to use the snapshots.

As far as UI experience, updating the hierarchy view to be able to group by Label and/or separator would be beneficial.

zhiyuanliang-ms commented 1 month ago

Hi, @spencerr

Here is the screenshot of my app config store

image

By adjusting the order of the Select call, you can specify the order how the keyvalue with different prefix will be loaded. Will this solve your problem?

image
zhiyuanliang-ms commented 1 month ago

BTW, my previous comment is wrong.

IMO, label should be used for the scenario that you have different sets of configuration for different applications. Label should be used to group configurations.

According to the best practice, using different prefixs (as different namespaces) to group key-values is correct. (My previous comment is wrong. Sorry for the mistake.)

@spencerr

amerjusupovic commented 1 month ago

As far as UI experience, updating the hierarchy view to be able to group by Label and/or separator would be beneficial.

@spencerr Does the option to filter by label on the configuration explorer page work for your scenario or did you mean something different?

image
spencerr commented 1 month ago

@zhiyuanliang-ms The ordered select does seem to work, however it does not work with snapshots unfortunately.

@amerjusupovic Filter by the label could work, grouping things does make things a bit easier to visualize. Best practices does seem to mention prefixes being used for separating variables per application however.

zhiyuanliang-ms commented 1 month ago

Hi, @spencerr

The ordered select does seem to work, however it does not work with snapshots unfortunately.

Could you try to create two snapshots for each prefix like this:

image

Instead of having one snapshot which used two key(prefix) filters like this:

image