-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Collection monitoring #47648
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?
Collection monitoring #47648
Changes from all commits
051cc44
67108e9
04880e4
cce6881
1602318
b65c1d8
9ebdb41
b0b200d
e91c407
e4cac36
6c19001
d228a6b
c4c55f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ | |
| import com.azure.data.appconfiguration.models.FeatureFlagConfigurationSetting; | ||
| import com.azure.data.appconfiguration.models.SettingSelector; | ||
| import com.azure.data.appconfiguration.models.SnapshotComposition; | ||
| import com.azure.spring.cloud.appconfiguration.config.implementation.feature.FeatureFlags; | ||
| import com.azure.spring.cloud.appconfiguration.config.implementation.configuration.WatchedConfigurationSettings; | ||
|
|
||
| import io.netty.handler.codec.http.HttpResponseStatus; | ||
|
|
||
|
|
@@ -150,15 +150,47 @@ List<ConfigurationSetting> listSettings(SettingSelector settingSelector, Context | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Gets configuration settings using collection monitoring. This method retrieves all settings matching | ||
| * the selector and captures ETags for collection-based refresh monitoring. | ||
| * | ||
| * @param settingSelector selector criteria for configuration settings | ||
| * @param context Azure SDK context for request correlation | ||
| * @return CollectionMonitoring containing the retrieved configuration settings and match conditions | ||
| * @throws HttpResponseException if the request fails | ||
| */ | ||
| WatchedConfigurationSettings collectionMonitoring(SettingSelector settingSelector, Context context) { | ||
| List<ConfigurationSetting> configurationSettings = new ArrayList<>(); | ||
| List<MatchConditions> checks = new ArrayList<>(); | ||
| try { | ||
| client.listConfigurationSettings(settingSelector, context).streamByPage().forEach(pagedResponse -> { | ||
| checks.add( | ||
| new MatchConditions().setIfNoneMatch(pagedResponse.getHeaders().getValue(HttpHeaderName.ETAG))); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to check status code before processing |
||
| for (ConfigurationSetting setting : pagedResponse.getValue()) { | ||
| configurationSettings.add(NormalizeNull.normalizeNullLabel(setting)); | ||
| } | ||
| }); | ||
|
|
||
| // Needs to happen after or we don't know if the request succeeded or failed. | ||
| this.failedAttempts = 0; | ||
| settingSelector.setMatchConditions(checks); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the response is 304 not modified? Does this override the previous MatchConditions? |
||
| return new WatchedConfigurationSettings(settingSelector, configurationSettings); | ||
| } catch (HttpResponseException e) { | ||
| throw handleHttpResponseException(e); | ||
| } catch (UncheckedIOException e) { | ||
| throw new AppConfigurationStatusException(e.getMessage(), null, null); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Lists feature flags from the Azure App Configuration store. | ||
| * | ||
| * @param settingSelector selector criteria for feature flags | ||
| * @param context Azure SDK context for request correlation | ||
| * @return FeatureFlags containing the retrieved feature flags and match conditions | ||
| * @return CollectionMonitoring containing the retrieved feature flags and match conditions | ||
| * @throws HttpResponseException if the request fails | ||
| */ | ||
| FeatureFlags listFeatureFlags(SettingSelector settingSelector, Context context) | ||
| WatchedConfigurationSettings listFeatureFlags(SettingSelector settingSelector, Context context) | ||
| throws HttpResponseException { | ||
| List<ConfigurationSetting> configurationSettings = new ArrayList<>(); | ||
| List<MatchConditions> checks = new ArrayList<>(); | ||
|
|
@@ -175,7 +207,7 @@ FeatureFlags listFeatureFlags(SettingSelector settingSelector, Context context) | |
| // Needs to happen after or we don't know if the request succeeded or failed. | ||
| this.failedAttempts = 0; | ||
| settingSelector.setMatchConditions(checks); | ||
| return new FeatureFlags(settingSelector, configurationSettings); | ||
| return new WatchedConfigurationSettings(settingSelector, configurationSettings); | ||
| } catch (HttpResponseException e) { | ||
| throw handleHttpResponseException(e); | ||
| } catch (UncheckedIOException e) { | ||
|
|
||
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.
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.
Or
listKeyValuessince the next method islistFeatureFlags