diff --git a/archaius-core/src/main/java/com/netflix/config/ConcurrentCompositeConfiguration.java b/archaius-core/src/main/java/com/netflix/config/ConcurrentCompositeConfiguration.java index 2335e5ba..2082ae14 100644 --- a/archaius-core/src/main/java/com/netflix/config/ConcurrentCompositeConfiguration.java +++ b/archaius-core/src/main/java/com/netflix/config/ConcurrentCompositeConfiguration.java @@ -551,12 +551,8 @@ private Object getProperty(String key, boolean instrument) Configuration firstMatchingConfiguration = null; for (Configuration config : configList) { if (config.containsKey(key)) { - if (instrument && enableInstrumentation) { - usedProperties.add(key); - if (enableStackTrace) { - String trace = Arrays.toString(Thread.currentThread().getStackTrace()); - stackTraces.merge(trace, 1, (v1, v2) -> v1 + 1); - } + if (instrument) { + recordUsage(key); } firstMatchingConfiguration = config; break; @@ -578,6 +574,20 @@ private Object getProperty(String key, boolean instrument) } } + /** + * Manual endpoint for recording usage of a property for instrumentation purposes. + * @param key Property whose usage is being reported + */ + public void recordUsage(String key) { + if (enableInstrumentation) { + usedProperties.add(key); + if (enableStackTrace) { + String trace = Arrays.toString(Thread.currentThread().getStackTrace()); + stackTraces.merge(trace, 1, (v1, v2) -> v1 + 1); + } + } + } + /** * Get all the keys contained by sub configurations. *