Skip to content

Commit

Permalink
avoid ConcurrentModificationException (#1191)
Browse files Browse the repository at this point in the history
Signed-off-by: Gregor Zeitlinger <[email protected]>
  • Loading branch information
zeitlinger authored Nov 6, 2024
1 parent 76cb93e commit 7bc442f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ private static Map<Object, Object> loadProperties(Map<Object, Object> externalPr
Map<Object, Object> properties = new HashMap<>();
properties.putAll(loadPropertiesFromClasspath());
properties.putAll(loadPropertiesFromFile()); // overriding the entries from the classpath file
properties.putAll(System.getProperties()); // overriding the entries from the properties file
// overriding the entries from the properties file
// copy System properties to avoid ConcurrentModificationException
System.getProperties().stringPropertyNames().stream()
.filter(key -> key.startsWith("io.prometheus"))
.forEach(key -> properties.put(key, System.getProperty(key)));
properties.putAll(externalProperties); // overriding all the entries above
// TODO: Add environment variables like EXEMPLARS_ENABLED.
return properties;
Expand Down

0 comments on commit 7bc442f

Please sign in to comment.