From 0669ca5b81d366dc21647b8ed967194bb0868a4c Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 16 Aug 2023 14:59:43 -0700 Subject: [PATCH] Add `jvm.cpu.count` metric (#52) Co-authored-by: Armin Ruech --- CHANGELOG.md | 2 ++ docs/system/runtime-environment-metrics.md | 16 ++++++++++++++++ model/metrics/process-runtime-jvm-metrics.yaml | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8c5f52301..a79fc4b3d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ release. - Clarify that `http/dup` has higher precedence than `http` in case both values are present in `OTEL_SEMCONV_STABILITY_OPT_IN` ([#249](https://github.com/open-telemetry/semantic-conventions/pull/249)) +- 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 c0843daf01..b3c7b8cb88 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) @@ -289,6 +290,21 @@ and [`com.ibm.lang.management.OperatingSystemMXBean#getProcessCpuTime()`](https: +### 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.cpu.count` | UpDownCounter | `{cpu}` | Number of processors available to the Java virtual machine. | + + + + + ### Metric: `jvm.cpu.recent_utilization` This metric is [recommended][MetricRecommended]. diff --git a/model/metrics/process-runtime-jvm-metrics.yaml b/model/metrics/process-runtime-jvm-metrics.yaml index d6b4c502a8..683b42ba92 100644 --- a/model/metrics/process-runtime-jvm-metrics.yaml +++ b/model/metrics/process-runtime-jvm-metrics.yaml @@ -114,6 +114,13 @@ groups: instrument: updowncounter unit: "{class}" + - id: metric.jvm.cpu.count + type: metric + metric_name: jvm.cpu.count + brief: "Number of processors available to the Java virtual machine." + instrument: updowncounter + unit: "{cpu}" + - id: metric.jvm.cpu.time type: metric metric_name: jvm.cpu.time