From 3b86286166d37d27895fe9f6fde4ba8753319869 Mon Sep 17 00:00:00 2001 From: Brian Floersch Date: Fri, 4 Dec 2020 16:05:34 -0500 Subject: [PATCH 1/2] added flag to not collect default JVM metrics --- src/main/java/org/datadog/jmxfetch/Instance.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/datadog/jmxfetch/Instance.java b/src/main/java/org/datadog/jmxfetch/Instance.java index 9b1364c9d..c09f5f7b8 100644 --- a/src/main/java/org/datadog/jmxfetch/Instance.java +++ b/src/main/java/org/datadog/jmxfetch/Instance.java @@ -224,8 +224,12 @@ public Instance( } } - loadDefaultConfig("default-jmx-metrics.yaml"); - loadDefaultConfig(gcMetricConfig); + Boolean collectDefaultJvmMetrics = (Boolean) instanceMap.get("collect_default_jvm_metrics"); + if (collectDefaultJvmMetrics == null || collectDefaultJvmMetrics) { + log.info("collect_default_jvm_metrics is true - not collecting default JVM metrics"); + loadDefaultConfig("default-jmx-metrics.yaml"); + loadDefaultConfig(gcMetricConfig); + } } public static boolean isDirectInstance(Map configInstance) { From 15fb1e3cad7615b34f3eb51e060f3cbd65bea34f Mon Sep 17 00:00:00 2001 From: Brian Floersch Date: Fri, 4 Dec 2020 16:07:51 -0500 Subject: [PATCH 2/2] cleanup log line --- src/main/java/org/datadog/jmxfetch/Instance.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/datadog/jmxfetch/Instance.java b/src/main/java/org/datadog/jmxfetch/Instance.java index c09f5f7b8..de5cb9b99 100644 --- a/src/main/java/org/datadog/jmxfetch/Instance.java +++ b/src/main/java/org/datadog/jmxfetch/Instance.java @@ -226,9 +226,10 @@ public Instance( Boolean collectDefaultJvmMetrics = (Boolean) instanceMap.get("collect_default_jvm_metrics"); if (collectDefaultJvmMetrics == null || collectDefaultJvmMetrics) { - log.info("collect_default_jvm_metrics is true - not collecting default JVM metrics"); loadDefaultConfig("default-jmx-metrics.yaml"); loadDefaultConfig(gcMetricConfig); + } else { + log.info("collect_default_jvm_metrics is false - not collecting default JVM metrics"); } }