diff --git a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java index c59d26fb5db..2f2e1408a32 100644 --- a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java +++ b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java @@ -57,6 +57,7 @@ private static void run(final StatsDClientManager statsDClientManager, final Con final List metricsConfigs = config.getJmxFetchMetricsConfigs(); final Integer checkPeriod = config.getJmxFetchCheckPeriod(); final Integer refreshBeansPeriod = config.getJmxFetchRefreshBeansPeriod(); + final Integer initialRefreshBeansPeriod = config.getJmxFetchInitialRefreshBeansPeriod(); final Map globalTags = config.getMergedJmxTags(); String host = @@ -73,12 +74,13 @@ private static void run(final StatsDClientManager statsDClientManager, final Con if (log.isDebugEnabled()) { log.debug( - "JMXFetch config: {} {} {} {} {} {} {} {}", + "JMXFetch config: {} {} {} {} {} {} {} {} {}", jmxFetchConfigDir, jmxFetchConfigs, internalMetricsConfigs, metricsConfigs, checkPeriod, + initialRefreshBeansPeriod, refreshBeansPeriod, globalTags, "statsd:" + host + ":" + port); @@ -98,6 +100,7 @@ private static void run(final StatsDClientManager statsDClientManager, final Con .instanceConfigResources(DEFAULT_CONFIGS) .metricConfigResources(internalMetricsConfigs) .metricConfigFiles(metricsConfigs) + .initialRefreshBeansPeriod(initialRefreshBeansPeriod) .refreshBeansPeriod(refreshBeansPeriod) .globalTags(globalTags) .reporter(new AgentStatsdReporter(statsd)); diff --git a/dd-trace-api/src/main/java/datadog/trace/api/config/JmxFetchConfig.java b/dd-trace-api/src/main/java/datadog/trace/api/config/JmxFetchConfig.java index f7cb6943bda..5adb6b75903 100644 --- a/dd-trace-api/src/main/java/datadog/trace/api/config/JmxFetchConfig.java +++ b/dd-trace-api/src/main/java/datadog/trace/api/config/JmxFetchConfig.java @@ -14,6 +14,8 @@ public final class JmxFetchConfig { public static final String JMX_FETCH_CONFIG = "jmxfetch.config"; @Deprecated public static final String JMX_FETCH_METRICS_CONFIGS = "jmxfetch.metrics-configs"; public static final String JMX_FETCH_CHECK_PERIOD = "jmxfetch.check-period"; + public static final String JMX_FETCH_INITIAL_REFRESH_BEANS_PERIOD = + "jmxfetch.initial-refresh-beans-period"; public static final String JMX_FETCH_REFRESH_BEANS_PERIOD = "jmxfetch.refresh-beans-period"; public static final String JMX_FETCH_STATSD_HOST = "jmxfetch.statsd.host"; public static final String JMX_FETCH_STATSD_PORT = "jmxfetch.statsd.port"; diff --git a/internal-api/src/main/java/datadog/trace/api/Config.java b/internal-api/src/main/java/datadog/trace/api/Config.java index 4b329d7cb96..480f24df82d 100644 --- a/internal-api/src/main/java/datadog/trace/api/Config.java +++ b/internal-api/src/main/java/datadog/trace/api/Config.java @@ -84,6 +84,7 @@ import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_CONFIG; import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_CONFIG_DIR; import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_ENABLED; +import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_INITIAL_REFRESH_BEANS_PERIOD; import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_METRICS_CONFIGS; import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_REFRESH_BEANS_PERIOD; import static datadog.trace.api.config.JmxFetchConfig.JMX_FETCH_START_DELAY; @@ -288,6 +289,7 @@ public class Config { private final List jmxFetchConfigs; @Deprecated private final List jmxFetchMetricsConfigs; private final Integer jmxFetchCheckPeriod; + private final Integer jmxFetchInitialRefreshBeansPeriod; private final Integer jmxFetchRefreshBeansPeriod; private final String jmxFetchStatsdHost; private final Integer jmxFetchStatsdPort; @@ -584,6 +586,8 @@ private Config(final String runtimeId, final ConfigProvider configProvider) { jmxFetchConfigs = configProvider.getList(JMX_FETCH_CONFIG); jmxFetchMetricsConfigs = configProvider.getList(JMX_FETCH_METRICS_CONFIGS); jmxFetchCheckPeriod = configProvider.getInteger(JMX_FETCH_CHECK_PERIOD); + jmxFetchInitialRefreshBeansPeriod = + configProvider.getInteger(JMX_FETCH_INITIAL_REFRESH_BEANS_PERIOD); jmxFetchRefreshBeansPeriod = configProvider.getInteger(JMX_FETCH_REFRESH_BEANS_PERIOD); jmxFetchStatsdHost = configProvider.getString(JMX_FETCH_STATSD_HOST); jmxFetchStatsdPort = @@ -928,6 +932,10 @@ public Integer getJmxFetchRefreshBeansPeriod() { return jmxFetchRefreshBeansPeriod; } + public Integer getJmxFetchInitialRefreshBeansPeriod() { + return jmxFetchInitialRefreshBeansPeriod; + } + public String getJmxFetchStatsdHost() { return jmxFetchStatsdHost; } @@ -1693,6 +1701,8 @@ public String toString() { + jmxFetchMetricsConfigs + ", jmxFetchCheckPeriod=" + jmxFetchCheckPeriod + + ", jmxFetchInitialRefreshBeansPeriod=" + + jmxFetchInitialRefreshBeansPeriod + ", jmxFetchRefreshBeansPeriod=" + jmxFetchRefreshBeansPeriod + ", jmxFetchStatsdHost='"