From 21ac55452ca18fd9c9ba8b98334ad0361000c68b Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Thu, 6 Jun 2024 14:48:56 +0300 Subject: [PATCH 01/13] Add container.cpu.usage metric Signed-off-by: ChrsMark --- .chloggen/add_container_cpu_usage.yaml | 22 +++++++++++ docs/system/container-metrics.md | 51 ++++++++++++++++++++++++++ model/metrics/container.yaml | 14 +++++++ 3 files changed, 87 insertions(+) create mode 100755 .chloggen/add_container_cpu_usage.yaml diff --git a/.chloggen/add_container_cpu_usage.yaml b/.chloggen/add_container_cpu_usage.yaml new file mode 100755 index 0000000000..1019fd472b --- /dev/null +++ b/.chloggen/add_container_cpu_usage.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: container + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add container.cpu.usage metric + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index b0fb198f21..e1d2c3cf54 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -63,6 +63,57 @@ This metric is [opt-in][MetricOptIn]. + + + + + +### Metric: `container.cpu.usage` + +This metric is [opt-in][MetricOptIn]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `container.cpu.usage` | Gauge | `{cpu}` | CPU usage [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + + +**[1]:** CPU usage of the specific container on all available CPU cores, averaged over the sample window + + + + + + + + + + + + + + + +| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | +|---|---|---|---|---|---| +| [`container.cpu.state`](/docs/attributes-registry/container.md) | string | The CPU state for this data point. A container SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `user`; `kernel` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +`container.cpu.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 | +|---|---|---| +| `kernel` | When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `system` | When CPU is used by the system (host OS) | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `user` | When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + + + diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index 94adad2921..2927b75aa6 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -15,6 +15,20 @@ groups: note: "Following states SHOULD be used: `user`, `system`, `kernel`" requirement_level: opt_in + - id: metric.container.cpu.usage + type: metric + metric_name: container.cpu.usage + stability: experimental + brief: "CPU usage" + note: > + CPU usage of the specific container on all available CPU cores, averaged over the sample window + instrument: gauge + unit: "{cpu}" + attributes: + - ref: container.cpu.state + brief: "The CPU state for this data point. A container SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels." + requirement_level: opt_in + # container.memory.* metrics and attribute group - id: metric.container.memory.usage type: metric From ba7928d034d96206d597a039e7f29d1043453716 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Thu, 6 Jun 2024 15:01:11 +0300 Subject: [PATCH 02/13] fix changelog Signed-off-by: ChrsMark --- .chloggen/add_container_cpu_usage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/add_container_cpu_usage.yaml b/.chloggen/add_container_cpu_usage.yaml index 1019fd472b..c1c4706b97 100755 --- a/.chloggen/add_container_cpu_usage.yaml +++ b/.chloggen/add_container_cpu_usage.yaml @@ -14,7 +14,7 @@ note: Add container.cpu.usage metric # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. # The values here must be integers. -issues: [] +issues: [1128] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. From 254bd93fd80c74db3270748464104dd86ce7262d Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Wed, 12 Jun 2024 12:11:23 +0300 Subject: [PATCH 03/13] add note about container metrics and usage's brief Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 8 ++++++-- model/metrics/container.yaml | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index e1d2c3cf54..d91d98831e 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -8,6 +8,10 @@ linkTitle: Container ## Container Metrics +This document describes instruments and attributes for common container level +metrics in OpenTelemetry. Collected from technology-specific, +well-defined APIs (e.g. Kubelet's API or container runtimes). + ### Metric: `container.cpu.time` This metric is [opt-in][MetricOptIn]. @@ -81,7 +85,7 @@ This metric is [opt-in][MetricOptIn]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `container.cpu.usage` | Gauge | `{cpu}` | CPU usage [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `container.cpu.usage` | Gauge | `{cpu}` | Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable cpus [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** CPU usage of the specific container on all available CPU cores, averaged over the sample window @@ -102,7 +106,7 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`container.cpu.state`](/docs/attributes-registry/container.md) | string | The CPU state for this data point. A container SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `user`; `kernel` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`container.cpu.state`](/docs/attributes-registry/container.md) | string | The CPU state for this data point. A container's cpu time SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `user`; `kernel` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | `container.cpu.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. diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index 2927b75aa6..ba0b085b2f 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -19,14 +19,15 @@ groups: type: metric metric_name: container.cpu.usage stability: experimental - brief: "CPU usage" + brief: "Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable cpus" note: > CPU usage of the specific container on all available CPU cores, averaged over the sample window instrument: gauge unit: "{cpu}" attributes: - - ref: container.cpu.state - brief: "The CPU state for this data point. A container SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels." + - ref: cpu.mode + brief: "The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels." + note: "Following states SHOULD be used: `user`, `system`, `kernel`" requirement_level: opt_in # container.memory.* metrics and attribute group From 1fe14fd5be539b94ce256948b1cab87c8318c1aa Mon Sep 17 00:00:00 2001 From: Chris Mark Date: Wed, 26 Jun 2024 13:03:05 +0300 Subject: [PATCH 04/13] Update docs/system/container-metrics.md Co-authored-by: Helen <56097766+heyams@users.noreply.github.com> --- docs/system/container-metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index d91d98831e..ea87ea9f4b 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -9,7 +9,7 @@ linkTitle: Container ## Container Metrics This document describes instruments and attributes for common container level -metrics in OpenTelemetry. Collected from technology-specific, +metrics in OpenTelemetry. These metrics are collected from technology-specific, well-defined APIs (e.g. Kubelet's API or container runtimes). ### Metric: `container.cpu.time` From 57febbad559d09db32854abd857ed853358372f8 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Wed, 26 Jun 2024 13:07:51 +0300 Subject: [PATCH 05/13] update attribute Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index ea87ea9f4b..18d55c50dd 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -106,15 +106,24 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`container.cpu.state`](/docs/attributes-registry/container.md) | string | The CPU state for this data point. A container's cpu time SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `user`; `kernel` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** Following states SHOULD be used: `user`, `system`, `kernel` + -`container.cpu.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. + +`cpu.mode` 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 | |---|---|---| -| `kernel` | When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `system` | When CPU is used by the system (host OS) | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `user` | When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows). | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `idle` | idle | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `interrupt` | interrupt | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `iowait` | iowait | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `kernel` | kernel | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `nice` | nice | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `steal` | steal | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `system` | system | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `user` | user | ![Experimental](https://img.shields.io/badge/-experimental-blue) | From 364cf39492b74b2e507d915fb1c5c21fda7c4509 Mon Sep 17 00:00:00 2001 From: Chris Mark Date: Fri, 19 Jul 2024 09:35:25 +0300 Subject: [PATCH 06/13] Update model/metrics/container.yaml Co-authored-by: Pablo Baeyens --- model/metrics/container.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index ba0b085b2f..a67215891f 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -19,7 +19,7 @@ groups: type: metric metric_name: container.cpu.usage stability: experimental - brief: "Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable cpus" + brief: "Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs" note: > CPU usage of the specific container on all available CPU cores, averaged over the sample window instrument: gauge From 7fb2ce22aaee3a78fefd171a98efd1ac662ae87e Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 22 Jul 2024 16:01:32 +0300 Subject: [PATCH 07/13] update markdowns Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index 18d55c50dd..f91a788c51 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -85,7 +85,7 @@ This metric is [opt-in][MetricOptIn]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `container.cpu.usage` | Gauge | `{cpu}` | Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable cpus [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `container.cpu.usage` | Gauge | `{cpu}` | Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** CPU usage of the specific container on all available CPU cores, averaged over the sample window From 69c18235e485b11dfe697106a2a140b56b7735c6 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 22 Jul 2024 16:12:53 +0300 Subject: [PATCH 08/13] add conditionally required Signed-off-by: ChrsMark --- model/metrics/container.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index a67215891f..e4dcf65eb3 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -28,7 +28,8 @@ groups: - ref: cpu.mode brief: "The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels." note: "Following states SHOULD be used: `user`, `system`, `kernel`" - requirement_level: opt_in + requirement_level: + conditionally_required: If mode is available, ie metrics coming from the Docker Stats API. # container.memory.* metrics and attribute group - id: metric.container.memory.usage From 380dfa7197754fdb7971187c24cc310d6dfda465 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 29 Jul 2024 10:58:53 +0300 Subject: [PATCH 09/13] Improve requirement wording Signed-off-by: ChrsMark --- model/metrics/container.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index e4dcf65eb3..6677dc831b 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -29,7 +29,7 @@ groups: brief: "The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels." note: "Following states SHOULD be used: `user`, `system`, `kernel`" requirement_level: - conditionally_required: If mode is available, ie metrics coming from the Docker Stats API. + conditionally_required: Required if mode is available, i.e. metrics coming from the Docker Stats API. # container.memory.* metrics and attribute group - id: metric.container.memory.usage From 7d7e655716bcb665e19fe509c9403b19e8e334af Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 29 Jul 2024 11:18:04 +0300 Subject: [PATCH 10/13] tune cpu.mode for other metric Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 8 ++++++-- model/metrics/container.yaml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index f91a788c51..1574fafc9f 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -46,10 +46,12 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** Following states SHOULD be used: `user`, `system`, `kernel` +**[2]:** Required if mode is available, i.e. metrics coming from the Docker Stats API. + `cpu.mode` 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. @@ -106,10 +108,12 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** Following states SHOULD be used: `user`, `system`, `kernel` +**[2]:** Required if mode is available, i.e. metrics coming from the Docker Stats API. + `cpu.mode` 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. diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index 6677dc831b..7db120f528 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -13,7 +13,8 @@ groups: - ref: cpu.mode brief: "The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels." note: "Following states SHOULD be used: `user`, `system`, `kernel`" - requirement_level: opt_in + requirement_level: + conditionally_required: Required if mode is available, i.e. metrics coming from the Docker Stats API. - id: metric.container.cpu.usage type: metric From 0d5682b89fd6ffab53c9124c06c379a2c09a0cd6 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 29 Jul 2024 16:44:14 +0300 Subject: [PATCH 11/13] revert change in container.cpu.time Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 8 ++------ model/metrics/container.yaml | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index 1574fafc9f..f91a788c51 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -46,12 +46,10 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** Following states SHOULD be used: `user`, `system`, `kernel` -**[2]:** Required if mode is available, i.e. metrics coming from the Docker Stats API. - `cpu.mode` 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. @@ -108,12 +106,10 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** Following states SHOULD be used: `user`, `system`, `kernel` -**[2]:** Required if mode is available, i.e. metrics coming from the Docker Stats API. - `cpu.mode` 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. diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index 7db120f528..6677dc831b 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -13,8 +13,7 @@ groups: - ref: cpu.mode brief: "The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels." note: "Following states SHOULD be used: `user`, `system`, `kernel`" - requirement_level: - conditionally_required: Required if mode is available, i.e. metrics coming from the Docker Stats API. + requirement_level: opt_in - id: metric.container.cpu.usage type: metric From cc8ed1a9179674272e7d3aa13c8394920ee46c2a Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Tue, 30 Jul 2024 09:18:30 +0300 Subject: [PATCH 12/13] aling cpu.mode requirement across metrics Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 8 ++++++-- model/metrics/container.yaml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index f91a788c51..1574fafc9f 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -46,10 +46,12 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** Following states SHOULD be used: `user`, `system`, `kernel` +**[2]:** Required if mode is available, i.e. metrics coming from the Docker Stats API. + `cpu.mode` 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. @@ -106,10 +108,12 @@ This metric is [opt-in][MetricOptIn]. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`cpu.mode`](/docs/attributes-registry/cpu.md) | string | The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels. [1] | `user`; `system` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** Following states SHOULD be used: `user`, `system`, `kernel` +**[2]:** Required if mode is available, i.e. metrics coming from the Docker Stats API. + `cpu.mode` 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. diff --git a/model/metrics/container.yaml b/model/metrics/container.yaml index 6677dc831b..7db120f528 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -13,7 +13,8 @@ groups: - ref: cpu.mode brief: "The CPU mode for this data point. A container's CPU metric SHOULD be characterized _either_ by data points with no `mode` labels, _or only_ data points with `mode` labels." note: "Following states SHOULD be used: `user`, `system`, `kernel`" - requirement_level: opt_in + requirement_level: + conditionally_required: Required if mode is available, i.e. metrics coming from the Docker Stats API. - id: metric.container.cpu.usage type: metric From 9c12ac14b8f632e28691d6d2f100be6f7eefdb1a Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 5 Aug 2024 09:25:04 +0300 Subject: [PATCH 13/13] fix anchor Signed-off-by: ChrsMark --- docs/system/container-metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index 1574fafc9f..c9843f6995 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -99,7 +99,7 @@ This metric is [opt-in][MetricOptIn]. - +