From e3a5912ec63fd8488fe9740af9693068c31cd80e Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Thu, 25 May 2023 16:28:00 -0700 Subject: [PATCH 1/4] Add process.runtime.jvm.available_processors --- .../metrics/process-runtime-jvm-metrics.yaml | 7 +++++++ .../runtime-environment-metrics.md | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/semantic_conventions/metrics/process-runtime-jvm-metrics.yaml b/semantic_conventions/metrics/process-runtime-jvm-metrics.yaml index fd2aa5d353..9522621ecf 100644 --- a/semantic_conventions/metrics/process-runtime-jvm-metrics.yaml +++ b/semantic_conventions/metrics/process-runtime-jvm-metrics.yaml @@ -122,6 +122,13 @@ groups: instrument: updowncounter unit: "{class}" + - id: metric.process.runtime.jvm.available_processors + type: metric + metric_name: process.runtime.jvm.available_processors + brief: "Number of processors available to the Java virtual machine." + instrument: updowncounter + unit: "{processor}" + - id: metric.process.runtime.jvm.cpu.utilization type: metric metric_name: process.runtime.jvm.cpu.utilization diff --git a/specification/metrics/semantic_conventions/runtime-environment-metrics.md b/specification/metrics/semantic_conventions/runtime-environment-metrics.md index bd5e2dc970..9b325a9a64 100644 --- a/specification/metrics/semantic_conventions/runtime-environment-metrics.md +++ b/specification/metrics/semantic_conventions/runtime-environment-metrics.md @@ -30,6 +30,7 @@ semantic conventions when instrumenting runtime environments. * [Metric: `process.runtime.jvm.classes.loaded`](#metric-processruntimejvmclassesloaded) * [Metric: `process.runtime.jvm.classes.unloaded`](#metric-processruntimejvmclassesunloaded) * [Metric: `process.runtime.jvm.classes.current_loaded`](#metric-processruntimejvmclassescurrent_loaded) + * [Metric: `process.runtime.jvm.available_processors`](#metric-processruntimejvmavailable_processors) * [Metric: `process.runtime.jvm.cpu.utilization`](#metric-processruntimejvmcpuutilization) * [Metric: `process.runtime.jvm.system.cpu.utilization`](#metric-processruntimejvmsystemcpuutilization) * [Metric: `process.runtime.jvm.system.cpu.load_1m`](#metric-processruntimejvmsystemcpuload_1m) @@ -297,6 +298,21 @@ This metric is obtained from [`ClassLoadingMXBean#getLoadedClassCount()`](https: +### Metric: `process.runtime.jvm.available_processors` + +This metric is [recommended][MetricRecommended]. +This metric is obtained from [`Runtime#availableProcessors()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors--). +Note that this is always an integer value (i.e. fractional or millicores are not represented). + + +| Name | Instrument Type | Unit (UCUM) | Description | +| -------- | --------------- | ----------- | -------------- | +| `process.runtime.jvm.available_processors` | UpDownCounter | `{processor}` | Number of processors available to the Java virtual machine. | + + + + + ### Metric: `process.runtime.jvm.cpu.utilization` This metric is [recommended][MetricRecommended]. From d5fcef7f28690d29e73947de41b93b51e1e1deac Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Thu, 25 May 2023 16:29:24 -0700 Subject: [PATCH 2/4] Add change log entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca6606f864..eff0438a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,3 +66,5 @@ release. ([#3458](https://github.com/open-telemetry/opentelemetry-specification/pull/3458)) - Specify the value range for JVM CPU metrics. ([#13](https://github.com/open-telemetry/semantic-conventions/pull/13)) +- Add `process.runtime.jvm.available_processors` metric. + ([#52](https://github.com/open-telemetry/semantic-conventions/pull/52)) From 36f32c10ca5d7d31835858c33be9d40159862115 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sun, 13 Aug 2023 14:41:33 -0700 Subject: [PATCH 3/4] Rename to jvm.cpu.count --- CHANGELOG.md | 2 +- docs/system/runtime-environment-metrics.md | 8 ++++---- model/metrics/process-runtime-jvm-metrics.yaml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46139b365e..dc169ab1bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ release. clients invoking them. - BREAKING: Rename all JVM metrics from `process.runtime.jvm.*` to `jvm.*` ([#241](https://github.com/open-telemetry/semantic-conventions/pull/241)) -- Add `jvm.available_processors` metric. +- Add `jvm.cpu.count` metric. ([#52](https://github.com/open-telemetry/semantic-conventions/pull/52)) ## v1.21.0 (2023-07-13) diff --git a/docs/system/runtime-environment-metrics.md b/docs/system/runtime-environment-metrics.md index 70c9f76acf..ebf43198ec 100644 --- a/docs/system/runtime-environment-metrics.md +++ b/docs/system/runtime-environment-metrics.md @@ -273,19 +273,19 @@ This metric is obtained from [`ClassLoadingMXBean#getLoadedClassCount()`](https: -### Metric: `jvm.available_processors` +### Metric: `jvm.cpu.count` This metric is [recommended][MetricRecommended]. This metric is obtained from [`Runtime#availableProcessors()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors--). Note that this is always an integer value (i.e. fractional or millicores are not represented). - + | Name | Instrument Type | Unit (UCUM) | Description | | -------- | --------------- | ----------- | -------------- | -| `jvm.available_processors` | UpDownCounter | `{processor}` | Number of processors available to the Java virtual machine. | +| `jvm.cpu.count` | UpDownCounter | `{cpu}` | Number of processors available to the Java virtual machine. | - + ### Metric: `jvm.cpu.time` diff --git a/model/metrics/process-runtime-jvm-metrics.yaml b/model/metrics/process-runtime-jvm-metrics.yaml index 92086d5969..ef563abfdf 100644 --- a/model/metrics/process-runtime-jvm-metrics.yaml +++ b/model/metrics/process-runtime-jvm-metrics.yaml @@ -114,12 +114,12 @@ groups: instrument: updowncounter unit: "{class}" - - id: metric.jvm.available_processors + - id: metric.jvm.cpu.count type: metric - metric_name: jvm.available_processors + metric_name: jvm.cpu.count brief: "Number of processors available to the Java virtual machine." instrument: updowncounter - unit: "{processor}" + unit: "{cpu}" - id: metric.jvm.cpu.time type: metric From 0e6a34eb05ca19393052ed8d9085c1402440c3bf Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sun, 13 Aug 2023 14:42:55 -0700 Subject: [PATCH 4/4] re-order --- docs/system/runtime-environment-metrics.md | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/system/runtime-environment-metrics.md b/docs/system/runtime-environment-metrics.md index ebf43198ec..306c27c942 100644 --- a/docs/system/runtime-environment-metrics.md +++ b/docs/system/runtime-environment-metrics.md @@ -30,6 +30,7 @@ semantic conventions when instrumenting runtime environments. * [Metric: `jvm.classes.unloaded`](#metric-jvmclassesunloaded) * [Metric: `jvm.classes.current_loaded`](#metric-jvmclassescurrent_loaded) * [Metric: `jvm.cpu.time`](#metric-jvmcputime) + * [Metric: `jvm.cpu.count`](#metric-jvmcpucount) * [Metric: `jvm.cpu.recent_utilization`](#metric-jvmcpurecent_utilization) - [JVM Metrics (Experimental)](#jvm-metrics-experimental) * [Metric: `jvm.memory.init`](#metric-jvmmemoryinit) @@ -273,35 +274,35 @@ This metric is obtained from [`ClassLoadingMXBean#getLoadedClassCount()`](https: -### Metric: `jvm.cpu.count` +### Metric: `jvm.cpu.time` This metric is [recommended][MetricRecommended]. -This metric is obtained from [`Runtime#availableProcessors()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors--). -Note that this is always an integer value (i.e. fractional or millicores are not represented). - +This metric is obtained from [`com.sun.management.OperatingSystemMXBean#getProcessCpuTime()`](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.management/com/sun/management/OperatingSystemMXBean.html#getProcessCpuTime()) on HotSpot +and [`com.ibm.lang.management.OperatingSystemMXBean#getProcessCpuTime()`](https://www.ibm.com/docs/api/v1/content/SSYKE2_8.0.0/openj9/api/jdk8/jre/management/extension/com/ibm/lang/management/OperatingSystemMXBean.html#getProcessCpuTime--) on J9. + + | Name | Instrument Type | Unit (UCUM) | Description | | -------- | --------------- | ----------- | -------------- | -| `jvm.cpu.count` | UpDownCounter | `{cpu}` | Number of processors available to the Java virtual machine. | +| `jvm.cpu.time` | Counter | `s` | CPU time used by the process as reported by the JVM. | - + -### Metric: `jvm.cpu.time` +### Metric: `jvm.cpu.count` This metric is [recommended][MetricRecommended]. +This metric is obtained from [`Runtime#availableProcessors()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors--). +Note that this is always an integer value (i.e. fractional or millicores are not represented). -This metric is obtained from [`com.sun.management.OperatingSystemMXBean#getProcessCpuTime()`](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.management/com/sun/management/OperatingSystemMXBean.html#getProcessCpuTime()) on HotSpot -and [`com.ibm.lang.management.OperatingSystemMXBean#getProcessCpuTime()`](https://www.ibm.com/docs/api/v1/content/SSYKE2_8.0.0/openj9/api/jdk8/jre/management/extension/com/ibm/lang/management/OperatingSystemMXBean.html#getProcessCpuTime--) on J9. - - + | Name | Instrument Type | Unit (UCUM) | Description | | -------- | --------------- | ----------- | -------------- | -| `jvm.cpu.time` | Counter | `s` | CPU time used by the process as reported by the JVM. | +| `jvm.cpu.count` | UpDownCounter | `{cpu}` | Number of processors available to the Java virtual machine. | - + ### Metric: `jvm.cpu.recent_utilization`