From fde259389797895a6054cce5743f105e5a71c368 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 8 Jul 2025 16:39:20 +0200 Subject: [PATCH 1/9] fix: Use BufferedInputStream to read config files --- src/main/java/org/datadog/jmxfetch/App.java | 9 ++------- src/main/java/org/datadog/jmxfetch/Instance.java | 14 +++----------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/datadog/jmxfetch/App.java b/src/main/java/org/datadog/jmxfetch/App.java index 9983267b..69b541f1 100644 --- a/src/main/java/org/datadog/jmxfetch/App.java +++ b/src/main/java/org/datadog/jmxfetch/App.java @@ -16,12 +16,7 @@ import org.datadog.jmxfetch.util.LogLevel; import org.datadog.jmxfetch.util.ServiceCheckHelper; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.lang.management.ManagementFactory; import java.nio.charset.Charset; import java.util.ArrayList; @@ -764,7 +759,7 @@ private void loadFileConfigs(final AppConfig config, final Map> confs = (List>) YAML.get().load(yamlInputStream); @@ -330,14 +330,6 @@ static void loadMetricConfigFiles( log.warn("Cannot find metric config file " + yamlPath); } catch (Exception e) { log.warn("Cannot parse yaml file " + yamlPath, e); - } finally { - if (yamlInputStream != null) { - try { - yamlInputStream.close(); - } catch (IOException e) { - // ignore - } - } } } } From 14d4a9418e6e50d355bba3bb4f58acaed9e8f750 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 8 Jul 2025 18:28:32 +0200 Subject: [PATCH 2/9] fix: File Descriptor leak # Conflicts: # src/main/java/org/datadog/jmxfetch/Instance.java --- .../java/org/datadog/jmxfetch/Instance.java | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/datadog/jmxfetch/Instance.java b/src/main/java/org/datadog/jmxfetch/Instance.java index 5fe72bea..cacdda75 100644 --- a/src/main/java/org/datadog/jmxfetch/Instance.java +++ b/src/main/java/org/datadog/jmxfetch/Instance.java @@ -7,8 +7,6 @@ import org.datadog.jmxfetch.util.InstanceTelemetry; import org.yaml.snakeyaml.Yaml; - - import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -297,11 +295,14 @@ public static boolean isDirectInstance(Map configInstance) { } private void loadDefaultConfig(String configResourcePath) { - List> defaultConf = - (List>) - YAML.get().load(this.getClass().getResourceAsStream(configResourcePath)); - for (Map conf : defaultConf) { - configurationList.add(new Configuration(conf)); + try (InputStream is = this.getClass().getResourceAsStream(configResourcePath)) { + List> defaultConf; + defaultConf = YAML.get().load(is); + for (Map conf : defaultConf) { + configurationList.add(new Configuration(conf)); + } + } catch (IOException e) { + log.warn("Cannot parse internal default config file {}", configResourcePath, e); } } @@ -440,40 +441,40 @@ public void init(boolean forceNewConnection) throws IOException, FailedLoginException, SecurityException { log.info("Trying to connect to JMX Server at " + this.toString()); connection = getConnection(instanceMap, forceNewConnection); - + log.info( "Trying to collect bean list for the first time for JMX Server at {}", this); this.refreshBeansList(); this.initialRefreshTime = this.lastRefreshTime; log.info("Connected to JMX Server at {} with {} beans", this, this.beans.size()); - + // Resolve configuration-level dynamic tags for all configurations // Must be done after refreshBeansList() so the beans exist resolveConfigurationDynamicTags(); - + this.getMatchingAttributes(); log.info("Done initializing JMX Server at {}", this); } - + private void resolveConfigurationDynamicTags() { if (configurationList == null || configurationList.isEmpty()) { return; } - + this.dynamicTagsCache = new HashMap<>(); List allDynamicTags = new ArrayList<>(); - + for (Configuration config : configurationList) { List dynamicTags = config.getDynamicTags(); if (dynamicTags != null && !dynamicTags.isEmpty()) { allDynamicTags.addAll(dynamicTags); } } - + if (allDynamicTags.isEmpty()) { return; } - + int successfulResolutions = 0; for (DynamicTag dynamicTag : allDynamicTags) { String cacheKey = dynamicTag.getBeanAttributeKey(); @@ -487,30 +488,30 @@ private void resolveConfigurationDynamicTags() { successfulResolutions++; } } - - log.info("Resolved {} unique dynamic tag(s) from {} total references for instance {}", + + log.info("Resolved {} unique dynamic tag(s) from {} total references for instance {}", successfulResolutions, allDynamicTags.size(), instanceName); } - + /** * Get resolved dynamic tags for a specific configuration. * This resolves the dynamic tags defined in the configuration using the cached values. - * + * * @param config the configuration to get resolved tags for * @return map of tag name to tag value */ private Map getResolvedDynamicTagsForConfig(Configuration config) { Map resolvedTags = new HashMap<>(); - + if (this.dynamicTagsCache == null || this.dynamicTagsCache.isEmpty()) { return resolvedTags; } - + List dynamicTags = config.getDynamicTags(); if (dynamicTags == null || dynamicTags.isEmpty()) { return resolvedTags; } - + for (DynamicTag dynamicTag : dynamicTags) { String cacheKey = dynamicTag.getBeanAttributeKey(); Map.Entry cached = this.dynamicTagsCache.get(cacheKey); @@ -518,7 +519,7 @@ private Map getResolvedDynamicTagsForConfig(Configuration config resolvedTags.put(cached.getKey(), cached.getValue()); } } - + return resolvedTags; } @@ -756,7 +757,7 @@ private void getMatchingAttributes() throws IOException { for (Configuration conf : configurationList) { try { if (jmxAttribute.match(conf)) { - Map resolvedDynamicTags = + Map resolvedDynamicTags = getResolvedDynamicTagsForConfig(conf); jmxAttribute.setResolvedDynamicTags(resolvedDynamicTags); jmxAttribute.setMatchingConf(conf); From caedd9c0de0085a354011b5787ece1b0820e1ea6 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 8 Jul 2025 17:08:33 +0200 Subject: [PATCH 3/9] chore: Rewrite temp configuration test code --- .../java/org/datadog/jmxfetch/TestCommon.java | 87 ++++++++++--------- .../org/datadog/jmxfetch/TestGCMetrics.java | 34 +++++--- .../jmxfetch/TestReconnectContainer.java | 74 +++++++--------- 3 files changed, 96 insertions(+), 99 deletions(-) diff --git a/src/test/java/org/datadog/jmxfetch/TestCommon.java b/src/test/java/org/datadog/jmxfetch/TestCommon.java index f97ea46f..2ca3ff71 100644 --- a/src/test/java/org/datadog/jmxfetch/TestCommon.java +++ b/src/test/java/org/datadog/jmxfetch/TestCommon.java @@ -6,12 +6,9 @@ import com.beust.jcommander.JCommander; -import java.io.BufferedWriter; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.io.IOException; +import java.io.*; import java.lang.management.ManagementFactory; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -33,27 +30,29 @@ import org.datadog.jmxfetch.util.CustomLogger; import org.datadog.jmxfetch.util.MetricsAssert; import org.datadog.jmxfetch.util.LogLevel; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; +/** + * Config utility + */ final class ConfigUtil { - public static Path writeConfigYamlToTemp(String content, String yamlName) throws IOException { - Path tempDirectory = Files.createTempDirectory("temp-dir"); - // Create a temporary file within the temporary directory - Path tempFile = Files.createTempFile(tempDirectory, yamlName, ".yaml"); + public final Path tempConfdDir; - // Write the contents of the file to the temporary file - BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile.toFile())); - writer.write(content); - writer.close(); - - return tempFile; + public ConfigUtil(File file) { + this.tempConfdDir = file.toPath(); } - public static String concatWithNewlines(String... lines) { - StringBuilder sb = new StringBuilder(); - for (String line : lines) { - sb.append(line).append(System.lineSeparator()); + public Path makeTempYamlConfigFile(String yamlName, List lines) { + try { + return Files.write( + Files.createTempFile(tempConfdDir, yamlName, ".yaml"), + lines, + StandardCharsets.UTF_8 + ); + } catch (IOException e) { + throw new UncheckedIOException(e); } - return sb.toString(); } } @@ -66,9 +65,12 @@ public class TestCommon { List> metrics = new ArrayList<>(); List> serviceChecks; + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + /** Setup logger. */ @BeforeClass - public static void init() throws Exception { + public static void init() { String level = System.getProperty("tests.log_level"); if (level == null) { level = "ALL"; @@ -132,10 +134,7 @@ protected void initApplication(String yamlFileName, String autoDiscoveryPipeFile // We initialize the main app that will collect these metrics using JMX String confdDirectory = Thread.currentThread().getContextClassLoader().getResource(yamlFileName).getPath(); - confdDirectory = - new String( - confdDirectory.substring( - 0, confdDirectory.length() - yamlFileName.length())); + confdDirectory = confdDirectory.substring(0, confdDirectory.length() - yamlFileName.length()); List params = new ArrayList(); boolean sdEnabled = (autoDiscoveryPipeFile.length() > 0); params.add("--reporter"); @@ -154,7 +153,7 @@ protected void initApplication(String yamlFileName, String autoDiscoveryPipeFile params.add(5, "/foo"); // could be anything we're stubbing it out params.add(6, "--sd_enabled"); } - new JCommander(appConfig, params.toArray(new String[params.size()])); + new JCommander(appConfig, params.toArray(new String[0])); if (sdEnabled) { String autoDiscoveryPipe = @@ -179,7 +178,7 @@ protected void initApplication(String yamlFileName, String autoDiscoveryPipeFile app.init(false); } - protected void initApplication(String yamlFileName) throws FileNotFoundException, IOException { + protected void initApplication(String yamlFileName) throws IOException { initApplication(yamlFileName, ""); } @@ -188,31 +187,37 @@ protected void initApplication(String yamlFileName) throws FileNotFoundException * The configuration can be specified as a yaml literal with each arg * representing one line of the Yaml file * Does not support any SD/AD features. + * + * @param yamlConfigContents the YAML configuration contents, each representing a configuration file */ - protected void initApplicationWithYamlLines(String... yamlLines) - throws IOException { - String yamlConfig = ConfigUtil.concatWithNewlines(yamlLines); - Path tempFile = ConfigUtil.writeConfigYamlToTemp(yamlConfig, "config"); + protected void initApplicationWithYamlLines(Path... yamlConfigs) { + if (yamlConfigs == null || yamlConfigs.length == 0) { + throw new IllegalArgumentException("yamlConfigContents cannot be null or empty"); + } - String confdDirectory = tempFile.getParent().toString(); - String yamlFileName = tempFile.getFileName().toString(); + String confdDirectory = yamlConfigs[0].getParent().toString(); - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("--reporter"); params.add("console"); - if (confdDirectory != null) { + for (Path yamlConfig : yamlConfigs) { params.add("-c"); - params.add(yamlFileName); - params.add("--conf_directory"); - params.add(confdDirectory); - params.add("collect"); + params.add(yamlConfig.getFileName().toString()); } - new JCommander(appConfig, params.toArray(new String[params.size()])); + + params.add("--conf_directory"); + params.add(confdDirectory); + params.add("collect"); + + new JCommander(appConfig, params.toArray(new String[0])); this.app = new App(appConfig); app.init(false); } + ConfigUtil getConfigUtil() { + return new ConfigUtil(temporaryFolder.getRoot()); + } /** Run a JMXFetch iteration. */ protected void run() { @@ -255,7 +260,7 @@ protected List> getServiceChecks() { * @param additionalTags metric tags inherited from the bean properties * @param countTags number of metric tags * @param metricType type of the metric (gauge, histogram, ...) - * @return fail if the metric was not found + * @throws AssertionError if the metric was not found */ public void assertMetric( String name, diff --git a/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java b/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java index a180c35e..7c01e033 100644 --- a/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java +++ b/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java @@ -181,21 +181,29 @@ public void testDefaultNewGCMetricsIBMJ9Gencon() throws IOException { "jvm.gc.major_collection_time", "global", "counter"); } } - - private List> startAndGetMetrics(final MisbehavingJMXServer server, - final boolean newGCMetrics) throws IOException { + + private List> startAndGetMetrics( + final MisbehavingJMXServer server, + final boolean newGCMetrics + ) { server.start(); this.initApplicationWithYamlLines( - "init_config:", - " is_jmx: true", - " new_gc_metrics: " + newGCMetrics, - "", - "instances:", - " - name: jmxint_container", - " host: " + server.getIp(), - " collect_default_jvm_metrics: true", - " max_returned_metrics: 300000", - " port: " + server.getRMIPort()); + getConfigUtil().makeTempYamlConfigFile( + "config", + Arrays.asList( + "init_config:", + " is_jmx: true", + " new_gc_metrics: " + newGCMetrics, + "", + "instances:", + " - name: jmxint_container", + " host: " + server.getIp(), + " collect_default_jvm_metrics: true", + " max_returned_metrics: 300000", + " port: " + server.getRMIPort() + ) + ) + ); // Run one iteration first // TODO: Investigate why we have to run this twice - AMLII-1353 this.app.doIteration(); diff --git a/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java b/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java index 1d9e162a..d70335c5 100644 --- a/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java +++ b/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java @@ -7,6 +7,8 @@ import static org.datadog.jmxfetch.util.MetricsAssert.isDomainPresent; import java.io.IOException; +import java.nio.file.Path; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; @@ -135,22 +137,9 @@ public void testJMXDirectReconnect() throws Exception { } @Test - public void testJMXFetchBasic() throws IOException, InterruptedException { + public void testJMXFetchBasic() { String ipAddress = cont.getContainerInfo().getNetworkSettings().getIpAddress(); - this.initApplicationWithYamlLines( - "init_config:", - " is_jmx: true", - "", - "instances:", - " - name: jmxint_container", - " host: " + ipAddress, - " collect_default_jvm_metrics: false", - " max_returned_metrics: 300000", - " port: " + rmiPort, - " conf:", - " - include:", - " domain: Bohnanza" - ); + this.initApplicationWithYamlLines(config(ipAddress, "Bohnanza")); this.app.doIteration(); List> metrics = ((ConsoleReporter) this.appConfig.getReporter()).getMetrics(); @@ -158,27 +147,14 @@ public void testJMXFetchBasic() throws IOException, InterruptedException { } @Test - public void testJMXFetchManyMetrics() throws IOException, InterruptedException { + public void testJMXFetchManyMetrics() throws IOException { String ipAddress = cont.getContainerInfo().getNetworkSettings().getIpAddress(); int numBeans = 100; int numAttributesPerBean = 4; String testDomain = "test-domain"; this.controlClient.createMBeans(testDomain, numBeans, numAttributesPerBean, 0, 0); - this.initApplicationWithYamlLines( - "init_config:", - " is_jmx: true", - "", - "instances:", - " - name: jmxint_container", - " host: " + ipAddress, - " collect_default_jvm_metrics: false", - " max_returned_metrics: 300000", - " port: " + rmiPort, - " conf:", - " - include:", - " domain: " + testDomain - ); + this.initApplicationWithYamlLines(config(ipAddress, testDomain)); this.app.doIteration(); List> metrics = ((ConsoleReporter) this.appConfig.getReporter()).getMetrics(); @@ -187,22 +163,9 @@ public void testJMXFetchManyMetrics() throws IOException, InterruptedException { } @Test - public void testJMXFetchReconnect() throws IOException, InterruptedException { + public void testJMXFetchReconnect() throws IOException { String ipAddress = cont.getContainerInfo().getNetworkSettings().getIpAddress(); - this.initApplicationWithYamlLines( - "init_config:", - " is_jmx: true", - "", - "instances:", - " - name: jmxint_container", - " host: " + ipAddress, - " collect_default_jvm_metrics: false", - " max_returned_metrics: 300000", - " port: " + rmiPort, - " conf:", - " - include:", - " domain: Bohnanza" - ); + this.initApplicationWithYamlLines(config(ipAddress, "Bohnanza")); this.app.doIteration(); @@ -232,4 +195,25 @@ public void testJMXFetchReconnect() throws IOException, InterruptedException { metrics = ((ConsoleReporter) this.appConfig.getReporter()).getMetrics(); assertEquals(1, metrics.size()); } + + private Path config(String ipAddress, String domain) { + return getConfigUtil().makeTempYamlConfigFile( + "config", + Arrays.asList( + "init_config:", + " is_jmx: true", + "", + "instances:", + " - name: jmxint_container", + " host: " + ipAddress, + " collect_default_jvm_metrics: false", + " max_returned_metrics: 300000", + " port: " + rmiPort, + " conf:", + " - include:", + " domain: " + domain + ) + ); + } + } From 279048f773c5aa76201d30f83b405a1ceb2e3774 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 8 Jul 2025 18:28:12 +0200 Subject: [PATCH 4/9] chore: Test ZGC memory pools --- .../java/org/datadog/jmxfetch/Instance.java | 8 ++- .../datadog/jmxfetch/default-jmx-metrics.yaml | 11 ++++ .../java/org/datadog/jmxfetch/TestCommon.java | 36 +++------- .../org/datadog/jmxfetch/TestGCMetrics.java | 66 ++++++++++++++++--- .../jmxfetch/TestReconnectContainer.java | 2 +- .../datadog/jmxfetch/util/MetricsAssert.java | 6 +- ...ml => simplified-default-jmx-metrics.yaml} | 0 7 files changed, 90 insertions(+), 39 deletions(-) rename src/test/resources/org/datadog/jmxfetch/{default-jmx-metrics.yaml => simplified-default-jmx-metrics.yaml} (100%) diff --git a/src/main/java/org/datadog/jmxfetch/Instance.java b/src/main/java/org/datadog/jmxfetch/Instance.java index cacdda75..72493d6b 100644 --- a/src/main/java/org/datadog/jmxfetch/Instance.java +++ b/src/main/java/org/datadog/jmxfetch/Instance.java @@ -243,7 +243,13 @@ public Instance( Boolean collectDefaultJvmMetrics = (Boolean) instanceMap.get("collect_default_jvm_metrics"); if (collectDefaultJvmMetrics == null || collectDefaultJvmMetrics) { - loadDefaultConfig("default-jmx-metrics.yaml"); + // override the test definitions + Object value = instanceMap.get("default-jmx-metrics-definitions"); + if (value instanceof String) { + loadDefaultConfig((String) value); + } else { + loadDefaultConfig("default-jmx-metrics.yaml"); + } loadDefaultConfig(gcMetricConfig); } else { log.info("collect_default_jvm_metrics is false - not collecting default JVM metrics"); diff --git a/src/main/resources/org/datadog/jmxfetch/default-jmx-metrics.yaml b/src/main/resources/org/datadog/jmxfetch/default-jmx-metrics.yaml index ffcaa7a7..7206d39e 100644 --- a/src/main/resources/org/datadog/jmxfetch/default-jmx-metrics.yaml +++ b/src/main/resources/org/datadog/jmxfetch/default-jmx-metrics.yaml @@ -133,6 +133,7 @@ Usage.used: alias: jvm.gc.eden_size metric_type: gauge +# Generational ZGC - include: domain: java.lang type: MemoryPool @@ -197,6 +198,16 @@ Usage.used: alias: jvm.gc.old_gen_size metric_type: gauge +# Non-Generational ZGC +- include: + domain: java.lang + type: MemoryPool + name: ZHeap + attribute: + Usage.used: + alias: jvm.gc.old_gen_size + metric_type: gauge +# Generational ZGC - include: domain: java.lang type: MemoryPool diff --git a/src/test/java/org/datadog/jmxfetch/TestCommon.java b/src/test/java/org/datadog/jmxfetch/TestCommon.java index 2ca3ff71..9b72c3a8 100644 --- a/src/test/java/org/datadog/jmxfetch/TestCommon.java +++ b/src/test/java/org/datadog/jmxfetch/TestCommon.java @@ -33,30 +33,6 @@ import org.junit.Rule; import org.junit.rules.TemporaryFolder; -/** - * Config utility - */ -final class ConfigUtil { - public final Path tempConfdDir; - - public ConfigUtil(File file) { - this.tempConfdDir = file.toPath(); - } - - public Path makeTempYamlConfigFile(String yamlName, List lines) { - try { - return Files.write( - Files.createTempFile(tempConfdDir, yamlName, ".yaml"), - lines, - StandardCharsets.UTF_8 - ); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } -} - - public class TestCommon { AppConfig appConfig = spy(AppConfig.builder().build()); App app; @@ -215,8 +191,16 @@ protected void initApplicationWithYamlLines(Path... yamlConfigs) { app.init(false); } - ConfigUtil getConfigUtil() { - return new ConfigUtil(temporaryFolder.getRoot()); + public Path makeTempYamlConfigFile(String yamlName, List lines) { + try { + return Files.write( + Files.createTempFile(temporaryFolder.getRoot().toPath(), yamlName, ".yaml"), + lines, + StandardCharsets.UTF_8 + ); + } catch (IOException e) { + throw new UncheckedIOException(e); + } } /** Run a JMXFetch iteration. */ diff --git a/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java b/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java index 7c01e033..568aea24 100644 --- a/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java +++ b/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java @@ -49,7 +49,7 @@ public void testJMXDirectBasic() throws Exception { } @Test - public void testDefaultOldGC() throws IOException { + public void testDefaultOldGC() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().build()) { final List> actualMetrics = startAndGetMetrics(server, false); List gcGenerations = Arrays.asList( @@ -61,7 +61,7 @@ public void testDefaultOldGC() throws IOException { } @Test - public void testDefaultNewGCMetricsUseParallelGC() throws IOException { + public void testDefaultNewGCMetricsUseParallelGC() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().withJDKImage( JDK_11).appendJavaOpts("-XX:+UseParallelGC").build()) { final List> actualMetrics = startAndGetMetrics(server, true); @@ -95,7 +95,7 @@ public void testDefaultNewGCMetricsUseConcMarkSweepGC() throws IOException { } @Test - public void testDefaultNewGCMetricsUseG1GC() throws IOException { + public void testDefaultNewGCMetricsUseG1GC() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().withJDKImage( JDK_17).appendJavaOpts("-XX:+UseG1GC").build()) { final List> actualMetrics = startAndGetMetrics(server, true); @@ -112,7 +112,26 @@ public void testDefaultNewGCMetricsUseG1GC() throws IOException { } @Test - public void testDefaultNewGCMetricsUseZGC() throws IOException { + public void zgcMemoryPools() { + try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder() + .withJDKImage(JDK_17).appendJavaOpts("-XX:+UseZGC").build()) { + List> maps = startAndGetMetrics(server, true, false); + assertMemoryPoolMetric(maps, "jvm.gc.old_gen_size", "ZHeap"); + } + } + + @Test + public void zgcGenerationalMemoryPools() { + try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder() + .withJDKImage(JDK_21).appendJavaOpts("-XX:+UseZGC").appendJavaOpts("-XX:+ZGenerational").build()) { + List> maps = startAndGetMetrics(server, true, false); + assertMemoryPoolMetric(maps, "jvm.gc.eden_size", "ZGC Young Generation"); + assertMemoryPoolMetric(maps, "jvm.gc.old_gen_size", "ZGC Old Generation"); + } + } + + @Test + public void testDefaultNewGCMetricsUseZGC() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().withJDKImage( JDK_17).appendJavaOpts("-XX:+UseZGC").build()) { final List> actualMetrics = startAndGetMetrics(server, true); @@ -129,7 +148,7 @@ public void testDefaultNewGCMetricsUseZGC() throws IOException { } @Test - public void testDefaultNewGCMetricsUseGenerationalZGC() throws IOException { + public void testDefaultNewGCMetricsUseGenerationalZGC() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().withJDKImage( JDK_21).appendJavaOpts("-XX:+UseZGC -XX:+ZGenerational").build()) { final List> actualMetrics = startAndGetMetrics(server, true); @@ -149,7 +168,7 @@ public void testDefaultNewGCMetricsUseGenerationalZGC() throws IOException { } @Test - public void testDefaultNewGCMetricsIBMJ9Balanced() throws IOException { + public void testDefaultNewGCMetricsIBMJ9Balanced() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().withJDKImage( JDK_11_OPENJ9).appendJavaOpts("-Xgcpolicy:balanced").build()) { final List> actualMetrics = startAndGetMetrics(server, true); @@ -166,7 +185,7 @@ public void testDefaultNewGCMetricsIBMJ9Balanced() throws IOException { } @Test - public void testDefaultNewGCMetricsIBMJ9Gencon() throws IOException { + public void testDefaultNewGCMetricsIBMJ9Gencon() { try (final MisbehavingJMXServer server = new MisbehavingJMXServer.Builder().withJDKImage( JDK_11_OPENJ9).appendJavaOpts("-Xgcpolicy:gencon").build()) { final List> actualMetrics = startAndGetMetrics(server, true); @@ -186,9 +205,19 @@ private List> startAndGetMetrics( final MisbehavingJMXServer server, final boolean newGCMetrics ) { + return startAndGetMetrics(server, newGCMetrics, true); + } + + private List> startAndGetMetrics( + final MisbehavingJMXServer server, + final boolean newGCMetrics, + boolean useSimplifiedDefaultConfig + ) { + String defaultConfig = useSimplifiedDefaultConfig ? "default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml" : ""; + server.start(); this.initApplicationWithYamlLines( - getConfigUtil().makeTempYamlConfigFile( + makeTempYamlConfigFile( "config", Arrays.asList( "init_config:", @@ -199,6 +228,7 @@ private List> startAndGetMetrics( " - name: jmxint_container", " host: " + server.getIp(), " collect_default_jvm_metrics: true", + " " + defaultConfig, " max_returned_metrics: 300000", " port: " + server.getRMIPort() ) @@ -234,6 +264,26 @@ private static void assertGCMetric(final List> actualMetrics actualMetrics); } + private static void assertMemoryPoolMetric( + final List> actualMetrics, + final String expectedMetric, + String poolName + ) { + MetricsAssert.assertMetric( + expectedMetric, + -1, + -1, + -1, + Collections.singletonList(String.format("name:%s", poolName)), + Arrays.asList( + "instance:jmxint_container", + "jmx_domain:java.lang", + "type:MemoryPool"), + 5, + "gauge", + actualMetrics); + } + /* This function is needed as the TestGCMetrics.testDefaultOldGC asserts on two metrics that have different tags. MetricsAssert.assertMetric expects metrics to have unique names so can't be used diff --git a/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java b/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java index d70335c5..0c0e19a5 100644 --- a/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java +++ b/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java @@ -197,7 +197,7 @@ public void testJMXFetchReconnect() throws IOException { } private Path config(String ipAddress, String domain) { - return getConfigUtil().makeTempYamlConfigFile( + return makeTempYamlConfigFile( "config", Arrays.asList( "init_config:", diff --git a/src/test/java/org/datadog/jmxfetch/util/MetricsAssert.java b/src/test/java/org/datadog/jmxfetch/util/MetricsAssert.java index 3302e5d6..95043976 100644 --- a/src/test/java/org/datadog/jmxfetch/util/MetricsAssert.java +++ b/src/test/java/org/datadog/jmxfetch/util/MetricsAssert.java @@ -41,10 +41,10 @@ public static void assertMetric( if (mName.equals(name)) { if (!value.equals(-1)) { - assertEquals((Double) value.doubleValue(), mValue); + assertEquals("Measured value must be equal to value", (Double) value.doubleValue(), mValue); } else if (!lowerBound.equals(-1) || !upperBound.equals(-1)) { - assertTrue(mValue > (Double) lowerBound.doubleValue()); - assertTrue(mValue < (Double) upperBound.doubleValue()); + assertTrue("Measured value must be greater than lower bound", mValue > (Double) lowerBound.doubleValue()); + assertTrue("Measured value must be lesser than lower bound", mValue < (Double) upperBound.doubleValue()); } if (countTags != -1) { diff --git a/src/test/resources/org/datadog/jmxfetch/default-jmx-metrics.yaml b/src/test/resources/org/datadog/jmxfetch/simplified-default-jmx-metrics.yaml similarity index 100% rename from src/test/resources/org/datadog/jmxfetch/default-jmx-metrics.yaml rename to src/test/resources/org/datadog/jmxfetch/simplified-default-jmx-metrics.yaml From f79bffca920569e956b47faaef0a9fdcb4cd1e04 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 8 Jul 2025 18:45:33 +0200 Subject: [PATCH 5/9] chore: Checkstyle nitpicks --- src/main/java/org/datadog/jmxfetch/App.java | 11 +++++++++-- src/main/java/org/datadog/jmxfetch/Instance.java | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/datadog/jmxfetch/App.java b/src/main/java/org/datadog/jmxfetch/App.java index 69b541f1..2fccea37 100644 --- a/src/main/java/org/datadog/jmxfetch/App.java +++ b/src/main/java/org/datadog/jmxfetch/App.java @@ -16,7 +16,13 @@ import org.datadog.jmxfetch.util.LogLevel; import org.datadog.jmxfetch.util.ServiceCheckHelper; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.lang.management.ManagementFactory; import java.nio.charset.Charset; import java.util.ArrayList; @@ -759,7 +765,8 @@ private void loadFileConfigs(final AppConfig config, final Map> confs = (List>) YAML.get().load(yamlInputStream); From 653018e7ee3b62a68e4e67981b3e9986b828111e Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 3 Feb 2026 16:34:45 +0100 Subject: [PATCH 6/9] fix: TestGCMetrics was improperly creating config when useSimplifiedDefaultConfig was false When useSimplifiedDefaultConfig is false, defaultConfig is an empty string, which creates a line with just 8 spaces in the YAML file. This isn't ideal YAML formatting and could potentially cause issues with YAML parsers. --- .../java/org/datadog/jmxfetch/Instance.java | 4 ++ .../org/datadog/jmxfetch/TestGCMetrics.java | 38 ++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/datadog/jmxfetch/Instance.java b/src/main/java/org/datadog/jmxfetch/Instance.java index 87ba0302..bff49e91 100644 --- a/src/main/java/org/datadog/jmxfetch/Instance.java +++ b/src/main/java/org/datadog/jmxfetch/Instance.java @@ -302,6 +302,10 @@ public static boolean isDirectInstance(Map configInstance) { private void loadDefaultConfig(String configResourcePath) { try (InputStream is = this.getClass().getResourceAsStream(configResourcePath)) { + if (is == null) { + log.warn("Cannot find internal default config file {}", configResourcePath); + return; + } List> defaultConf; defaultConf = YAML.get().load(is); for (Map conf : defaultConf) { diff --git a/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java b/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java index 568aea24..b4820939 100644 --- a/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java +++ b/src/test/java/org/datadog/jmxfetch/TestGCMetrics.java @@ -213,26 +213,28 @@ private List> startAndGetMetrics( final boolean newGCMetrics, boolean useSimplifiedDefaultConfig ) { - String defaultConfig = useSimplifiedDefaultConfig ? "default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml" : ""; - server.start(); + + List configLines = new ArrayList<>(Arrays.asList( + "init_config:", + " is_jmx: true", + " new_gc_metrics: " + newGCMetrics, + "", + "instances:", + " - name: jmxint_container", + " host: " + server.getIp(), + " collect_default_jvm_metrics: true" + )); + + if (useSimplifiedDefaultConfig) { + configLines.add(" default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml"); + } + + configLines.add(" max_returned_metrics: 300000"); + configLines.add(" port: " + server.getRMIPort()); + this.initApplicationWithYamlLines( - makeTempYamlConfigFile( - "config", - Arrays.asList( - "init_config:", - " is_jmx: true", - " new_gc_metrics: " + newGCMetrics, - "", - "instances:", - " - name: jmxint_container", - " host: " + server.getIp(), - " collect_default_jvm_metrics: true", - " " + defaultConfig, - " max_returned_metrics: 300000", - " port: " + server.getRMIPort() - ) - ) + makeTempYamlConfigFile("config", configLines) ); // Run one iteration first // TODO: Investigate why we have to run this twice - AMLII-1353 From 50e45bd0b39d33a8c698bb3c7706b902e577bc86 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 3 Feb 2026 17:14:03 +0100 Subject: [PATCH 7/9] fix: Update CI workflow to fix failing checks - Replace unavailable openjdk:7-jdk image with azul/zulu-openjdk:7 - Remove docker/setup-docker-action as Docker is pre-installed on GitHub runners --- .github/workflows/test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2fca5d81..62632713 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: run: ./mvnw clean package -DskipTests - name: Run using JDK 7 - run: docker run -i --rm -v $(pwd):/app -w /app openjdk:7-jdk java -jar ./target/jmxfetch-0.51.1-SNAPSHOT-jar-with-dependencies.jar --help + run: docker run -i --rm -v $(pwd):/app -w /app azul/zulu-openjdk:7 java -jar ./target/jmxfetch-0.51.1-SNAPSHOT-jar-with-dependencies.jar --help test: name: Test (OpenJDK ${{ matrix.java-version }}) @@ -95,10 +95,7 @@ jobs: restore-keys: | ${{ runner.os }}-m2-${{ github.ref }}- ${{ runner.os }}-m2- - - - name: Set up Docker - uses: docker/setup-docker-action@b60f85385d03ac8acfca6d9996982511d8620a19 # v4.3.0 - + - name: Run tests run: ./mvnw test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dtests.log_level=info -Djdk.attach.allowAttachSelf=true From 1703a078b8556c036698df5a43f242346513f34b Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 3 Feb 2026 18:12:01 +0100 Subject: [PATCH 8/9] fix: Update test config to use simplified default metrics After renaming the test's default-jmx-metrics.yaml to simplified-default-jmx-metrics.yaml in 279048f, the test was loading the full production default metrics instead of the simplified version, causing the test to collect 28 metrics instead of the expected 14. This fix explicitly sets default-jmx-metrics-definitions to use the simplified version. --- src/test/java/org/datadog/jmxfetch/TestInstance.java | 2 +- src/test/resources/jmx.yaml | 1 + src/test/resources/jmx_additional_tags.yaml | 1 + src/test/resources/jmx_alias_match.yaml | 1 + src/test/resources/jmx_baseline_default_hostname.yaml | 1 + src/test/resources/jmx_bean_regex_tags.yaml | 1 + src/test/resources/jmx_bean_scope.yaml | 1 + src/test/resources/jmx_bean_tags.yaml | 1 + src/test/resources/jmx_bean_tags_dont_normalize_params.yaml | 1 + src/test/resources/jmx_bean_tags_normalize_params.yaml | 1 + src/test/resources/jmx_canonical.yaml | 1 + src/test/resources/jmx_cassandra.yaml | 2 ++ src/test/resources/jmx_cassandra_deprecated.yaml | 1 + src/test/resources/jmx_cast.yaml | 1 + src/test/resources/jmx_check_no_prefix.yaml | 1 + src/test/resources/jmx_check_prefix.yaml | 1 + src/test/resources/jmx_class_exclude.yaml | 1 + src/test/resources/jmx_class_include.yaml | 1 + src/test/resources/jmx_class_regex.yaml | 1 + src/test/resources/jmx_config_dynamic_tags.yaml | 1 + src/test/resources/jmx_config_dynamic_tags_bean_params.yaml | 1 + src/test/resources/jmx_config_dynamic_tags_caching.yaml | 1 + src/test/resources/jmx_config_dynamic_tags_invalid.yaml | 1 + src/test/resources/jmx_config_dynamic_tags_multi.yaml | 1 + .../resources/jmx_config_dynamic_tags_multiple_per_conf.yaml | 1 + src/test/resources/jmx_count.yaml | 1 + src/test/resources/jmx_counter_rate.yaml | 2 ++ src/test/resources/jmx_domain_exclude.yaml | 1 + src/test/resources/jmx_domain_include.yaml | 1 + src/test/resources/jmx_domain_regex.yaml | 1 + src/test/resources/jmx_empty_default_hostname.yaml | 1 + src/test/resources/jmx_exclude_tags.yaml | 1 + src/test/resources/jmx_exclude_tags_override_service.yaml | 1 + src/test/resources/jmx_filter_issues.yaml | 1 + src/test/resources/jmx_filter_list_support.yaml | 1 + src/test/resources/jmx_filtering_test.yaml | 1 + src/test/resources/jmx_histogram.yaml | 1 + src/test/resources/jmx_jee_data.yaml | 1 + src/test/resources/jmx_list_beans_exclude.yaml | 1 + src/test/resources/jmx_list_beans_include.yaml | 1 + src/test/resources/jmx_list_beans_regex_exclude.yaml | 1 + src/test/resources/jmx_list_beans_regex_include.yaml | 1 + src/test/resources/jmx_list_params_exclude.yaml | 1 + src/test/resources/jmx_list_params_include.yaml | 1 + src/test/resources/jmx_min_collection_period.yml | 1 + src/test/resources/jmx_no_alias.yaml | 1 + .../resources/jmx_non_parsable_max_returned_metrics_string.yaml | 1 + .../resources/jmx_parsable_max_returned_metrics_string.yaml | 1 + src/test/resources/jmx_refresh_beans.yaml | 1 + src/test/resources/jmx_service_tag_global.yaml | 2 ++ src/test/resources/jmx_service_tag_global_list.yaml | 2 ++ src/test/resources/jmx_service_tag_instance_override.yaml | 2 ++ src/test/resources/jmx_tabular_data_tagged.yaml | 1 + src/test/resources/jmx_tabular_data_tagless.yaml | 1 + src/test/resources/non_running_process.yaml | 1 + src/test/resources/too_many_metrics.yaml | 1 + 56 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/datadog/jmxfetch/TestInstance.java b/src/test/java/org/datadog/jmxfetch/TestInstance.java index 3a1d4b1a..8c36bf18 100644 --- a/src/test/java/org/datadog/jmxfetch/TestInstance.java +++ b/src/test/java/org/datadog/jmxfetch/TestInstance.java @@ -194,7 +194,7 @@ public void testServiceTagInstanceOverride() throws Exception { @Test public void testLoadMetricConfigFiles() throws Exception { - URL defaultConfig = Instance.class.getResource("default-jmx-metrics.yaml"); + URL defaultConfig = Instance.class.getResource("simplified-default-jmx-metrics.yaml"); AppConfig config = mock(AppConfig.class); when(config.getMetricConfigFiles()).thenReturn(Collections.singletonList(defaultConfig.getPath())); List configurationList = new ArrayList(); diff --git a/src/test/resources/jmx.yaml b/src/test/resources/jmx.yaml index 4cdadc8f..cbf09cb0 100644 --- a/src/test/resources/jmx.yaml +++ b/src/test/resources/jmx.yaml @@ -2,6 +2,7 @@ init_config: instances: - jvm_direct: true + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance tags: diff --git a/src/test/resources/jmx_additional_tags.yaml b/src/test/resources/jmx_additional_tags.yaml index f6e4ea8c..2ea72781 100644 --- a/src/test/resources/jmx_additional_tags.yaml +++ b/src/test/resources/jmx_additional_tags.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_alias_match.yaml b/src/test/resources/jmx_alias_match.yaml index 8626e89e..de1e9f84 100644 --- a/src/test/resources/jmx_alias_match.yaml +++ b/src/test/resources/jmx_alias_match.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance1 conf: - include: diff --git a/src/test/resources/jmx_baseline_default_hostname.yaml b/src/test/resources/jmx_baseline_default_hostname.yaml index 892223eb..e776991d 100644 --- a/src/test/resources/jmx_baseline_default_hostname.yaml +++ b/src/test/resources/jmx_baseline_default_hostname.yaml @@ -3,6 +3,7 @@ init_config: instances: - process_name_regex: .*surefire.* name: jmx_test_default_hostname + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml tags: - jmx:fetch conf: diff --git a/src/test/resources/jmx_bean_regex_tags.yaml b/src/test/resources/jmx_bean_regex_tags.yaml index c25f79f3..54398344 100644 --- a/src/test/resources/jmx_bean_regex_tags.yaml +++ b/src/test/resources/jmx_bean_regex_tags.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_bean_scope.yaml b/src/test/resources/jmx_bean_scope.yaml index e503e35f..e23ccd44 100644 --- a/src/test/resources/jmx_bean_scope.yaml +++ b/src/test/resources/jmx_bean_scope.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_bean_tags.yaml b/src/test/resources/jmx_bean_tags.yaml index 64100833..dbdb10a9 100644 --- a/src/test/resources/jmx_bean_tags.yaml +++ b/src/test/resources/jmx_bean_tags.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_bean_tags_dont_normalize_params.yaml b/src/test/resources/jmx_bean_tags_dont_normalize_params.yaml index b9ddb526..ece7e1c1 100644 --- a/src/test/resources/jmx_bean_tags_dont_normalize_params.yaml +++ b/src/test/resources/jmx_bean_tags_dont_normalize_params.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_bean_tags_normalize_params.yaml b/src/test/resources/jmx_bean_tags_normalize_params.yaml index b2aee657..82438f72 100644 --- a/src/test/resources/jmx_bean_tags_normalize_params.yaml +++ b/src/test/resources/jmx_bean_tags_normalize_params.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_canonical.yaml b/src/test/resources/jmx_canonical.yaml index 450d63e9..80963ade 100644 --- a/src/test/resources/jmx_canonical.yaml +++ b/src/test/resources/jmx_canonical.yaml @@ -3,6 +3,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance tags: diff --git a/src/test/resources/jmx_cassandra.yaml b/src/test/resources/jmx_cassandra.yaml index a7357eb5..125f3515 100644 --- a/src/test/resources/jmx_cassandra.yaml +++ b/src/test/resources/jmx_cassandra.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_first_instance cassandra_aliasing: true conf: @@ -10,6 +11,7 @@ instances: attribute: - ShouldBe100 - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_second_instance conf: - include: diff --git a/src/test/resources/jmx_cassandra_deprecated.yaml b/src/test/resources/jmx_cassandra_deprecated.yaml index 9d7b5329..311711a9 100644 --- a/src/test/resources/jmx_cassandra_deprecated.yaml +++ b/src/test/resources/jmx_cassandra_deprecated.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_cast.yaml b/src/test/resources/jmx_cast.yaml index 5601ad3d..af98c5e1 100644 --- a/src/test/resources/jmx_cast.yaml +++ b/src/test/resources/jmx_cast.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance conf: diff --git a/src/test/resources/jmx_check_no_prefix.yaml b/src/test/resources/jmx_check_no_prefix.yaml index b9251672..b34bc1c9 100644 --- a/src/test/resources/jmx_check_no_prefix.yaml +++ b/src/test/resources/jmx_check_no_prefix.yaml @@ -3,6 +3,7 @@ init_config: instances: - jvm_direct: true + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_check_prefix.yaml b/src/test/resources/jmx_check_prefix.yaml index 73213362..63e3c689 100644 --- a/src/test/resources/jmx_check_prefix.yaml +++ b/src/test/resources/jmx_check_prefix.yaml @@ -3,6 +3,7 @@ init_config: instances: - jvm_direct: true + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_class_exclude.yaml b/src/test/resources/jmx_class_exclude.yaml index 22c06256..87fec620 100644 --- a/src/test/resources/jmx_class_exclude.yaml +++ b/src/test/resources/jmx_class_exclude.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_class_include.yaml b/src/test/resources/jmx_class_include.yaml index 560e8007..58b94877 100644 --- a/src/test/resources/jmx_class_include.yaml +++ b/src/test/resources/jmx_class_include.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_class_regex.yaml b/src/test/resources/jmx_class_regex.yaml index a74274b8..d943d62e 100644 --- a/src/test/resources/jmx_class_regex.yaml +++ b/src/test/resources/jmx_class_regex.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_config_dynamic_tags.yaml b/src/test/resources/jmx_config_dynamic_tags.yaml index b39c3d22..7e51f064 100644 --- a/src/test/resources/jmx_config_dynamic_tags.yaml +++ b/src/test/resources/jmx_config_dynamic_tags.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_config_dynamic_tags_test conf: - include: diff --git a/src/test/resources/jmx_config_dynamic_tags_bean_params.yaml b/src/test/resources/jmx_config_dynamic_tags_bean_params.yaml index 59cc2b09..f2073846 100644 --- a/src/test/resources/jmx_config_dynamic_tags_bean_params.yaml +++ b/src/test/resources/jmx_config_dynamic_tags_bean_params.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_config_dynamic_tags_bean_params_test conf: - include: diff --git a/src/test/resources/jmx_config_dynamic_tags_caching.yaml b/src/test/resources/jmx_config_dynamic_tags_caching.yaml index e0929944..b6240e83 100644 --- a/src/test/resources/jmx_config_dynamic_tags_caching.yaml +++ b/src/test/resources/jmx_config_dynamic_tags_caching.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_config_dynamic_tags_caching_test conf: # Config 1: Uses cluster_id diff --git a/src/test/resources/jmx_config_dynamic_tags_invalid.yaml b/src/test/resources/jmx_config_dynamic_tags_invalid.yaml index 45f96c97..3dcd1ddc 100644 --- a/src/test/resources/jmx_config_dynamic_tags_invalid.yaml +++ b/src/test/resources/jmx_config_dynamic_tags_invalid.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_config_dynamic_tags_invalid_test conf: # Invalid dynamic tag configurations (should be handled gracefully) diff --git a/src/test/resources/jmx_config_dynamic_tags_multi.yaml b/src/test/resources/jmx_config_dynamic_tags_multi.yaml index 619a9b8a..c828742f 100644 --- a/src/test/resources/jmx_config_dynamic_tags_multi.yaml +++ b/src/test/resources/jmx_config_dynamic_tags_multi.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_config_dynamic_tags_multi_test conf: # Config 1: Has cluster_id dynamic tag diff --git a/src/test/resources/jmx_config_dynamic_tags_multiple_per_conf.yaml b/src/test/resources/jmx_config_dynamic_tags_multiple_per_conf.yaml index 54954957..0b405d28 100644 --- a/src/test/resources/jmx_config_dynamic_tags_multiple_per_conf.yaml +++ b/src/test/resources/jmx_config_dynamic_tags_multiple_per_conf.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_config_dynamic_tags_multiple_per_conf_test conf: # Config with multiple dynamic tags (cluster_id AND version) on the same metric diff --git a/src/test/resources/jmx_count.yaml b/src/test/resources/jmx_count.yaml index cc6736f8..b26cadc6 100644 --- a/src/test/resources/jmx_count.yaml +++ b/src/test/resources/jmx_count.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance conf: diff --git a/src/test/resources/jmx_counter_rate.yaml b/src/test/resources/jmx_counter_rate.yaml index 4485994e..d353a38d 100644 --- a/src/test/resources/jmx_counter_rate.yaml +++ b/src/test/resources/jmx_counter_rate.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance1 conf: @@ -12,6 +13,7 @@ instances: metric_type: counter alias: test.counter - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance2 conf: diff --git a/src/test/resources/jmx_domain_exclude.yaml b/src/test/resources/jmx_domain_exclude.yaml index 5eae57c7..464f163a 100644 --- a/src/test/resources/jmx_domain_exclude.yaml +++ b/src/test/resources/jmx_domain_exclude.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_domain_include.yaml b/src/test/resources/jmx_domain_include.yaml index bc700cb3..d4ffcab1 100644 --- a/src/test/resources/jmx_domain_include.yaml +++ b/src/test/resources/jmx_domain_include.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_domain_regex.yaml b/src/test/resources/jmx_domain_regex.yaml index 4bee8bc0..0a98fcee 100644 --- a/src/test/resources/jmx_domain_regex.yaml +++ b/src/test/resources/jmx_domain_regex.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_empty_default_hostname.yaml b/src/test/resources/jmx_empty_default_hostname.yaml index a6f7d965..ce2546c3 100644 --- a/src/test/resources/jmx_empty_default_hostname.yaml +++ b/src/test/resources/jmx_empty_default_hostname.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml empty_default_hostname: true name: jmx_test_no_hostname tags: diff --git a/src/test/resources/jmx_exclude_tags.yaml b/src/test/resources/jmx_exclude_tags.yaml index 1d111650..365211a0 100644 --- a/src/test/resources/jmx_exclude_tags.yaml +++ b/src/test/resources/jmx_exclude_tags.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_exclude_tags_override_service.yaml b/src/test/resources/jmx_exclude_tags_override_service.yaml index 274fb76a..a90814a1 100644 --- a/src/test/resources/jmx_exclude_tags_override_service.yaml +++ b/src/test/resources/jmx_exclude_tags_override_service.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_service_override_instance service: test tags: diff --git a/src/test/resources/jmx_filter_issues.yaml b/src/test/resources/jmx_filter_issues.yaml index 6df61dae..f6d5574a 100644 --- a/src/test/resources/jmx_filter_issues.yaml +++ b/src/test/resources/jmx_filter_issues.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_filter_list_support.yaml b/src/test/resources/jmx_filter_list_support.yaml index ecedd5b6..a203a6f1 100644 --- a/src/test/resources/jmx_filter_list_support.yaml +++ b/src/test/resources/jmx_filter_list_support.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_filtering_test.yaml b/src/test/resources/jmx_filtering_test.yaml index aa3ea7d3..588f25af 100644 --- a/src/test/resources/jmx_filtering_test.yaml +++ b/src/test/resources/jmx_filtering_test.yaml @@ -1,5 +1,6 @@ instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance diff --git a/src/test/resources/jmx_histogram.yaml b/src/test/resources/jmx_histogram.yaml index cf6318d7..f5855138 100644 --- a/src/test/resources/jmx_histogram.yaml +++ b/src/test/resources/jmx_histogram.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_jee_data.yaml b/src/test/resources/jmx_jee_data.yaml index 2f759faa..8fc2fb53 100644 --- a/src/test/resources/jmx_jee_data.yaml +++ b/src/test/resources/jmx_jee_data.yaml @@ -3,6 +3,7 @@ init_config: instances: - jvm_direct: true + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance conf: diff --git a/src/test/resources/jmx_list_beans_exclude.yaml b/src/test/resources/jmx_list_beans_exclude.yaml index 48b13a5a..1725f3ea 100644 --- a/src/test/resources/jmx_list_beans_exclude.yaml +++ b/src/test/resources/jmx_list_beans_exclude.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_list_beans_include.yaml b/src/test/resources/jmx_list_beans_include.yaml index eb1999ad..55d62734 100644 --- a/src/test/resources/jmx_list_beans_include.yaml +++ b/src/test/resources/jmx_list_beans_include.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_list_beans_regex_exclude.yaml b/src/test/resources/jmx_list_beans_regex_exclude.yaml index 2335b98f..4d489c78 100644 --- a/src/test/resources/jmx_list_beans_regex_exclude.yaml +++ b/src/test/resources/jmx_list_beans_regex_exclude.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_list_beans_regex_include.yaml b/src/test/resources/jmx_list_beans_regex_include.yaml index 8b1a0200..67ca3664 100644 --- a/src/test/resources/jmx_list_beans_regex_include.yaml +++ b/src/test/resources/jmx_list_beans_regex_include.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_list_params_exclude.yaml b/src/test/resources/jmx_list_params_exclude.yaml index 3e46e43b..80312ae0 100644 --- a/src/test/resources/jmx_list_params_exclude.yaml +++ b/src/test/resources/jmx_list_params_exclude.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_list_params_include.yaml b/src/test/resources/jmx_list_params_include.yaml index c618178b..0f1ad24c 100644 --- a/src/test/resources/jmx_list_params_include.yaml +++ b/src/test/resources/jmx_list_params_include.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/jmx_min_collection_period.yml b/src/test/resources/jmx_min_collection_period.yml index 76ae0631..61fb494d 100644 --- a/src/test/resources/jmx_min_collection_period.yml +++ b/src/test/resources/jmx_min_collection_period.yml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml min_collection_interval: 5 name: jmx_test_instance conf: diff --git a/src/test/resources/jmx_no_alias.yaml b/src/test/resources/jmx_no_alias.yaml index f756344d..667f5183 100644 --- a/src/test/resources/jmx_no_alias.yaml +++ b/src/test/resources/jmx_no_alias.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance conf: - include: diff --git a/src/test/resources/jmx_non_parsable_max_returned_metrics_string.yaml b/src/test/resources/jmx_non_parsable_max_returned_metrics_string.yaml index 4daf69e8..05b7e527 100644 --- a/src/test/resources/jmx_non_parsable_max_returned_metrics_string.yaml +++ b/src/test/resources/jmx_non_parsable_max_returned_metrics_string.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance max_returned_metrics: "foo" conf: diff --git a/src/test/resources/jmx_parsable_max_returned_metrics_string.yaml b/src/test/resources/jmx_parsable_max_returned_metrics_string.yaml index 0502e998..053a136c 100644 --- a/src/test/resources/jmx_parsable_max_returned_metrics_string.yaml +++ b/src/test/resources/jmx_parsable_max_returned_metrics_string.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance max_returned_metrics: "500" conf: diff --git a/src/test/resources/jmx_refresh_beans.yaml b/src/test/resources/jmx_refresh_beans.yaml index cf892dca..a7cd88c9 100644 --- a/src/test/resources/jmx_refresh_beans.yaml +++ b/src/test/resources/jmx_refresh_beans.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml min_collection_interval: 1 refresh_beans_initial: 1 refresh_beans: 3 diff --git a/src/test/resources/jmx_service_tag_global.yaml b/src/test/resources/jmx_service_tag_global.yaml index 588c7fa7..2e21bb66 100644 --- a/src/test/resources/jmx_service_tag_global.yaml +++ b/src/test/resources/jmx_service_tag_global.yaml @@ -3,6 +3,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_1 tags: - jmx:fetch @@ -15,6 +16,7 @@ instances: alias: this.is.100.$foo.$qux - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_2 tags: - jmx:fetch diff --git a/src/test/resources/jmx_service_tag_global_list.yaml b/src/test/resources/jmx_service_tag_global_list.yaml index ff4025f7..91558274 100644 --- a/src/test/resources/jmx_service_tag_global_list.yaml +++ b/src/test/resources/jmx_service_tag_global_list.yaml @@ -7,6 +7,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_1 tags: - jmx:fetch @@ -19,6 +20,7 @@ instances: alias: this.is.100.$foo.$qux - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_2 tags: - jmx:fetch diff --git a/src/test/resources/jmx_service_tag_instance_override.yaml b/src/test/resources/jmx_service_tag_instance_override.yaml index e0c55cf5..c235a8b0 100644 --- a/src/test/resources/jmx_service_tag_instance_override.yaml +++ b/src/test/resources/jmx_service_tag_instance_override.yaml @@ -3,6 +3,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_1 service: override tags: @@ -16,6 +17,7 @@ instances: alias: this.is.100.$foo.$qux - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_2 service: override tags: diff --git a/src/test/resources/jmx_tabular_data_tagged.yaml b/src/test/resources/jmx_tabular_data_tagged.yaml index 0352f9b3..baca07d9 100644 --- a/src/test/resources/jmx_tabular_data_tagged.yaml +++ b/src/test/resources/jmx_tabular_data_tagged.yaml @@ -3,6 +3,7 @@ init_config: instances: - jvm_direct: true + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance tags: diff --git a/src/test/resources/jmx_tabular_data_tagless.yaml b/src/test/resources/jmx_tabular_data_tagless.yaml index 69a66fdc..48b67c7f 100644 --- a/src/test/resources/jmx_tabular_data_tagless.yaml +++ b/src/test/resources/jmx_tabular_data_tagless.yaml @@ -3,6 +3,7 @@ init_config: instances: - jvm_direct: true + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml refresh_beans: 4 name: jmx_test_instance tags: diff --git a/src/test/resources/non_running_process.yaml b/src/test/resources/non_running_process.yaml index 0029e4e9..6995bbc5 100644 --- a/src/test/resources/non_running_process.yaml +++ b/src/test/resources/non_running_process.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*non_running_process_test.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage diff --git a/src/test/resources/too_many_metrics.yaml b/src/test/resources/too_many_metrics.yaml index b6f66ea1..99a1e593 100644 --- a/src/test/resources/too_many_metrics.yaml +++ b/src/test/resources/too_many_metrics.yaml @@ -2,6 +2,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance tags: env: stage From 31d701dff63ee7783401108ec782fef69ce62ac2 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Tue, 3 Feb 2026 22:27:08 +0100 Subject: [PATCH 9/9] fix: Update service discovery test configs and expectations - Add simplified-default-jmx-metrics.yaml to jmx_0 instances in service discovery configs - Update testServiceDiscovery expectation from 63 to 35 metrics to match simplified defaults - testServiceDiscoveryLong already had correct expectation (35 metrics) Co-Authored-By: Claude Sonnet 4.5 --- src/test/java/org/datadog/jmxfetch/TestApp.java | 4 ++-- src/test/resources/jmx_sd_pipe.txt | 1 + src/test/resources/jmx_sd_pipe_longname.txt | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/datadog/jmxfetch/TestApp.java b/src/test/java/org/datadog/jmxfetch/TestApp.java index 1c58ac23..8a09aa48 100644 --- a/src/test/java/org/datadog/jmxfetch/TestApp.java +++ b/src/test/java/org/datadog/jmxfetch/TestApp.java @@ -964,8 +964,8 @@ public void testServiceDiscovery() throws Exception { run(); List> metrics = getMetrics(); - // 14 = 13 metrics from java.lang + 1 metric explicitly defined in the yaml config file - assertEquals(63, metrics.size()); + // Using simplified default JVM metrics for instances with process_name_regex + assertEquals(35, metrics.size()); List tags = Arrays.asList( "type:SimpleTestJavaApp", diff --git a/src/test/resources/jmx_sd_pipe.txt b/src/test/resources/jmx_sd_pipe.txt index 945fbc4c..db4e27eb 100644 --- a/src/test/resources/jmx_sd_pipe.txt +++ b/src/test/resources/jmx_sd_pipe.txt @@ -25,6 +25,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance2 conf: - include: diff --git a/src/test/resources/jmx_sd_pipe_longname.txt b/src/test/resources/jmx_sd_pipe_longname.txt index 8e638052..699ff705 100644 --- a/src/test/resources/jmx_sd_pipe_longname.txt +++ b/src/test/resources/jmx_sd_pipe_longname.txt @@ -4,6 +4,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance2 conf: - include: @@ -25,6 +26,7 @@ init_config: instances: - process_name_regex: .*surefire.* + default-jmx-metrics-definitions: simplified-default-jmx-metrics.yaml name: jmx_test_instance3 conf: - include: