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 5449a117d0..ed0e83dc96 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -54,6 +54,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 f0e15ed596..49a97b14dd 100644 --- a/model/metrics/container.yaml +++ b/model/metrics/container.yaml @@ -14,6 +14,20 @@ groups: 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 + - 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