Skip to content

Commit

Permalink
Add uninstrumented endpoint for the bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
akang31 committed Mar 28, 2024
1 parent 25fccb7 commit a6f5bc3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion archaius2-archaius1-bridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {
api project(':archaius2-core')
compileOnly project(':archaius2-guice')
api project(':archaius2-commons-configuration')
api 'com.netflix.archaius:archaius-core:0.7.8'
api 'com.netflix.archaius:archaius-core:0.7.12'

testImplementation project(':archaius2-guice')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.ArrayList;
import java.util.HashSet;

import com.netflix.config.util.InstrumentationAware;
import org.apache.commons.configuration.AbstractConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.HierarchicalConfiguration;
Expand Down Expand Up @@ -32,7 +34,7 @@
* @see StaticArchaiusBridgeModule
*/
@Singleton
class AbstractConfigurationBridge extends AbstractConfiguration implements AggregatedConfiguration, DynamicPropertySupport {
class AbstractConfigurationBridge extends AbstractConfiguration implements AggregatedConfiguration, DynamicPropertySupport, InstrumentationAware {

private final Config config;
private final SettableConfig settable;
Expand Down Expand Up @@ -94,6 +96,11 @@ public Object getProperty(String key) {
return config.getRawProperty(key); // Should interpolate
}

@Override
public Object getPropertyUninstrumented(String key) {
return config.getRawPropertyUninstrumented(key);
}

@Override
public Iterator<String> getKeys() {
return config.getKeys();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.inject.Inject;
import javax.inject.Singleton;

import com.netflix.config.util.InstrumentationAware;
import org.apache.commons.configuration.AbstractConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.event.ConfigurationEvent;
Expand All @@ -27,7 +28,7 @@
* @see StaticArchaiusBridgeModule
*/
@Singleton
public class StaticAbstractConfiguration extends AbstractConfiguration implements AggregatedConfiguration, DynamicPropertySupport {
public class StaticAbstractConfiguration extends AbstractConfiguration implements AggregatedConfiguration, DynamicPropertySupport, InstrumentationAware {

private static volatile AbstractConfigurationBridge delegate;

Expand Down Expand Up @@ -143,6 +144,16 @@ public Object getProperty(String key) {
return delegate.getProperty(key);
}

@Override
public Object getPropertyUninstrumented(String key) {
if (delegate == null) {
System.out.println(
"[getPropertyUninstrumented(" + key + ")] StaticAbstractConfiguration not initialized yet.");
return null;
}
return delegate.getPropertyUninstrumented(key);
}

@Override
public Iterator<String> getKeys() {
if (delegate == null) {
Expand Down

0 comments on commit a6f5bc3

Please sign in to comment.