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

Not all KeyValueSelectors get refreshed after sentinel key changed #953

Open
lissdy opened this issue Aug 22, 2024 · 4 comments
Open

Not all KeyValueSelectors get refreshed after sentinel key changed #953

lissdy opened this issue Aug 22, 2024 · 4 comments
Assignees
Labels
.NET Config Provider Issues related to the AppConfig .NET Core configuration provider. question

Comments

@lissdy
Copy link

lissdy commented Aug 22, 2024

Followed https://learn.microsoft.com/en-us/azure/azure-app-configuration/enable-dynamic-configuration-aspnet-core We are using poll model for dynamic configuration

As the screenshot shows, we set three sentinel keys service:testService:sentinel, shared:testService:sentinel and shared:config:sentinel, and set RefreshAll as true for all sentinel keys.
Three KeyValueSelectors are shared:testService:*, service:testService:* and shared:config:*
Suppose any sentinel value change should trigger the service instance refresh all registered configurations.

image

But we noticed when we update configuration values and sentinel values, some KeyValueSelectors get refreshed but some are not. Service still retrieving the old values even 2 days later. We have to restart the service to ensure all configurations are refreshed.

Suppose all selected configuration values should be refreshed in minutes, could you please confirm if the case is normal? How should we ensure selected configuration values get refreshed after configuration change?

SDK version: 6.1.1

@lissdy lissdy changed the title Service instances can't achieve eventual consistent after configuration sentinel key change Not all KeyValueSelectors get refreshed after sentinel key changed Aug 23, 2024
@amerjusupovic
Copy link
Member

Hi @lissdy, by default the refresh interval should be 30 seconds if you haven't set it manually in ConfigureRefresh. I'm not able to reproduce this behavior after copying the quickstart locally with version 6.1.1 of Microsoft.Azure.AppConfiguration.AspNetCore. I selected multiple key-value collections as you did and set a few different sentinel key-values.

Here are some things I'd want to check from your end:

  1. Are you refreshing your application after at least one sentinel key-value and any selected key-values are updated in your store (you may need to refresh a couple times)?
  2. Have you made all calls to AddAzureAppConfiguration and UseAzureAppConfiguration in the order shown in the quickstart?
  3. If you can enable logging at the Debug level, can you check your logs to see which key-values are changing and if the sentinel key-value is logged as a change? The instructions for this can be found in the page you sent.

@zhenlan zhenlan added .NET Config Provider Issues related to the AppConfig .NET Core configuration provider. question labels Aug 30, 2024
@lissdy
Copy link
Author

lissdy commented Sep 9, 2024

Thanks @amerjusupovic for the reply. I have set the refresh interval as 300 seconds.

  1. If "shared:testService:sentinel" value changed, since I set RefreshAll as true, suppose all registered key-value collections shared:testService:, service:testService: and shared:config:* should be refreshed, right?
  2. Yes, followed the quickstart, and here is how I set sentinel key and register key
        private static AzureAppConfigurationOptions ConfigAacOptions(this AzureAppConfigurationOptions options, HashSet<string> sentinelKeys, HashSet<string> registerKeys, double cacheExpirationInSeconds)
        {
            options
                .ConfigureClientOptions(clientOptions =>
                {
                    clientOptions.Retry.MaxRetries = ConfigConstants.MaxRetries;
                })
                .ConfigureRefresh(refresh =>
                {
                    foreach (var i in sentinelKeys)
                    {
                        refresh.Register(key: i, refreshAll: true); // set sentinel key
                    }

                    refresh
                        .SetCacheExpiration(TimeSpan.FromSeconds(cacheExpirationInSeconds));
                });
            foreach (var i in registerKeys)
            {
                options.Select(i); // set register key
            }
            return options;
        }
  1. We can't enable the SDK log, but enabled diagnostic setting, found if "shared:testService:sentinel" value changed, the SDK only send request to refresh shared:config:*, other two key-value collections refresh is missed

@amerjusupovic
Copy link
Member

You're right, if a key is registered with refreshAll set to true then all selected key-values should be refreshed. Is there any way you could try upgrading to the newest provider version, 7.3.0?

@lissdy
Copy link
Author

lissdy commented Sep 13, 2024

Upgraded to the newest version 7.3.0, will try to reproduce the issue and let you know the update, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Config Provider Issues related to the AppConfig .NET Core configuration provider. question
Projects
None yet
Development

No branches or pull requests

3 participants