Skip to content

Commit c86db65

Browse files
feat: Add jvm.file_descriptor.count metric to JMX instrumentation (#13722)
Co-authored-by: SylvainJuge <[email protected]>
1 parent 4f88c59 commit c86db65

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

instrumentation/jmx-metrics/library/jvm.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Here is the list of metrics based on MBeans exposed by the JVM and that are defi
55
Those metrics are defined in the [JVM runtime metrics semantic conventions](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/).
66

77
| Metric Name | semconv maturity | Type | Attributes | Description |
8-
|---------------------------------------------------------------------------------------------------------------------------------------|:-----------------|---------------|---------------------------------------|----------------------------------------------------|
8+
| ------------------------------------------------------------------------------------------------------------------------------------- | :--------------- | ------------- | ------------------------------------- | -------------------------------------------------- |
99
| [jvm.memory.used](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryused) | stable | UpDownCounter | jvm.memory.pool.name, jvm.memory.type | Used memory |
1010
| [jvm.memory.committed](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemorycommitted) | stable | UpDownCounter | jvm.memory.pool.name, jvm.memory.type | Committed memory |
1111
| [jvm.memory.limit](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemorylimit) | stable | UpDownCounter | jvm.memory.pool.name, jvm.memory.type | Max obtainable memory |
@@ -17,6 +17,7 @@ Those metrics are defined in the [JVM runtime metrics semantic conventions](http
1717
| [jvm.class.count](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmclasscount) | stable | UpDownCounter | | Classes currently loaded count |
1818
| [jvm.cpu.count](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmcpucount) | stable | UpDownCounter | | Number of CPUs available |
1919
| [jvm.cpu.recent_utilization](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmcpurecent_utilization) | stable | Gauge | | Recent CPU utilization for process reported by JVM |
20+
| [jvm.file_descriptor.count](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmfile_descriptorcount) | experimental | UpDownCounter | | Number of open file descriptors |
2021
| [jvm.system.cpu.load_1m](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmsystemcpuload_1m) | experimental | Gauge | | Average CPU load reported by JVM |
2122
| [jvm.system.cpu.recent_utilization](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmcpurecent_utilization) | experimental | Gauge | | Recent CPU utilization reported by JVM |
2223
| [jvm.buffer.memory.used](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmbuffermemoryused) | experimental | UpDownCounter | jvm.buffer.pool.name | Memory used by buffers |

instrumentation/jmx-metrics/library/src/main/resources/jmx/rules/jvm.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ rules:
9696
type: gauge
9797
unit: '1'
9898
desc: Recent CPU utilization for the whole system as reported by the JVM.
99+
# jvm.file_descriptor.count (experimental)
100+
OpenFileDescriptorCount:
101+
metric: file_descriptor.count
102+
type: updowncounter
103+
unit: "{file_descriptor}"
104+
desc: Number of open file descriptors as reported by the JVM.
99105

100106
- bean: java.nio:name=*,type=BufferPool
101107
prefix: jvm.buffer.

instrumentation/jmx-metrics/library/src/test/java/io/opentelemetry/instrumentation/jmx/rules/JvmTargetSystemTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ void testJvmMetrics(String image) {
162162
.hasUnit("1")
163163
.isGauge()
164164
.hasDataPointsWithoutAttributes())
165+
.add(
166+
"jvm.file_descriptor.count",
167+
metric ->
168+
metric
169+
.hasDescription("Number of open file descriptors as reported by the JVM.")
170+
.hasUnit("{file_descriptor}")
171+
.isUpDownCounter()
172+
.hasDataPointsWithoutAttributes())
165173
.add(
166174
"jvm.system.cpu.load_1m",
167175
metric ->

0 commit comments

Comments
 (0)