diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2fca5d810..62632713e 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 diff --git a/src/main/java/org/datadog/jmxfetch/App.java b/src/main/java/org/datadog/jmxfetch/App.java index 9983267ba..2fccea375 100644 --- a/src/main/java/org/datadog/jmxfetch/App.java +++ b/src/main/java/org/datadog/jmxfetch/App.java @@ -16,6 +16,7 @@ import org.datadog.jmxfetch.util.LogLevel; import org.datadog.jmxfetch.util.ServiceCheckHelper; +import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; @@ -764,7 +765,8 @@ private void loadFileConfigs(final AppConfig config, final 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)) { + if (is == null) { + log.warn("Cannot find internal default config file {}", configResourcePath); + return; + } + 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); } } @@ -316,10 +328,10 @@ static void loadMetricConfigFiles( + "migrate to using standard agent config files in the conf.d directory."); for (String fileName : metricConfigFiles) { String yamlPath = new File(fileName).getAbsolutePath(); - FileInputStream yamlInputStream = null; + log.info("Reading metric config file " + yamlPath); - try { - yamlInputStream = new FileInputStream(yamlPath); + try (BufferedInputStream yamlInputStream = + new BufferedInputStream(new FileInputStream(yamlPath))) { List> confs = (List>) YAML.get().load(yamlInputStream); @@ -330,14 +342,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 - } - } } } } @@ -448,40 +452,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(); @@ -495,30 +499,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); @@ -526,7 +530,7 @@ private Map getResolvedDynamicTagsForConfig(Configuration config resolvedTags.put(cached.getKey(), cached.getValue()); } } - + return resolvedTags; } @@ -764,7 +768,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); 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 ffcaa7a7e..7206d39e1 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/TestApp.java b/src/test/java/org/datadog/jmxfetch/TestApp.java index 1c58ac231..8a09aa480 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/java/org/datadog/jmxfetch/TestCommon.java b/src/test/java/org/datadog/jmxfetch/TestCommon.java index f97ea46f2..9b72c3a8c 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,30 +30,8 @@ import org.datadog.jmxfetch.util.CustomLogger; import org.datadog.jmxfetch.util.MetricsAssert; import org.datadog.jmxfetch.util.LogLevel; - -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"); - - // 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 static String concatWithNewlines(String... lines) { - StringBuilder sb = new StringBuilder(); - for (String line : lines) { - sb.append(line).append(System.lineSeparator()); - } - return sb.toString(); - } -} - +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; public class TestCommon { AppConfig appConfig = spy(AppConfig.builder().build()); @@ -66,9 +41,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 +110,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 +129,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 +154,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 +163,45 @@ 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); } + 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. */ protected void run() { @@ -255,7 +244,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 a180c35ed..b48209392 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); @@ -181,21 +200,42 @@ 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 + ) { + return startAndGetMetrics(server, newGCMetrics, true); + } + + private List> startAndGetMetrics( + final MisbehavingJMXServer server, + final boolean newGCMetrics, + boolean useSimplifiedDefaultConfig + ) { 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( - "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()); + makeTempYamlConfigFile("config", configLines) + ); // Run one iteration first // TODO: Investigate why we have to run this twice - AMLII-1353 this.app.doIteration(); @@ -226,6 +266,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/TestInstance.java b/src/test/java/org/datadog/jmxfetch/TestInstance.java index 3a1d4b1a3..8c36bf189 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/java/org/datadog/jmxfetch/TestReconnectContainer.java b/src/test/java/org/datadog/jmxfetch/TestReconnectContainer.java index 1d9e162ad..0c0e19a57 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 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 + ) + ); + } + } diff --git a/src/test/java/org/datadog/jmxfetch/util/MetricsAssert.java b/src/test/java/org/datadog/jmxfetch/util/MetricsAssert.java index 3302e5d63..950439763 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/jmx.yaml b/src/test/resources/jmx.yaml index 4cdadc8f7..cbf09cb0d 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 f6e4ea8c0..2ea727813 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 8626e89ed..de1e9f848 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 892223eb1..e776991d5 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 c25f79f32..543983448 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 e503e35f4..e23ccd44c 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 641008332..dbdb10a95 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 b9ddb5267..ece7e1c11 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 b2aee6578..82438f727 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 450d63e97..80963adef 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 a7357eb56..125f35158 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 9d7b5329e..311711a9d 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 5601ad3d6..af98c5e13 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 b9251672c..b34bc1c94 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 732133623..63e3c689d 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 22c06256e..87fec6202 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 560e80071..58b948778 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 a74274b8d..d943d62e6 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 b39c3d223..7e51f064d 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 59cc2b09a..f2073846b 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 e0929944b..b6240e83c 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 45f96c977..3dcd1ddc1 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 619a9b8a2..c828742f0 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 549549573..0b405d28c 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 cc6736f8d..b26cadc65 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 4485994ee..d353a38d8 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 5eae57c7f..464f163a1 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 bc700cb3c..d4ffcab17 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 4bee8bc08..0a98fcee1 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 a6f7d965a..ce2546c31 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 1d1116500..365211a08 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 274fb76a9..a90814a12 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 6df61daec..f6d5574ab 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 ecedd5b62..a203a6f17 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 aa3ea7d3d..588f25afd 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 cf6318d73..f58551389 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 2f759faac..8fc2fb53b 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 48b13a5a2..1725f3ea2 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 eb1999adb..55d627343 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 2335b98f7..4d489c781 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 8b1a0200b..67ca36647 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 3e46e43b4..80312ae0a 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 c618178b1..0f1ad24c0 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 76ae06318..61fb494d9 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 f756344d1..667f51832 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 4daf69e8a..05b7e5274 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 0502e9984..053a136c3 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 cf892dca6..a7cd88c96 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_sd_pipe.txt b/src/test/resources/jmx_sd_pipe.txt index 945fbc4c0..db4e27eb0 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 8e6380525..699ff7051 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: diff --git a/src/test/resources/jmx_service_tag_global.yaml b/src/test/resources/jmx_service_tag_global.yaml index 588c7fa76..2e21bb66d 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 ff4025f79..915582742 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 e0c55cf5f..c235a8b06 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 0352f9b31..baca07d9b 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 69a66fdc8..48b67c7f0 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 0029e4e97..6995bbc52 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/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 diff --git a/src/test/resources/too_many_metrics.yaml b/src/test/resources/too_many_metrics.yaml index b6f66ea18..99a1e5938 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