From 8f9fbdf8d6f29cc9bfb4b553c0f341419e1a5828 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 13 Jun 2023 17:50:05 -0700 Subject: [PATCH] Add `process.runtime.jvm.cpu.time` metric (#55) --- CHANGELOG.md | 2 ++ .../metrics/process-runtime-jvm-metrics.yaml | 7 +++++++ .../runtime-environment-metrics.md | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f7e9a753..e58cbea0e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,3 +80,5 @@ release. ([#70](https://github.com/open-telemetry/semantic-conventions/pull/70)) - Clarify that OTEL_SEMCONV_STABILITY_OPT_IN is a comma-separated list of values ([#104](https://github.com/open-telemetry/semantic-conventions/pull/104)) +- Add `process.runtime.jvm.cpu.time` metric. + ([#55](https://github.com/open-telemetry/semantic-conventions/pull/55)) diff --git a/semantic_conventions/metrics/process-runtime-jvm-metrics.yaml b/semantic_conventions/metrics/process-runtime-jvm-metrics.yaml index 9a2e288925..186c5e83bf 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.cpu.time + type: metric + metric_name: process.runtime.jvm.cpu.time + brief: "CPU time used by the process." + instrument: counter + unit: "s" + - id: metric.process.runtime.jvm.cpu.recent_utilization type: metric metric_name: process.runtime.jvm.cpu.recent_utilization diff --git a/specification/metrics/semantic_conventions/runtime-environment-metrics.md b/specification/metrics/semantic_conventions/runtime-environment-metrics.md index 9451b7a700..fddf1b1640 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.cpu.time`](#metric-processruntimejvmcputime) * [Metric: `process.runtime.jvm.cpu.recent_utilization`](#metric-processruntimejvmcpurecent_utilization) * [Metric: `process.runtime.jvm.system.cpu.utilization`](#metric-processruntimejvmsystemcpuutilization) * [Metric: `process.runtime.jvm.system.cpu.load_1m`](#metric-processruntimejvmsystemcpuload_1m) @@ -298,6 +299,22 @@ This metric is obtained from [`ClassLoadingMXBean#getLoadedClassCount()`](https: +### Metric: `process.runtime.jvm.cpu.time` + +This metric is [recommended][MetricRecommended]. + +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 | +| -------- | --------------- | ----------- | -------------- | +| `process.runtime.jvm.cpu.time` | Counter | `s` | CPU time used by the process. | + + + + + ### Metric: `process.runtime.jvm.cpu.recent_utilization` This metric is [recommended][MetricRecommended].