# JVM

Site [llms.txt](/llms.txt)

---

## Java Virtual Machine (JVM) Attributes

This document defines Java Virtual machine related attributes.

**Attributes:**

| Key | Stability | Value Type | Description | Example Values |
| --- | --- | --- | --- | --- |
| <a id="jvm-buffer-pool-name" href="#jvm-buffer-pool-name">`jvm.buffer.pool.name`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | Name of the buffer pool. [1] | `mapped`; `direct` |
| <a id="jvm-executor-name" href="#jvm-executor-name">`jvm.executor.name`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | Name of the executor. [2] | `pool-1-thread-*`; `ForkJoinPool.commonPool-worker-*`; `orders-vt-*` |
| <a id="jvm-executor-owner-name" href="#jvm-executor-owner-name">`jvm.executor.owner.name`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | Name of the logical component that owns the executor. [3] | `tomcat`; `jetty`; `netty` |
| <a id="jvm-executor-thread-state" href="#jvm-executor-thread-state">`jvm.executor.thread.state`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | State of an executor thread. | `active`; `idle` [(see more)](#jvm-executor-thread-state-values) |
| <a id="jvm-executor-type" href="#jvm-executor-type">`jvm.executor.type`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | The fully qualified class name of the executor implementation. | `java.util.concurrent.ThreadPoolExecutor`; `java.util.concurrent.ForkJoinPool` |
| <a id="jvm-gc-action" href="#jvm-gc-action">`jvm.gc.action`</a> | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | string | Name of the garbage collector action. [4] | `end of minor GC`; `end of major GC` |
| <a id="jvm-gc-cause" href="#jvm-gc-cause">`jvm.gc.cause`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | Name of the garbage collector cause. [5] | `System.gc()`; `Allocation Failure` |
| <a id="jvm-gc-name" href="#jvm-gc-name">`jvm.gc.name`</a> | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | string | Name of the garbage collector. [6] | `G1 Young Generation`; `G1 Old Generation` |
| <a id="jvm-memory-pool-name" href="#jvm-memory-pool-name">`jvm.memory.pool.name`</a> | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | string | Name of the memory pool. [7] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` |
| <a id="jvm-memory-type" href="#jvm-memory-type">`jvm.memory.type`</a> | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | string | The type of memory. | `heap`; `non_heap` [(see more)](#jvm-memory-type-values) |
| <a id="jvm-thread-daemon" href="#jvm-thread-daemon">`jvm.thread.daemon`</a> | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | boolean | Whether the thread is daemon or not. | |
| <a id="jvm-thread-state" href="#jvm-thread-state">`jvm.thread.state`</a> | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | string | State of the thread. | `runnable`; `blocked` [(see more)](#jvm-thread-state-values) |

**[1] `jvm.buffer.pool.name`:** Pool names are generally obtained via [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()).

**[2] `jvm.executor.name`:** The executor name SHOULD be low-cardinality. If `jvm.executor.owner.name` is present, the combination of `jvm.executor.owner.name` and `jvm.executor.name` SHOULD be unique within the instrumented application; otherwise, `jvm.executor.name` SHOULD be unique when an executor-specific name is available. If the executor implementation does not provide an explicit name, instrumentation SHOULD derive a name from available implementation-specific metadata, such as a normalized worker thread name. If no executor-specific name or metadata is available, instrumentation MAY use `unknown`. The `unknown` value does not identify an executor, and metrics from multiple executors using this value MAY be aggregated. Users requiring per-executor metric series SHOULD configure a distinct name through the executor's `ThreadFactory`. Instrumentations SHOULD document how the name is derived and how users can configure it. Once metric series registration for an executor has started, `jvm.executor.name` and `jvm.executor.owner.name` MUST remain stable for the lifetime of that registration. Instrumentations SHOULD determine these attributes before the first worker is registered. Instrumentations MUST NOT re-register cumulative metrics under a new attribute set or replay prior cumulative values under new attributes.

**[3] `jvm.executor.owner.name`:** The executor owner name SHOULD be a low-cardinality identifier for the component that creates and configures the executor. It is neither the executor implementation type nor an OpenTelemetry instrumentation scope.

**[4] `jvm.gc.action`:** Garbage collector action is generally obtained via [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()).

**[5] `jvm.gc.cause`:** Garbage collector cause is generally obtained via [GarbageCollectionNotificationInfo#getGcCause()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcCause()).

**[6] `jvm.gc.name`:** Garbage collector name is generally obtained via [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()).

**[7] `jvm.memory.pool.name`:** Pool names are generally obtained via [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()).

---

<a id="jvm-executor-thread-state-values"></a>

`jvm.executor.thread.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
| --- | --- | --- |
| `active` | The thread is currently executing a task. | ![Development](https://img.shields.io/badge/-development-blue) |
| `idle` | The thread currently exists but is not executing a task. | ![Development](https://img.shields.io/badge/-development-blue) |

---

<a id="jvm-memory-type-values"></a>

`jvm.memory.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
| --- | --- | --- |
| `heap` | Heap memory. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `non_heap` | Non-heap memory | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

---

<a id="jvm-thread-state-values"></a>

`jvm.thread.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
| --- | --- | --- |
| `blocked` | A thread that is blocked waiting for a monitor lock is in this state. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `new` | A thread that has not yet started is in this state. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `runnable` | A thread executing in the Java virtual machine is in this state. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `terminated` | A thread that has exited is in this state. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `timed_waiting` | A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| `waiting` | A thread that is waiting indefinitely for another thread to perform a particular action is in this state. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
