From 11f4960256d135f6879780838074bbe2cbbe223a Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:47:21 +0100 Subject: [PATCH 1/5] removed 'typed' attributes --- .../jmxscraper/assertions/MetricAssert.java | 28 ---------------- .../target_systems/JvmIntegrationTest.java | 33 ++++++++++++------- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions/MetricAssert.java b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions/MetricAssert.java index 1a4eaace3..c086c74a7 100644 --- a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions/MetricAssert.java +++ b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions/MetricAssert.java @@ -12,11 +12,8 @@ import io.opentelemetry.proto.metrics.v1.Metric; import io.opentelemetry.proto.metrics.v1.NumberDataPoint; import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.function.Consumer; import java.util.stream.Collectors; import org.assertj.core.api.AbstractAssert; @@ -199,31 +196,6 @@ private MetricAssert checkDataPoints(Consumer> listConsume return this; } - // TODO: To be removed and calls will be replaced with hasDataPointsWithAttributes() - @CanIgnoreReturnValue - public MetricAssert hasTypedDataPoints(Collection types) { - return checkDataPoints( - dataPoints -> { - dataPointsCommonCheck(dataPoints); - - Set foundValues = new HashSet<>(); - for (NumberDataPoint dataPoint : dataPoints) { - List attributes = dataPoint.getAttributesList(); - - info.description( - "expected exactly one 'name' attribute for typed data point in metric '%s'", - actual.getName()); - iterables.assertHasSize(info, attributes, 1); - - objects.assertEqual(info, attributes.get(0).getKey(), "name"); - foundValues.add(attributes.get(0).getValue().getStringValue()); - } - info.description( - "missing or unexpected type attribute for metric '%s'", actual.getName()); - iterables.assertContainsExactlyInAnyOrder(info, foundValues, types.toArray()); - }); - } - private void dataPointsCommonCheck(List dataPoints) { info.description("unable to retrieve data points from metric '%s'", actual.getName()); objects.assertNotNull(info, dataPoints); diff --git a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java index 70dacdccc..5c9a1821f 100644 --- a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java +++ b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java @@ -5,11 +5,13 @@ package io.opentelemetry.contrib.jmxscraper.target_systems; +import static io.opentelemetry.contrib.jmxscraper.assertions.DataPointAttributes.attribute; +import static io.opentelemetry.contrib.jmxscraper.assertions.DataPointAttributes.attributeGroup; + import io.opentelemetry.contrib.jmxscraper.JmxScraperContainer; import io.opentelemetry.contrib.jmxscraper.TestAppContainer; +import io.opentelemetry.contrib.jmxscraper.assertions.AttributeMatcherGroup; import java.nio.file.Path; -import java.util.Arrays; -import java.util.List; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; @@ -34,15 +36,16 @@ protected JmxScraperContainer customizeScraperContainer( @Override protected MetricsVerifier createMetricsVerifier() { // those values depend on the JVM GC configured - List gcLabels = - Arrays.asList( + AttributeMatcherGroup[] memoryAttributes = + nameAttributeMatchers( "Code Cache", "PS Eden Space", "PS Old Gen", "Metaspace", "Compressed Class Space", "PS Survivor Space"); - List gcCollectionLabels = Arrays.asList("PS MarkSweep", "PS Scavenge"); + AttributeMatcherGroup[] gcAlgorithmAttributes = + nameAttributeMatchers("PS MarkSweep", "PS Scavenge"); return MetricsVerifier.create() .add( @@ -60,7 +63,7 @@ protected MetricsVerifier createMetricsVerifier() { .hasDescription("total number of collections that have occurred") .hasUnit("1") .isCounter() - .hasTypedDataPoints(gcCollectionLabels)) + .hasDataPointsWithAttributes(gcAlgorithmAttributes)) .add( "jvm.gc.collections.elapsed", metric -> @@ -69,7 +72,7 @@ protected MetricsVerifier createMetricsVerifier() { "the approximate accumulated collection elapsed time in milliseconds") .hasUnit("ms") .isCounter() - .hasTypedDataPoints(gcCollectionLabels)) + .hasDataPointsWithAttributes(gcAlgorithmAttributes)) .add( "jvm.memory.heap.committed", metric -> @@ -141,7 +144,7 @@ protected MetricsVerifier createMetricsVerifier() { .hasDescription("current memory pool usage") .hasUnit("by") .isGauge() - .hasTypedDataPoints(gcLabels)) + .hasDataPointsWithAttributes(memoryAttributes)) .add( "jvm.memory.pool.init", metric -> @@ -149,7 +152,7 @@ protected MetricsVerifier createMetricsVerifier() { .hasDescription("current memory pool usage") .hasUnit("by") .isGauge() - .hasTypedDataPoints(gcLabels)) + .hasDataPointsWithAttributes(memoryAttributes)) .add( "jvm.memory.pool.max", metric -> @@ -157,7 +160,7 @@ protected MetricsVerifier createMetricsVerifier() { .hasDescription("current memory pool usage") .hasUnit("by") .isGauge() - .hasTypedDataPoints(gcLabels)) + .hasDataPointsWithAttributes(memoryAttributes)) .add( "jvm.memory.pool.used", metric -> @@ -165,7 +168,7 @@ protected MetricsVerifier createMetricsVerifier() { .hasDescription("current memory pool usage") .hasUnit("by") .isGauge() - .hasTypedDataPoints(gcLabels)) + .hasDataPointsWithAttributes(memoryAttributes)) .add( "jvm.threads.count", metric -> @@ -175,4 +178,12 @@ protected MetricsVerifier createMetricsVerifier() { .isGauge() .hasDataPointsWithoutAttributes()); } + + private static AttributeMatcherGroup[] nameAttributeMatchers(String... values) { + AttributeMatcherGroup[] groups = new AttributeMatcherGroup[values.length]; + for (int i = 0; i < values.length; i++) { + groups[i] = attributeGroup(attribute("name", values[i])); + } + return groups; + } } From 2721adddf429c04f8faffb7a431ba496acda54e5 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:47:45 +0100 Subject: [PATCH 2/5] fix 'bytes' unit by using 'By' --- .../target_systems/JvmIntegrationTest.java | 24 +++++++++---------- jmx-scraper/src/main/resources/jvm.yaml | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java index 5c9a1821f..0fa3b826b 100644 --- a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java +++ b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java @@ -78,7 +78,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -86,7 +86,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -94,7 +94,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -102,7 +102,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -110,7 +110,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current non-heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -118,7 +118,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current non-heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -126,7 +126,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current non-heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -134,7 +134,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current non-heap usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -142,7 +142,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current memory pool usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithAttributes(memoryAttributes)) .add( @@ -150,7 +150,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current memory pool usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithAttributes(memoryAttributes)) .add( @@ -158,7 +158,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current memory pool usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithAttributes(memoryAttributes)) .add( @@ -166,7 +166,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("current memory pool usage") - .hasUnit("by") + .hasUnit("By") .isGauge() .hasDataPointsWithAttributes(memoryAttributes)) .add( diff --git a/jmx-scraper/src/main/resources/jvm.yaml b/jmx-scraper/src/main/resources/jvm.yaml index d3e95d5d4..422ce6efd 100644 --- a/jmx-scraper/src/main/resources/jvm.yaml +++ b/jmx-scraper/src/main/resources/jvm.yaml @@ -28,7 +28,7 @@ rules: name: param(name) - bean: java.lang:type=Memory - unit: by + unit: By prefix: jvm.memory. mapping: HeapMemoryUsage.committed: @@ -66,7 +66,7 @@ rules: - bean: java.lang:type=MemoryPool,name=* type: gauge - unit: by + unit: By metricAttribute: name: param(name) mapping: From 205b92b40680f2f71df5c4ca34334f3f39a574cd Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:55:31 +0100 Subject: [PATCH 3/5] fix other units --- .../jmxscraper/target_systems/JvmIntegrationTest.java | 6 +++--- jmx-scraper/src/main/resources/jvm.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java index 0fa3b826b..3e9b73367 100644 --- a/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java +++ b/jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/JvmIntegrationTest.java @@ -53,7 +53,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("number of loaded classes") - .hasUnit("1") + .hasUnit("{class}") .isGauge() .hasDataPointsWithoutAttributes()) .add( @@ -61,7 +61,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("total number of collections that have occurred") - .hasUnit("1") + .hasUnit("{collection}") .isCounter() .hasDataPointsWithAttributes(gcAlgorithmAttributes)) .add( @@ -174,7 +174,7 @@ protected MetricsVerifier createMetricsVerifier() { metric -> metric .hasDescription("number of threads") - .hasUnit("1") + .hasUnit("{thread}") .isGauge() .hasDataPointsWithoutAttributes()); } diff --git a/jmx-scraper/src/main/resources/jvm.yaml b/jmx-scraper/src/main/resources/jvm.yaml index 422ce6efd..b706ff7c0 100644 --- a/jmx-scraper/src/main/resources/jvm.yaml +++ b/jmx-scraper/src/main/resources/jvm.yaml @@ -7,7 +7,7 @@ rules: LoadedClassCount: metric: jvm.classes.loaded type: gauge - unit: '1' + unit: '{class}' desc: number of loaded classes - bean: java.lang:type=GarbageCollector,name=* @@ -15,7 +15,7 @@ rules: CollectionCount: metric: jvm.gc.collections.count type: counter - unit: '1' + unit: '{collection}' desc: total number of collections that have occurred metricAttribute: name: param(name) @@ -87,5 +87,5 @@ rules: mapping: ThreadCount: metric: jvm.threads.count - unit: '1' + unit: '{thread}' desc: number of threads From fcf854f0c219772184c68d2e4285c265ba893cc9 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:59:34 +0100 Subject: [PATCH 4/5] update jmx gatherer for consistency --- .../JvmTargetSystemIntegrationTest.java | 30 +++++++++---------- .../main/resources/target-systems/jvm.groovy | 12 ++++---- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/JvmTargetSystemIntegrationTest.java b/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/JvmTargetSystemIntegrationTest.java index 91de5de0d..682e23957 100644 --- a/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/JvmTargetSystemIntegrationTest.java +++ b/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/JvmTargetSystemIntegrationTest.java @@ -31,13 +31,13 @@ void endToEnd() { "Metaspace", "Par Survivor Space"); waitAndAssertMetrics( - metric -> assertGauge(metric, "jvm.classes.loaded", "number of loaded classes", "1"), + metric -> assertGauge(metric, "jvm.classes.loaded", "number of loaded classes", "{class}"), metric -> assertTypedSum( metric, "jvm.gc.collections.count", "total number of collections that have occurred", - "1", + "{collection}", Arrays.asList("ConcurrentMarkSweep", "ParNew")), metric -> assertTypedSum( @@ -46,27 +46,27 @@ void endToEnd() { "the approximate accumulated collection elapsed time in milliseconds", "ms", Arrays.asList("ConcurrentMarkSweep", "ParNew")), - metric -> assertGauge(metric, "jvm.memory.heap.committed", "current heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.heap.init", "current heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.heap.max", "current heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.heap.used", "current heap usage", "by"), + metric -> assertGauge(metric, "jvm.memory.heap.committed", "current heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.heap.init", "current heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.heap.max", "current heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.heap.used", "current heap usage", "By"), metric -> - assertGauge(metric, "jvm.memory.nonheap.committed", "current non-heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.nonheap.init", "current non-heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.nonheap.max", "current non-heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.nonheap.used", "current non-heap usage", "by"), + assertGauge(metric, "jvm.memory.nonheap.committed", "current non-heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.nonheap.init", "current non-heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.nonheap.max", "current non-heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.nonheap.used", "current non-heap usage", "By"), metric -> assertTypedGauge( - metric, "jvm.memory.pool.committed", "current memory pool usage", "by", gcLabels), + metric, "jvm.memory.pool.committed", "current memory pool usage", "By", gcLabels), metric -> assertTypedGauge( - metric, "jvm.memory.pool.init", "current memory pool usage", "by", gcLabels), + metric, "jvm.memory.pool.init", "current memory pool usage", "By", gcLabels), metric -> assertTypedGauge( - metric, "jvm.memory.pool.max", "current memory pool usage", "by", gcLabels), + metric, "jvm.memory.pool.max", "current memory pool usage", "By", gcLabels), metric -> assertTypedGauge( - metric, "jvm.memory.pool.used", "current memory pool usage", "by", gcLabels), - metric -> assertGauge(metric, "jvm.threads.count", "number of threads", "1")); + metric, "jvm.memory.pool.used", "current memory pool usage", "By", gcLabels), + metric -> assertGauge(metric, "jvm.threads.count", "number of threads", "{thread}")); } } diff --git a/jmx-metrics/src/main/resources/target-systems/jvm.groovy b/jmx-metrics/src/main/resources/target-systems/jvm.groovy index 4de2a6a02..73e33b0d5 100644 --- a/jmx-metrics/src/main/resources/target-systems/jvm.groovy +++ b/jmx-metrics/src/main/resources/target-systems/jvm.groovy @@ -16,11 +16,11 @@ def classLoading = otel.mbean("java.lang:type=ClassLoading") otel.instrument(classLoading, "jvm.classes.loaded", "number of loaded classes", - "1", "LoadedClassCount", otel.&longValueCallback) + "{class}", "LoadedClassCount", otel.&longValueCallback) def garbageCollector = otel.mbeans("java.lang:type=GarbageCollector,*") otel.instrument(garbageCollector, "jvm.gc.collections.count", "total number of collections that have occurred", - "1", ["name" : { mbean -> mbean.name().getKeyProperty("name") }], + "{collection}", ["name" : { mbean -> mbean.name().getKeyProperty("name") }], "CollectionCount", otel.&longCounterCallback) otel.instrument(garbageCollector, "jvm.gc.collections.elapsed", "the approximate accumulated collection elapsed time in milliseconds", "ms", @@ -29,15 +29,15 @@ otel.instrument(garbageCollector, "jvm.gc.collections.elapsed", def memory = otel.mbean("java.lang:type=Memory") otel.instrument(memory, "jvm.memory.heap", "current heap usage", - "by", "HeapMemoryUsage", otel.&longValueCallback) + "By", "HeapMemoryUsage", otel.&longValueCallback) otel.instrument(memory, "jvm.memory.nonheap", "current non-heap usage", - "by", "NonHeapMemoryUsage", otel.&longValueCallback) + "By", "NonHeapMemoryUsage", otel.&longValueCallback) def memoryPool = otel.mbeans("java.lang:type=MemoryPool,*") otel.instrument(memoryPool, "jvm.memory.pool", "current memory pool usage", - "by", ["name" : { mbean -> mbean.name().getKeyProperty("name") }], + "By", ["name" : { mbean -> mbean.name().getKeyProperty("name") }], "Usage", otel.&longValueCallback) def threading = otel.mbean("java.lang:type=Threading") otel.instrument(threading, "jvm.threads.count", "number of threads", - "1", "ThreadCount", otel.&longValueCallback) + "{thread}", "ThreadCount", otel.&longValueCallback) From 9d29700571593cf1586f11d80c4bbf5c5ad158e3 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:22:04 +0100 Subject: [PATCH 5/5] fix kafka test --- .../target_systems/KafkaIntegrationTest.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/KafkaIntegrationTest.java b/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/KafkaIntegrationTest.java index acc272262..a54909b67 100644 --- a/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/KafkaIntegrationTest.java +++ b/jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/KafkaIntegrationTest.java @@ -380,13 +380,14 @@ void endToEnd() { List> assertions = new ArrayList<>(kafkaBrokerAssertions()); assertions.addAll( Arrays.asList( - metric -> assertGauge(metric, "jvm.classes.loaded", "number of loaded classes", "1"), + metric -> + assertGauge(metric, "jvm.classes.loaded", "number of loaded classes", "{class}"), metric -> assertTypedSum( metric, "jvm.gc.collections.count", "total number of collections that have occurred", - "1", + "{collection}", Arrays.asList("G1 Young Generation", "G1 Old Generation")), metric -> assertTypedSum( @@ -396,36 +397,36 @@ void endToEnd() { "ms", Arrays.asList("G1 Young Generation", "G1 Old Generation")), metric -> - assertGauge(metric, "jvm.memory.heap.committed", "current heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.heap.init", "current heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.heap.max", "current heap usage", "by"), - metric -> assertGauge(metric, "jvm.memory.heap.used", "current heap usage", "by"), + assertGauge(metric, "jvm.memory.heap.committed", "current heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.heap.init", "current heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.heap.max", "current heap usage", "By"), + metric -> assertGauge(metric, "jvm.memory.heap.used", "current heap usage", "By"), metric -> assertGauge( - metric, "jvm.memory.nonheap.committed", "current non-heap usage", "by"), + metric, "jvm.memory.nonheap.committed", "current non-heap usage", "By"), metric -> - assertGauge(metric, "jvm.memory.nonheap.init", "current non-heap usage", "by"), + assertGauge(metric, "jvm.memory.nonheap.init", "current non-heap usage", "By"), metric -> - assertGauge(metric, "jvm.memory.nonheap.max", "current non-heap usage", "by"), + assertGauge(metric, "jvm.memory.nonheap.max", "current non-heap usage", "By"), metric -> - assertGauge(metric, "jvm.memory.nonheap.used", "current non-heap usage", "by"), + assertGauge(metric, "jvm.memory.nonheap.used", "current non-heap usage", "By"), metric -> assertTypedGauge( metric, "jvm.memory.pool.committed", "current memory pool usage", - "by", + "By", gcLabels), metric -> assertTypedGauge( - metric, "jvm.memory.pool.init", "current memory pool usage", "by", gcLabels), + metric, "jvm.memory.pool.init", "current memory pool usage", "By", gcLabels), metric -> assertTypedGauge( - metric, "jvm.memory.pool.max", "current memory pool usage", "by", gcLabels), + metric, "jvm.memory.pool.max", "current memory pool usage", "By", gcLabels), metric -> assertTypedGauge( - metric, "jvm.memory.pool.used", "current memory pool usage", "by", gcLabels), - metric -> assertGauge(metric, "jvm.threads.count", "number of threads", "1"))); + metric, "jvm.memory.pool.used", "current memory pool usage", "By", gcLabels), + metric -> assertGauge(metric, "jvm.threads.count", "number of threads", "{thread}"))); waitAndAssertMetrics(assertions); }