Remove static usage of low level config methods from outside the config class
This commit is contained in:
parent
a889c46715
commit
901efee50e
|
@ -151,7 +151,7 @@ public class JMXFetch {
|
||||||
for (final String config : split) {
|
for (final String config : split) {
|
||||||
integrationName.clear();
|
integrationName.clear();
|
||||||
integrationName.add(config.replace(".yaml", ""));
|
integrationName.add(config.replace(".yaml", ""));
|
||||||
if (Config.jmxFetchIntegrationEnabled(integrationName, false)) {
|
if (Config.get().isJmxFetchIntegrationEnabled(integrationName, false)) {
|
||||||
final URL resource = JMXFetch.class.getResource("metricconfigs/" + config);
|
final URL resource = JMXFetch.class.getResource("metricconfigs/" + config);
|
||||||
result.add(resource.getPath().split("\\.jar!/")[1]);
|
result.add(resource.getPath().split("\\.jar!/")[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,12 @@ public abstract class BaseDecorator {
|
||||||
final String[] instrumentationNames = instrumentationNames();
|
final String[] instrumentationNames = instrumentationNames();
|
||||||
traceAnalyticsEnabled =
|
traceAnalyticsEnabled =
|
||||||
instrumentationNames.length > 0
|
instrumentationNames.length > 0
|
||||||
&& Config.traceAnalyticsIntegrationEnabled(
|
&& Config.get()
|
||||||
new TreeSet<>(Arrays.asList(instrumentationNames)), traceAnalyticsDefault());
|
.isTraceAnalyticsIntegrationEnabled(
|
||||||
|
new TreeSet<>(Arrays.asList(instrumentationNames)), traceAnalyticsDefault());
|
||||||
float rate = 1.0f;
|
float rate = 1.0f;
|
||||||
for (final String name : instrumentationNames) {
|
for (final String name : instrumentationNames) {
|
||||||
rate = Config.getFloatSettingFromEnvironment(name + ".analytics.sample-rate", rate);
|
rate = Config.get().getInstrumentationAnalyticsSampleRate(name);
|
||||||
}
|
}
|
||||||
traceAnalyticsSampleRate = rate;
|
traceAnalyticsSampleRate = rate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class HttpServerDecorator<REQUEST, CONNECTION, RESPONSE> extends
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean traceAnalyticsDefault() {
|
protected boolean traceAnalyticsDefault() {
|
||||||
return Config.getBooleanSettingFromEnvironment(Config.TRACE_ANALYTICS_ENABLED, false);
|
return Config.get().isTraceAnalyticsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Span onRequest(final Span span, final REQUEST request) {
|
public Span onRequest(final Span span, final REQUEST request) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public interface Instrumenter {
|
||||||
instrumentationNames.add(instrumentationName);
|
instrumentationNames.add(instrumentationName);
|
||||||
instrumentationPrimaryName = instrumentationName;
|
instrumentationPrimaryName = instrumentationName;
|
||||||
|
|
||||||
enabled = Config.integrationEnabled(instrumentationNames, defaultEnabled());
|
enabled = Config.get().isIntegrationEnabled(instrumentationNames, defaultEnabled());
|
||||||
contextProvider = new FieldBackedProvider(this);
|
contextProvider = new FieldBackedProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ public interface Instrumenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean defaultEnabled() {
|
protected boolean defaultEnabled() {
|
||||||
return Config.getBooleanSettingFromEnvironment("integrations.enabled", true);
|
return Config.get().isIntegrationsEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,7 @@ public abstract class AbstractExecutorInstrumentation extends Instrumenter.Defau
|
||||||
|
|
||||||
public static final String EXEC_NAME = "java_concurrent";
|
public static final String EXEC_NAME = "java_concurrent";
|
||||||
|
|
||||||
private static final boolean TRACE_ALL_EXECUTORS =
|
private static final boolean TRACE_ALL_EXECUTORS = Config.get().isTraceExecutorsAll();
|
||||||
Config.getBooleanSettingFromEnvironment("trace.executors.all", false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only apply executor instrumentation to whitelisted executors. To apply to all executors, use
|
* Only apply executor instrumentation to whitelisted executors. To apply to all executors, use
|
||||||
|
@ -85,8 +84,7 @@ public abstract class AbstractExecutorInstrumentation extends Instrumenter.Defau
|
||||||
"com.google.common.util.concurrent.MoreExecutors$ScheduledListeningDecorator",
|
"com.google.common.util.concurrent.MoreExecutors$ScheduledListeningDecorator",
|
||||||
};
|
};
|
||||||
|
|
||||||
final Set<String> executors =
|
final Set<String> executors = new HashSet<>(Config.get().getTraceExecutors());
|
||||||
new HashSet<>(Config.getListSettingFromEnvironment("trace.executors", ""));
|
|
||||||
executors.addAll(Arrays.asList(whitelist));
|
executors.addAll(Arrays.asList(whitelist));
|
||||||
|
|
||||||
WHITELISTED_EXECUTORS = Collections.unmodifiableSet(executors);
|
WHITELISTED_EXECUTORS = Collections.unmodifiableSet(executors);
|
||||||
|
|
|
@ -34,8 +34,7 @@ public class MDCInjectionInstrumentation extends Instrumenter.Default {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean defaultEnabled() {
|
protected boolean defaultEnabled() {
|
||||||
return Config.getBooleanSettingFromEnvironment(
|
return Config.get().isLogsInjectionEnabled();
|
||||||
Config.LOGS_INJECTION_ENABLED, Config.DEFAULT_LOGS_INJECTION_ENABLED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class TraceAnnotationsInstrumentation extends Instrumenter.Default
|
||||||
public TraceAnnotationsInstrumentation() {
|
public TraceAnnotationsInstrumentation() {
|
||||||
super("trace", "trace-annotation");
|
super("trace", "trace-annotation");
|
||||||
|
|
||||||
final String configString = Config.getSettingFromEnvironment(Config.TRACE_ANNOTATIONS, null);
|
final String configString = Config.get().getTraceAnnotations();
|
||||||
if (configString == null) {
|
if (configString == null) {
|
||||||
additionalTraceAnnotations =
|
additionalTraceAnnotations =
|
||||||
Collections.unmodifiableSet(Sets.<String>newHashSet(DEFAULT_ANNOTATIONS));
|
Collections.unmodifiableSet(Sets.<String>newHashSet(DEFAULT_ANNOTATIONS));
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TraceConfigInstrumentation implements Instrumenter {
|
||||||
private final Map<String, Set<String>> classMethodsToTrace;
|
private final Map<String, Set<String>> classMethodsToTrace;
|
||||||
|
|
||||||
public TraceConfigInstrumentation() {
|
public TraceConfigInstrumentation() {
|
||||||
final String configString = Config.getSettingFromEnvironment(Config.TRACE_METHODS, null);
|
final String configString = Config.get().getTraceMethods();
|
||||||
if (configString == null || configString.trim().isEmpty()) {
|
if (configString == null || configString.trim().isEmpty()) {
|
||||||
classMethodsToTrace = Collections.emptyMap();
|
classMethodsToTrace = Collections.emptyMap();
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class Config {
|
||||||
public static final String SERVICE_NAME = "service.name";
|
public static final String SERVICE_NAME = "service.name";
|
||||||
public static final String SERVICE = "service";
|
public static final String SERVICE = "service";
|
||||||
public static final String TRACE_ENABLED = "trace.enabled";
|
public static final String TRACE_ENABLED = "trace.enabled";
|
||||||
|
public static final String INTEGRATIONS_ENABLED = "integrations.enabled";
|
||||||
public static final String WRITER_TYPE = "writer.type";
|
public static final String WRITER_TYPE = "writer.type";
|
||||||
public static final String AGENT_HOST = "agent.host";
|
public static final String AGENT_HOST = "agent.host";
|
||||||
public static final String TRACE_AGENT_PORT = "trace.agent.port";
|
public static final String TRACE_AGENT_PORT = "trace.agent.port";
|
||||||
|
@ -51,6 +52,8 @@ public class Config {
|
||||||
public static final String JMX_TAGS = "trace.jmx.tags";
|
public static final String JMX_TAGS = "trace.jmx.tags";
|
||||||
public static final String TRACE_ANALYTICS_ENABLED = "trace.analytics.enabled";
|
public static final String TRACE_ANALYTICS_ENABLED = "trace.analytics.enabled";
|
||||||
public static final String TRACE_ANNOTATIONS = "trace.annotations";
|
public static final String TRACE_ANNOTATIONS = "trace.annotations";
|
||||||
|
public static final String TRACE_EXECUTORS_ALL = "trace.executors.all";
|
||||||
|
public static final String TRACE_EXECUTORS = "trace.executors";
|
||||||
public static final String TRACE_METHODS = "trace.methods";
|
public static final String TRACE_METHODS = "trace.methods";
|
||||||
public static final String TRACE_CLASSES_EXCLUDE = "trace.classes.exclude";
|
public static final String TRACE_CLASSES_EXCLUDE = "trace.classes.exclude";
|
||||||
public static final String TRACE_REPORT_HOSTNAME = "trace.report-hostname";
|
public static final String TRACE_REPORT_HOSTNAME = "trace.report-hostname";
|
||||||
|
@ -84,6 +87,7 @@ public class Config {
|
||||||
public static final String DEFAULT_SERVICE_NAME = "unnamed-java-app";
|
public static final String DEFAULT_SERVICE_NAME = "unnamed-java-app";
|
||||||
|
|
||||||
private static final boolean DEFAULT_TRACE_ENABLED = true;
|
private static final boolean DEFAULT_TRACE_ENABLED = true;
|
||||||
|
public static final boolean DEFAULT_INTEGRATIONS_ENABLED = true;
|
||||||
public static final String DD_AGENT_WRITER_TYPE = "DDAgentWriter";
|
public static final String DD_AGENT_WRITER_TYPE = "DDAgentWriter";
|
||||||
public static final String LOGGING_WRITER_TYPE = "LoggingWriter";
|
public static final String LOGGING_WRITER_TYPE = "LoggingWriter";
|
||||||
private static final String DEFAULT_AGENT_WRITER_TYPE = DD_AGENT_WRITER_TYPE;
|
private static final String DEFAULT_AGENT_WRITER_TYPE = DD_AGENT_WRITER_TYPE;
|
||||||
|
@ -115,6 +119,12 @@ public class Config {
|
||||||
private static final String SPLIT_BY_SPACE_OR_COMMA_REGEX = "[,\\s]+";
|
private static final String SPLIT_BY_SPACE_OR_COMMA_REGEX = "[,\\s]+";
|
||||||
|
|
||||||
private static final boolean DEFAULT_TRACE_REPORT_HOSTNAME = false;
|
private static final boolean DEFAULT_TRACE_REPORT_HOSTNAME = false;
|
||||||
|
private static final String DEFAULT_TRACE_ANNOTATIONS = null;
|
||||||
|
private static final boolean DEFAULT_TRACE_EXECUTORS_ALL = false;
|
||||||
|
private static final String DEFAULT_TRACE_EXECUTORS = "";
|
||||||
|
private static final String DEFAULT_TRACE_METHODS = null;
|
||||||
|
public static final boolean DEFAULT_TRACE_ANALYTICS_ENABLED = false;
|
||||||
|
public static final float DEFAULT_ANALYTICS_SAMPLE_RATE = 1.0f;
|
||||||
|
|
||||||
public enum PropagationStyle {
|
public enum PropagationStyle {
|
||||||
DATADOG,
|
DATADOG,
|
||||||
|
@ -132,6 +142,7 @@ public class Config {
|
||||||
|
|
||||||
@Getter private final String serviceName;
|
@Getter private final String serviceName;
|
||||||
@Getter private final boolean traceEnabled;
|
@Getter private final boolean traceEnabled;
|
||||||
|
@Getter private final boolean integrationsEnabled;
|
||||||
@Getter private final String writerType;
|
@Getter private final String writerType;
|
||||||
@Getter private final String agentHost;
|
@Getter private final String agentHost;
|
||||||
@Getter private final int agentPort;
|
@Getter private final int agentPort;
|
||||||
|
@ -167,6 +178,15 @@ public class Config {
|
||||||
|
|
||||||
@Getter private final boolean reportHostName;
|
@Getter private final boolean reportHostName;
|
||||||
|
|
||||||
|
@Getter private final String traceAnnotations;
|
||||||
|
|
||||||
|
@Getter private final String traceMethods;
|
||||||
|
|
||||||
|
@Getter private final boolean traceExecutorsAll;
|
||||||
|
@Getter private final List<String> traceExecutors;
|
||||||
|
|
||||||
|
@Getter private final boolean traceAnalyticsEnabled;
|
||||||
|
|
||||||
// Read order: System Properties -> Env Variables, [-> default value]
|
// Read order: System Properties -> Env Variables, [-> default value]
|
||||||
// Visible for testing
|
// Visible for testing
|
||||||
Config() {
|
Config() {
|
||||||
|
@ -175,6 +195,8 @@ public class Config {
|
||||||
serviceName = getSettingFromEnvironment(SERVICE_NAME, DEFAULT_SERVICE_NAME);
|
serviceName = getSettingFromEnvironment(SERVICE_NAME, DEFAULT_SERVICE_NAME);
|
||||||
|
|
||||||
traceEnabled = getBooleanSettingFromEnvironment(TRACE_ENABLED, DEFAULT_TRACE_ENABLED);
|
traceEnabled = getBooleanSettingFromEnvironment(TRACE_ENABLED, DEFAULT_TRACE_ENABLED);
|
||||||
|
integrationsEnabled =
|
||||||
|
getBooleanSettingFromEnvironment(INTEGRATIONS_ENABLED, DEFAULT_INTEGRATIONS_ENABLED);
|
||||||
writerType = getSettingFromEnvironment(WRITER_TYPE, DEFAULT_AGENT_WRITER_TYPE);
|
writerType = getSettingFromEnvironment(WRITER_TYPE, DEFAULT_AGENT_WRITER_TYPE);
|
||||||
agentHost = getSettingFromEnvironment(AGENT_HOST, DEFAULT_AGENT_HOST);
|
agentHost = getSettingFromEnvironment(AGENT_HOST, DEFAULT_AGENT_HOST);
|
||||||
agentPort =
|
agentPort =
|
||||||
|
@ -254,6 +276,18 @@ public class Config {
|
||||||
reportHostName =
|
reportHostName =
|
||||||
getBooleanSettingFromEnvironment(TRACE_REPORT_HOSTNAME, DEFAULT_TRACE_REPORT_HOSTNAME);
|
getBooleanSettingFromEnvironment(TRACE_REPORT_HOSTNAME, DEFAULT_TRACE_REPORT_HOSTNAME);
|
||||||
|
|
||||||
|
traceAnnotations = getSettingFromEnvironment(TRACE_ANNOTATIONS, DEFAULT_TRACE_ANNOTATIONS);
|
||||||
|
|
||||||
|
traceMethods = getSettingFromEnvironment(TRACE_METHODS, DEFAULT_TRACE_METHODS);
|
||||||
|
|
||||||
|
traceExecutorsAll =
|
||||||
|
getBooleanSettingFromEnvironment(TRACE_EXECUTORS_ALL, DEFAULT_TRACE_EXECUTORS_ALL);
|
||||||
|
|
||||||
|
traceExecutors = getListSettingFromEnvironment(TRACE_EXECUTORS, DEFAULT_TRACE_EXECUTORS);
|
||||||
|
|
||||||
|
traceAnalyticsEnabled =
|
||||||
|
getBooleanSettingFromEnvironment(TRACE_ANALYTICS_ENABLED, DEFAULT_TRACE_ANALYTICS_ENABLED);
|
||||||
|
|
||||||
log.debug("New instance: {}", this);
|
log.debug("New instance: {}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,6 +298,8 @@ public class Config {
|
||||||
serviceName = properties.getProperty(SERVICE_NAME, parent.serviceName);
|
serviceName = properties.getProperty(SERVICE_NAME, parent.serviceName);
|
||||||
|
|
||||||
traceEnabled = getPropertyBooleanValue(properties, TRACE_ENABLED, parent.traceEnabled);
|
traceEnabled = getPropertyBooleanValue(properties, TRACE_ENABLED, parent.traceEnabled);
|
||||||
|
integrationsEnabled =
|
||||||
|
getPropertyBooleanValue(properties, INTEGRATIONS_ENABLED, parent.integrationsEnabled);
|
||||||
writerType = properties.getProperty(WRITER_TYPE, parent.writerType);
|
writerType = properties.getProperty(WRITER_TYPE, parent.writerType);
|
||||||
agentHost = properties.getProperty(AGENT_HOST, parent.agentHost);
|
agentHost = properties.getProperty(AGENT_HOST, parent.agentHost);
|
||||||
agentPort =
|
agentPort =
|
||||||
|
@ -347,6 +383,17 @@ public class Config {
|
||||||
reportHostName =
|
reportHostName =
|
||||||
getPropertyBooleanValue(properties, TRACE_REPORT_HOSTNAME, parent.reportHostName);
|
getPropertyBooleanValue(properties, TRACE_REPORT_HOSTNAME, parent.reportHostName);
|
||||||
|
|
||||||
|
traceAnnotations = properties.getProperty(TRACE_ANNOTATIONS, parent.traceAnnotations);
|
||||||
|
|
||||||
|
traceMethods = properties.getProperty(TRACE_METHODS, parent.traceAnnotations);
|
||||||
|
|
||||||
|
traceExecutorsAll =
|
||||||
|
getPropertyBooleanValue(properties, TRACE_EXECUTORS_ALL, parent.traceExecutorsAll);
|
||||||
|
traceExecutors = getPropertyListValue(properties, TRACE_EXECUTORS, parent.traceExecutors);
|
||||||
|
|
||||||
|
traceAnalyticsEnabled =
|
||||||
|
getPropertyBooleanValue(properties, TRACE_ANALYTICS_ENABLED, parent.traceAnalyticsEnabled);
|
||||||
|
|
||||||
log.debug("New instance: {}", this);
|
log.debug("New instance: {}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +435,15 @@ public class Config {
|
||||||
return Collections.unmodifiableMap(result);
|
return Collections.unmodifiableMap(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the sample rate for the specified instrumentation or {@link
|
||||||
|
* #DEFAULT_ANALYTICS_SAMPLE_RATE} if none specified.
|
||||||
|
*/
|
||||||
|
public float getInstrumentationAnalyticsSampleRate(String instrumentationName) {
|
||||||
|
return getFloatSettingFromEnvironment(
|
||||||
|
instrumentationName + ".analytics.sample-rate", DEFAULT_ANALYTICS_SAMPLE_RATE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a map of tags required by the datadog backend to link runtime metrics (i.e. jmx) and
|
* Return a map of tags required by the datadog backend to link runtime metrics (i.e. jmx) and
|
||||||
* traces.
|
* traces.
|
||||||
|
@ -404,7 +460,7 @@ public class Config {
|
||||||
return Collections.unmodifiableMap(result);
|
return Collections.unmodifiableMap(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean integrationEnabled(
|
public boolean isIntegrationEnabled(
|
||||||
final SortedSet<String> integrationNames, final boolean defaultEnabled) {
|
final SortedSet<String> integrationNames, final boolean defaultEnabled) {
|
||||||
// If default is enabled, we want to enable individually,
|
// If default is enabled, we want to enable individually,
|
||||||
// if default is disabled, we want to disable individually.
|
// if default is disabled, we want to disable individually.
|
||||||
|
@ -421,7 +477,7 @@ public class Config {
|
||||||
return anyEnabled;
|
return anyEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean jmxFetchIntegrationEnabled(
|
public boolean isJmxFetchIntegrationEnabled(
|
||||||
final SortedSet<String> integrationNames, final boolean defaultEnabled) {
|
final SortedSet<String> integrationNames, final boolean defaultEnabled) {
|
||||||
// If default is enabled, we want to enable individually,
|
// If default is enabled, we want to enable individually,
|
||||||
// if default is disabled, we want to disable individually.
|
// if default is disabled, we want to disable individually.
|
||||||
|
@ -438,7 +494,7 @@ public class Config {
|
||||||
return anyEnabled;
|
return anyEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean traceAnalyticsIntegrationEnabled(
|
public boolean isTraceAnalyticsIntegrationEnabled(
|
||||||
final SortedSet<String> integrationNames, final boolean defaultEnabled) {
|
final SortedSet<String> integrationNames, final boolean defaultEnabled) {
|
||||||
// If default is enabled, we want to enable individually,
|
// If default is enabled, we want to enable individually,
|
||||||
// if default is disabled, we want to disable individually.
|
// if default is disabled, we want to disable individually.
|
||||||
|
@ -463,6 +519,7 @@ public class Config {
|
||||||
* @param name
|
* @param name
|
||||||
* @param defaultValue
|
* @param defaultValue
|
||||||
* @return
|
* @return
|
||||||
|
* @deprecated This method should only be used internally. Use the explicit getter instead.
|
||||||
*/
|
*/
|
||||||
public static String getSettingFromEnvironment(final String name, final String defaultValue) {
|
public static String getSettingFromEnvironment(final String name, final String defaultValue) {
|
||||||
final String completeName = PREFIX + name;
|
final String completeName = PREFIX + name;
|
||||||
|
@ -472,6 +529,7 @@ public class Config {
|
||||||
return value == null ? defaultValue : value;
|
return value == null ? defaultValue : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated This method should only be used internally. Use the explicit getter instead. */
|
||||||
private static Map<String, String> getMapSettingFromEnvironment(
|
private static Map<String, String> getMapSettingFromEnvironment(
|
||||||
final String name, final String defaultValue) {
|
final String name, final String defaultValue) {
|
||||||
return parseMap(getSettingFromEnvironment(name, defaultValue), PREFIX + name);
|
return parseMap(getSettingFromEnvironment(name, defaultValue), PREFIX + name);
|
||||||
|
@ -480,6 +538,8 @@ public class Config {
|
||||||
/**
|
/**
|
||||||
* Calls {@link #getSettingFromEnvironment(String, String)} and converts the result to a list by
|
* Calls {@link #getSettingFromEnvironment(String, String)} and converts the result to a list by
|
||||||
* splitting on `,`.
|
* splitting on `,`.
|
||||||
|
*
|
||||||
|
* @deprecated This method should only be used internally. Use the explicit getter instead.
|
||||||
*/
|
*/
|
||||||
public static List<String> getListSettingFromEnvironment(
|
public static List<String> getListSettingFromEnvironment(
|
||||||
final String name, final String defaultValue) {
|
final String name, final String defaultValue) {
|
||||||
|
@ -488,6 +548,8 @@ public class Config {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls {@link #getSettingFromEnvironment(String, String)} and converts the result to a Boolean.
|
* Calls {@link #getSettingFromEnvironment(String, String)} and converts the result to a Boolean.
|
||||||
|
*
|
||||||
|
* @deprecated This method should only be used internally. Use the explicit getter instead.
|
||||||
*/
|
*/
|
||||||
public static Boolean getBooleanSettingFromEnvironment(
|
public static Boolean getBooleanSettingFromEnvironment(
|
||||||
final String name, final Boolean defaultValue) {
|
final String name, final Boolean defaultValue) {
|
||||||
|
@ -497,6 +559,8 @@ public class Config {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls {@link #getSettingFromEnvironment(String, String)} and converts the result to a Float.
|
* Calls {@link #getSettingFromEnvironment(String, String)} and converts the result to a Float.
|
||||||
|
*
|
||||||
|
* @deprecated This method should only be used internally. Use the explicit getter instead.
|
||||||
*/
|
*/
|
||||||
public static Float getFloatSettingFromEnvironment(final String name, final Float defaultValue) {
|
public static Float getFloatSettingFromEnvironment(final String name, final Float defaultValue) {
|
||||||
final String value = getSettingFromEnvironment(name, null);
|
final String value = getSettingFromEnvironment(name, null);
|
||||||
|
|
|
@ -455,7 +455,7 @@ class ConfigTest extends Specification {
|
||||||
System.setProperty("dd.integration.disabled-prop.enabled", "false")
|
System.setProperty("dd.integration.disabled-prop.enabled", "false")
|
||||||
|
|
||||||
expect:
|
expect:
|
||||||
Config.integrationEnabled(integrationNames, defaultEnabled) == expected
|
Config.get().isIntegrationEnabled(integrationNames, defaultEnabled) == expected
|
||||||
|
|
||||||
where:
|
where:
|
||||||
names | defaultEnabled | expected
|
names | defaultEnabled | expected
|
||||||
|
@ -489,7 +489,7 @@ class ConfigTest extends Specification {
|
||||||
System.setProperty("dd.jmxfetch.disabled-prop.enabled", "false")
|
System.setProperty("dd.jmxfetch.disabled-prop.enabled", "false")
|
||||||
|
|
||||||
expect:
|
expect:
|
||||||
Config.jmxFetchIntegrationEnabled(integrationNames, defaultEnabled) == expected
|
Config.get().isJmxFetchIntegrationEnabled(integrationNames, defaultEnabled) == expected
|
||||||
|
|
||||||
where:
|
where:
|
||||||
names | defaultEnabled | expected
|
names | defaultEnabled | expected
|
||||||
|
@ -523,7 +523,7 @@ class ConfigTest extends Specification {
|
||||||
System.setProperty("dd.disabled-prop.analytics.enabled", "false")
|
System.setProperty("dd.disabled-prop.analytics.enabled", "false")
|
||||||
|
|
||||||
expect:
|
expect:
|
||||||
Config.traceAnalyticsIntegrationEnabled(integrationNames, defaultEnabled) == expected
|
Config.get().isTraceAnalyticsIntegrationEnabled(integrationNames, defaultEnabled) == expected
|
||||||
|
|
||||||
where:
|
where:
|
||||||
names | defaultEnabled | expected
|
names | defaultEnabled | expected
|
||||||
|
|
Loading…
Reference in New Issue