From b4aa9c0fed3047937a4e0c17083f9036b3529388 Mon Sep 17 00:00:00 2001 From: gregor Date: Mon, 15 May 2023 09:51:16 +0200 Subject: [PATCH 1/4] add namespace to jvm metric attributes --- CHANGELOG.md | 19 +++++++++ docs/general/attributes.md | 1 + docs/system/runtime-environment-metrics.md | 42 +++++++++---------- ...cess-runtime-jvm-metrics-experimental.yaml | 5 ++- .../metrics/process-runtime-jvm-metrics.yaml | 10 ++--- model/trace/general.yaml | 3 ++ schema-next.yaml | 15 +++++++ 7 files changed, 68 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf8ad93306..df156e6a79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,25 @@ release. ([#224](https://github.com/open-telemetry/semantic-conventions/pull/224)) - Update HTTP `network.protocol.version` examples to match HTTP RFCs. ([#228](https://github.com/open-telemetry/semantic-conventions/pull/228)) +- BREAKING: Add namespaces to JVM metric attributes ([#20](https://github.com/open-telemetry/semantic-conventions/pull/20)). + - Rename attributes `type` to `jvm.memory.type`, `pool` to `jvm.memory.pool.name` + - Applies to metrics: + - `process.runtime.jvm.memory.usage` + - `process.runtime.jvm.memory.init` + - `process.runtime.jvm.memory.committed` + - `process.runtime.jvm.memory.limit` + - `process.runtime.jvm.memory.usage_after_last_gc` + - Rename attributes `gc`, `action` to `jvm.gc.name`, `jvm.gc.action` + - Applies to metrics: + - `process.runtime.jvm.gc.duration` + - Rename attribute `daemon` to `thread.daemon` + - Applies to metrics: + - `process.runtime.jvm.threads.count` + - Rename attribute `pool` to `jvm.buffer.pool.name` + - Applies to metrics: + - `process.runtime.jvm.buffer.usage` + - `process.runtime.jvm.buffer.limit` + - `process.runtime.jvm.buffer.count` ## v1.21.0 (2023-07-13) diff --git a/docs/general/attributes.md b/docs/general/attributes.md index 13e98d5595..b9902ad5c3 100644 --- a/docs/general/attributes.md +++ b/docs/general/attributes.md @@ -351,6 +351,7 @@ a thread that started a span. |---|---|---|---|---| | `thread.id` | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` | Recommended | | `thread.name` | string | Current thread name. | `main` | Recommended | +| `thread.daemon` | boolean | Whether the thread is daemon or not. | | Recommended | Examples of where `thread.id` and `thread.name` can be extracted from: diff --git a/docs/system/runtime-environment-metrics.md b/docs/system/runtime-environment-metrics.md index 280450102c..729afaaa8b 100644 --- a/docs/system/runtime-environment-metrics.md +++ b/docs/system/runtime-environment-metrics.md @@ -91,12 +91,12 @@ This metric is obtained from [`MemoryPoolMXBean#getUsage()`](https://docs.oracle | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `type` | string | The type of memory. | `heap`; `non_heap` | Recommended | -| `pool` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | +| `jvm.memory.type` | string | The type of memory. | `heap`; `non_heap` | Recommended | +| `jvm.memory.pool.name` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | **[1]:** 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()). -`type` MUST be one of the following: +`jvm.memory.type` MUST be one of the following: | Value | Description | |---|---| @@ -118,12 +118,12 @@ This metric is obtained from [`MemoryPoolMXBean#getUsage()`](https://docs.oracle | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `type` | string | The type of memory. | `heap`; `non_heap` | Recommended | -| `pool` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | +| `jvm.memory.type` | string | The type of memory. | `heap`; `non_heap` | Recommended | +| `jvm.memory.pool.name` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | **[1]:** 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()). -`type` MUST be one of the following: +`jvm.memory.type` MUST be one of the following: | Value | Description | |---|---| @@ -145,12 +145,12 @@ This metric is obtained from [`MemoryPoolMXBean#getUsage()`](https://docs.oracle | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `type` | string | The type of memory. | `heap`; `non_heap` | Recommended | -| `pool` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | +| `jvm.memory.type` | string | The type of memory. | `heap`; `non_heap` | Recommended | +| `jvm.memory.pool.name` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | **[1]:** 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()). -`type` MUST be one of the following: +`jvm.memory.type` MUST be one of the following: | Value | Description | |---|---| @@ -172,12 +172,12 @@ This metric is obtained from [`MemoryPoolMXBean#getCollectionUsage()`](https://d | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `type` | string | The type of memory. | `heap`; `non_heap` | Recommended | -| `pool` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | +| `jvm.memory.type` | string | The type of memory. | `heap`; `non_heap` | Recommended | +| `jvm.memory.pool.name` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | **[1]:** 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()). -`type` MUST be one of the following: +`jvm.memory.type` MUST be one of the following: | Value | Description | |---|---| @@ -204,8 +204,8 @@ of `[]` (single bucket histogram capturing count, sum, min, max). | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `gc` | string | Name of the garbage collector. [1] | `G1 Young Generation`; `G1 Old Generation` | Recommended | -| `action` | string | Name of the garbage collector action. [2] | `end of minor GC`; `end of major GC` | Recommended | +| `jvm.gc.name` | string | Name of the garbage collector. [1] | `G1 Young Generation`; `G1 Old Generation` | Recommended | +| `jvm.gc.action` | string | Name of the garbage collector action. [2] | `end of minor GC`; `end of major GC` | Recommended | **[1]:** 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()). @@ -228,7 +228,7 @@ Note that this is the number of platform threads (as opposed to virtual threads) | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `daemon` | boolean | Whether the thread is daemon or not. | | Recommended | +| [`thread.daemon`](../general/attributes.md) | boolean | Whether the thread is daemon or not. | | Recommended | ### Metric: `process.runtime.jvm.classes.loaded` @@ -325,12 +325,12 @@ This metric is obtained from [`MemoryPoolMXBean#getUsage()`](https://docs.oracle | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `type` | string | The type of memory. | `heap`; `non_heap` | Recommended | -| `pool` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | +| `jvm.memory.type` | string | The type of memory. | `heap`; `non_heap` | Recommended | +| `jvm.memory.pool.name` | string | Name of the memory pool. [1] | `G1 Old Gen`; `G1 Eden space`; `G1 Survivor Space` | Recommended | **[1]:** 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()). -`type` MUST be one of the following: +`jvm.memory.type` MUST be one of the following: | Value | Description | |---|---| @@ -385,7 +385,7 @@ This metric is obtained from [`BufferPoolMXBean#getMemoryUsed()`](https://docs.o | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `pool` | string | Name of the buffer pool. [1] | `mapped`; `direct` | Recommended | +| `jvm.buffer.pool.name` | string | Name of the buffer pool. [1] | `mapped`; `direct` | Recommended | **[1]:** 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()). @@ -404,7 +404,7 @@ This metric is obtained from [`BufferPoolMXBean#getTotalCapacity()`](https://doc | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `pool` | string | Name of the buffer pool. [1] | `mapped`; `direct` | Recommended | +| `jvm.buffer.pool.name` | string | Name of the buffer pool. [1] | `mapped`; `direct` | Recommended | **[1]:** 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()). @@ -423,7 +423,7 @@ This metric is obtained from [`BufferPoolMXBean#getCount()`](https://docs.oracle | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| `pool` | string | Name of the buffer pool. [1] | `mapped`; `direct` | Recommended | +| `jvm.buffer.pool.name` | string | Name of the buffer pool. [1] | `mapped`; `direct` | Recommended | **[1]:** 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()). diff --git a/model/metrics/process-runtime-jvm-metrics-experimental.yaml b/model/metrics/process-runtime-jvm-metrics-experimental.yaml index 3956368631..9a92279ccb 100644 --- a/model/metrics/process-runtime-jvm-metrics-experimental.yaml +++ b/model/metrics/process-runtime-jvm-metrics-experimental.yaml @@ -34,8 +34,11 @@ groups: - id: attributes.process.runtime.jvm.buffer type: attribute_group brief: "Describes JVM buffer metric attributes." + prefix: jvm.buffer attributes: - - ref: pool + - id: pool.name + type: string + requirement_level: recommended brief: Name of the buffer pool. examples: [ "mapped", "direct" ] note: > diff --git a/model/metrics/process-runtime-jvm-metrics.yaml b/model/metrics/process-runtime-jvm-metrics.yaml index 1721b8e956..ff2b66414f 100644 --- a/model/metrics/process-runtime-jvm-metrics.yaml +++ b/model/metrics/process-runtime-jvm-metrics.yaml @@ -2,6 +2,7 @@ groups: - id: attributes.process.runtime.jvm.memory type: attribute_group brief: "Describes JVM memory metric attributes." + prefix: jvm.memory attributes: - id: type type: @@ -16,7 +17,7 @@ groups: requirement_level: recommended brief: The type of memory. examples: ["heap", "non_heap"] - - id: pool + - id: pool.name type: string requirement_level: recommended brief: Name of the memory pool. @@ -63,8 +64,9 @@ groups: brief: "Duration of JVM garbage collection actions." instrument: histogram unit: "s" + prefix: jvm.gc attributes: - - id: gc + - id: name type: string requirement_level: recommended brief: Name of the garbage collector. @@ -88,9 +90,7 @@ groups: instrument: updowncounter unit: "{thread}" attributes: - - id: daemon - brief: "Whether the thread is daemon or not." - type: boolean + - ref: thread.daemon requirement_level: recommended - id: metric.process.runtime.jvm.classes.loaded diff --git a/model/trace/general.yaml b/model/trace/general.yaml index 545bce5cab..478937c110 100644 --- a/model/trace/general.yaml +++ b/model/trace/general.yaml @@ -215,6 +215,9 @@ groups: brief: > Current thread name. examples: main + - id: daemon + brief: "Whether the thread is daemon or not." + type: boolean - id: code prefix: code type: span diff --git a/schema-next.yaml b/schema-next.yaml index 14e82faac1..eb32ad0bcf 100644 --- a/schema-next.yaml +++ b/schema-next.yaml @@ -8,6 +8,21 @@ versions: - rename_metrics: http.client.duration: http.client.request.duration http.server.duration: http.server.request.duration + # https://github.com/open-telemetry/opentelemetry-specification/pull/3464 + - rename_attributes: + attribute_map: + type: jvm.memory.type + pool: jvm.memory.pool.name + - rename_attributes: + attribute_map: + name: jvm.gc.name + action: jvm.gc.action + - rename_attributes: + attribute_map: + daemon: thread.daemon + - rename_attributes: + attribute_map: + pool: jvm.buffer.pool.name 1.21.0: spans: changes: From 2149c651d2e511913e9b8c444801ad55c6721539 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 2 Aug 2023 12:41:33 -0700 Subject: [PATCH 2/4] apply_to_metrics --- schema-next.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/schema-next.yaml b/schema-next.yaml index eb32ad0bcf..e5f1a81ec4 100644 --- a/schema-next.yaml +++ b/schema-next.yaml @@ -8,21 +8,35 @@ versions: - rename_metrics: http.client.duration: http.client.request.duration http.server.duration: http.server.request.duration - # https://github.com/open-telemetry/opentelemetry-specification/pull/3464 + # https://github.com/open-telemetry/semantic-conventions/pull/20 - rename_attributes: attribute_map: type: jvm.memory.type pool: jvm.memory.pool.name + apply_to_metrics: + - process.runtime.jvm.memory.usage + - process.runtime.jvm.memory.committed + - process.runtime.jvm.memory.limit + - process.runtime.jvm.memory.usage_after_last_gc + - process.runtime.jvm.memory.init - rename_attributes: attribute_map: name: jvm.gc.name action: jvm.gc.action + apply_to_metrics: + - process.runtime.jvm.gc.duration - rename_attributes: attribute_map: daemon: thread.daemon + apply_to_metrics: + - process.runtime.jvm.threads.count - rename_attributes: attribute_map: pool: jvm.buffer.pool.name + apply_to_metrics: + - process.runtime.jvm.buffer.usage + - process.runtime.jvm.buffer.limit + - process.runtime.jvm.buffer.count 1.21.0: spans: changes: From e42581fbe5bff608629718f1beff0f65a7b7c1b2 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 14 Aug 2023 11:30:44 -0700 Subject: [PATCH 3/4] Use curr metric names in change log --- CHANGELOG.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3896dee6a8..2b29ac2656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,22 +29,22 @@ release. - BREAKING: Add namespaces to JVM metric attributes ([#20](https://github.com/open-telemetry/semantic-conventions/pull/20)). - Rename attributes `type` to `jvm.memory.type`, `pool` to `jvm.memory.pool.name` - Applies to metrics: - - `process.runtime.jvm.memory.usage` - - `process.runtime.jvm.memory.init` - - `process.runtime.jvm.memory.committed` - - `process.runtime.jvm.memory.limit` - - `process.runtime.jvm.memory.usage_after_last_gc` + - `jvm.memory.usage` + - `jvm.memory.init` + - `jvm.memory.committed` + - `jvm.memory.limit` + - `jvm.memory.usage_after_last_gc` - Rename attributes `gc`, `action` to `jvm.gc.name`, `jvm.gc.action` - Applies to metrics: - - `process.runtime.jvm.gc.duration` + - `jvm.gc.duration` - Rename attribute `daemon` to `thread.daemon` - Applies to metrics: - - `process.runtime.jvm.threads.count` + - `jvm.threads.count` - Rename attribute `pool` to `jvm.buffer.pool.name` - Applies to metrics: - - `process.runtime.jvm.buffer.usage` - - `process.runtime.jvm.buffer.limit` - - `process.runtime.jvm.buffer.count` + - `jvm.buffer.usage` + - `jvm.buffer.limit` + - `jvm.buffer.count` ## v1.21.0 (2023-07-13) From 4537ec0609965498b32dee45b9f632fbb3b61039 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 14 Aug 2023 12:02:23 -0700 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b29ac2656..d22fd89a75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ release. - `jvm.memory.committed` - `jvm.memory.limit` - `jvm.memory.usage_after_last_gc` - - Rename attributes `gc`, `action` to `jvm.gc.name`, `jvm.gc.action` + - Rename attributes `gc` to `jvm.gc.name`, `action` to `jvm.gc.action` - Applies to metrics: - `jvm.gc.duration` - Rename attribute `daemon` to `thread.daemon`