Skip to content

Commit

Permalink
Merge pull request #36404 from radcortez/fix-36326
Browse files Browse the repository at this point in the history
Do not exclude properties from recording that are available in sources that should always be included
  • Loading branch information
gsmet authored Oct 11, 2023
2 parents e0ca7c6 + ee36207 commit 25eb435
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1018,28 +1018,40 @@ private Converter<?> getConverter(SmallRyeConfig config, Field field, ConverterT
*/
private Set<String> getAllProperties(final Set<String> registeredRoots) {
Set<String> properties = new HashSet<>();

// Get all properties, including the ones generated by interceptors, but these do not include profiles
for (String property : config.getPropertyNames()) {
properties.add(property);
}

Set<String> propertiesToRemove = new HashSet<>();
Set<String> propertiesToAdd = new HashSet<>();

// Get properties per source to collect profiled properties and exclude properties that are build related
for (ConfigSource configSource : config.getConfigSources()) {
if (configSource instanceof SysPropConfigSource || configSource instanceof EnvConfigSource
|| "PropertiesConfigSource[source=Build system]".equals(configSource.getName())) {
for (String property : configSource.getPropertyNames()) {
NameIterator ni = new NameIterator(property);
if (ni.hasNext() && PropertiesUtil.isPropertyInRoot(registeredRoots, ni)) {
properties.add(property);
propertiesToAdd.add(property);
} else {
properties.remove(property);
propertiesToRemove.add(property);
if (configSource instanceof EnvConfigSource) {
properties.remove(StringUtil.toLowerCaseAndDotted(property));
propertiesToRemove.add(StringUtil.toLowerCaseAndDotted(property));
}
}
}
} else {
properties.addAll(configSource.getPropertyNames());
propertiesToAdd.addAll(configSource.getPropertyNames());
}
}

// A property may exist in an excluded source and an include source. We don't have a way to know, so we
// just remove the excluded ones and add the ones to be included, so the property is back there again
properties.removeAll(propertiesToRemove);
properties.addAll(propertiesToAdd);

return properties;
}

Expand Down

0 comments on commit 25eb435

Please sign in to comment.