Skip to content

Commit 774a310

Browse files
committed
add jvm.fd.open and jvm.runtime.uptime to jmx configs
1 parent 1f13340 commit 774a310

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/JvmTargetSystemIntegrationTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
package io.opentelemetry.contrib.jmxmetrics.target_systems;
77

8-
import io.opentelemetry.contrib.jmxmetrics.AbstractIntegrationTest;
98
import java.util.Arrays;
109
import java.util.List;
10+
1111
import org.junit.jupiter.api.Test;
1212
import org.testcontainers.containers.GenericContainer;
1313
import org.testcontainers.junit.jupiter.Container;
1414

15+
import io.opentelemetry.contrib.jmxmetrics.AbstractIntegrationTest;
16+
1517
class JvmTargetSystemIntegrationTest extends AbstractIntegrationTest {
1618

1719
JvmTargetSystemIntegrationTest() {
@@ -55,6 +57,8 @@ void endToEnd() {
5557
metric -> assertGauge(metric, "jvm.memory.nonheap.init", "current non-heap usage", "By"),
5658
metric -> assertGauge(metric, "jvm.memory.nonheap.max", "current non-heap usage", "By"),
5759
metric -> assertGauge(metric, "jvm.memory.nonheap.used", "current non-heap usage", "By"),
60+
metric -> assertGauge(metric, "jvm.runtime.uptime", "uptime", "ms"),
61+
metric -> assertGauge(metric, "jvm.fd.open", "open file descriptors", "1"),
5862
metric ->
5963
assertTypedGauge(
6064
metric, "jvm.memory.pool.committed", "current memory pool usage", "By", gcLabels),

jmx-metrics/src/main/resources/target-systems/jvm.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ otel.instrument(memory, "jvm.memory.heap", "current heap usage",
3333
otel.instrument(memory, "jvm.memory.nonheap", "current non-heap usage",
3434
"By", "NonHeapMemoryUsage", otel.&longValueCallback)
3535

36+
def runtime = otel.mbean("java.lang:type=Runtime")
37+
otel.instrument(runtime, "jvm.runtime.uptime", "uptime",
38+
"ms", "Uptime", otel.&longValueCallback)
39+
40+
def os = otel.mbean("java.lang:type=OperatingSystem")
41+
otel.instrument(os, "jvm.fd.open", "open file descriptors",
42+
"1", "OpenFileDescriptorCount", otel.&longValueCallback)
43+
44+
3645
def memoryPool = otel.mbeans("java.lang:type=MemoryPool,*")
3746
otel.instrument(memoryPool, "jvm.memory.pool", "current memory pool usage",
3847
"By", ["name" : { mbean -> mbean.name().getKeyProperty("name") }],

0 commit comments

Comments
 (0)