Skip to content

Commit

Permalink
address review comment
Browse files Browse the repository at this point in the history
Signed-off-by: ChrsMark <[email protected]>
  • Loading branch information
ChrsMark committed Feb 21, 2024
1 parent 0af9fff commit 8abca33
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 24 deletions.
14 changes: 14 additions & 0 deletions docs/attributes-registry/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@ The ID is assinged by the container runtime and can vary in different environmen

**[3]:** [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) and [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) report those under the `RepoDigests` field.
<!-- endsemconv -->

<!-- semconv registry.container.cpu(omit_requirement_level) -->
| Attribute | Type | Description | Examples |
|---|---|---|---|
| `container.cpu.state` | 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` |

`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 |
|---|---|
| `user` | When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows). |
| `system` | When CPU is used by the system (host OS) |
| `kernel` | When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows). |
<!-- endsemconv -->
10 changes: 6 additions & 4 deletions docs/system/container-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ linkTitle: Container

## Container Metrics

### Metric: `container.cpu.utilization`
### Metric: `container.cpu.time`

This metric is optional.

Expand All @@ -23,10 +23,10 @@ This metric is optional.
<!-- semconv metric.container.cpu.time(full) -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `container.cpu.state` | 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 |
| [`container.cpu.state`](../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 |
| [`container.id`](../attributes-registry/container.md) | string | Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. | `a3bf90e006b2` | Recommended |

`container.cpu.state` MUST be one of the following:
`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 |
|---|---|
Expand All @@ -35,7 +35,7 @@ This metric is optional.
| `kernel` | When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows). |
<!-- endsemconv -->

### Metric: `container.memory.utilization`
### Metric: `container.memory.usage`

This metric is optional.

Expand Down Expand Up @@ -70,6 +70,7 @@ This metric is optional.
|---|---|---|---|---|
| [`container.id`](../attributes-registry/container.md) | string | Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. | `a3bf90e006b2` | Recommended |
| [`disk.io.direction`](../attributes-registry/disk.md) | string | The disk IO operation direction. | `read` | Recommended |
| `system.device` | string | The device identifier | `(identifier)` | Recommended |

`disk.io.direction` MUST be one of the following:

Expand All @@ -96,6 +97,7 @@ This metric is optional.
|---|---|---|---|---|
| [`container.id`](../attributes-registry/container.md) | string | Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. | `a3bf90e006b2` | Recommended |
| [`network.io.direction`](../attributes-registry/network.md) | string | The network IO operation direction. | `transmit` | Recommended |
| `system.device` | string | The device identifier | `(identifier)` | Recommended |

`network.io.direction` MUST be one of the following:

Expand Down
22 changes: 2 additions & 20 deletions model/metrics/container.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
groups:
# container.cpu.* metrics and attribute group
- id: attributes.container.cpu
prefix: container.cpu
type: attribute_group
brief: "Describes Container CPU metric attributes"
attributes:
- id: 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."
type:
allow_custom_values: false
members:
- id: user
value: 'user'
brief: "When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows)."
- id: system
value: 'system'
brief: "When CPU is used by the system (host OS)"
- id: kernel
value: 'kernel'
brief: "When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows)."
examples: ["user", "kernel"]
- id: metric.container.cpu.time
type: metric
metric_name: container.cpu.time
Expand Down Expand Up @@ -58,6 +38,7 @@ groups:
attributes:
- ref: container.id
- ref: disk.io.direction
- ref: system.device

# container.network.io.* metrics and attribute group
- id: metric.container.network.io
Expand All @@ -73,3 +54,4 @@ groups:
attributes:
- ref: container.id
- ref: network.io.direction
- ref: system.device
20 changes: 20 additions & 0 deletions model/registry/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,23 @@ groups:
brief: >
Container labels, `<key>` being the label name, the value being the label value.
examples: [ 'container.label.app=nginx' ]
- id: registry.container.cpu
prefix: container.cpu
type: attribute_group
brief: "Describes Container CPU metric attributes"
attributes:
- id: 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."
type:
allow_custom_values: true
members:
- id: user
value: 'user'
brief: "When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows)."
- id: system
value: 'system'
brief: "When CPU is used by the system (host OS)"
- id: kernel
value: 'kernel'
brief: "When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows)."
examples: ["user", "kernel"]

Check failure on line 106 in model/registry/container.yaml

View workflow job for this annotation

GitHub Actions / yamllint

[new-line-at-end-of-file] no new line character at the end of file

0 comments on commit 8abca33

Please sign in to comment.