Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jvm.cpu.count metric #52

Merged
merged 10 commits into from
Aug 16, 2023
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 16 additions & 0 deletions docs/system/runtime-environment-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -289,6 +290,21 @@ and [`com.ibm.lang.management.OperatingSystemMXBean#getProcessCpuTime()`](https:
<!-- semconv metric.jvm.cpu.time(full) -->
<!-- endsemconv -->

### 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).

<!-- semconv metric.jvm.cpu.count(metric_table) -->
| Name | Instrument Type | Unit (UCUM) | Description |
| -------- | --------------- | ----------- | -------------- |
| `jvm.cpu.count` | UpDownCounter | `{cpu}` | Number of processors available to the Java virtual machine. |
<!-- endsemconv -->

<!-- semconv metric.jvm.cpu.count(full) -->
<!-- endsemconv -->

### Metric: `jvm.cpu.recent_utilization`

This metric is [recommended][MetricRecommended].
Expand Down
7 changes: 7 additions & 0 deletions model/metrics/process-runtime-jvm-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading