Skip to content

Commit

Permalink
[chore] move process metrics to the registry (#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
trisch-me authored May 8, 2024
1 parent db1a97b commit e979d41
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 47 deletions.
35 changes: 35 additions & 0 deletions docs/attributes-registry/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

# Process

- [Process](#process-attributes)
- [Process Cpu](#process-cpu-attributes)

## Process Attributes

An operating system process.
Expand All @@ -15,6 +18,7 @@ An operating system process.
| `process.command` | string | The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. | `cmd/otelcol` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.command_args` | string[] | All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. | `cmd/otecol`; `--config=config.yaml` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.command_line` | string | The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. | `C:\cmd\otecol --config="my directory\config.yaml"` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.context_switch_type` | string | Specifies whether the context switches for this data point were voluntary or involuntary. | `voluntary`; `involuntary` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.creation.time` | string | The date and time the process was created, in ISO 8601 format. | `2023-11-21T09:25:34.853Z` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.executable.name` | string | The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. | `otelcol` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.executable.path` | string | The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. | `/usr/bin/cmd/otelcol` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand All @@ -23,6 +27,7 @@ An operating system process.
| `process.group_leader.pid` | int | The PID of the process's group leader. This is also the process group ID (PGID) of the process. | `23` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.interactive` | boolean | Whether the process is connected to an interactive shell. | | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.owner` | string | The username of the user that owns the process. | `root` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.paging.fault_type` | string | The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults. | `major`; `minor` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.parent_pid` | int | Parent Process identifier (PPID). | `111` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.pid` | int | Process identifier (PID). | `1234` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `process.real_user.id` | int | The real user ID (RUID) of the process. | `1000` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand All @@ -38,3 +43,33 @@ An operating system process.
| `process.vpid` | int | Virtual process identifier. [1] | `12` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** The process ID within a PID namespace. This is not necessarily unique across all processes on the host but it is unique within the process namespace that the process exists within.

`process.context_switch_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 |
| ------------- | ----------- | ---------------------------------------------------------------- |
| `voluntary` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `involuntary` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`process.paging.fault_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 |
| ------- | ----------- | ---------------------------------------------------------------- |
| `major` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `minor` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

## Process Cpu Attributes

Attributes for process CPU

| Attribute | Type | Description | Examples | Stability |
| ------------------- | ------ | ----------------------------- | ------------------------ | ---------------------------------------------------------------- |
| `process.cpu.state` | string | The CPU state of the process. | `system`; `user`; `wait` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`process.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 |
| -------- | ----------- | ---------------------------------------------------------------- |
| `system` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `user` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `wait` | none | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
4 changes: 2 additions & 2 deletions docs/system/process-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This metric is [recommended][MetricRecommended].
<!-- semconv metric.process.cpu.time(full) -->
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`process.cpu.state`](/docs/attributes-registry/process.md) | string | The CPU state for this data point. A process SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `system`; `user`; `wait` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.cpu.state`](/docs/attributes-registry/process.md) | string | A process SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `system`; `user`; `wait` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`process.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.

Expand All @@ -82,7 +82,7 @@ This metric is [recommended][MetricRecommended].
<!-- semconv metric.process.cpu.utilization(full) -->
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`process.cpu.state`](/docs/attributes-registry/process.md) | string | The CPU state for this data point. A process SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `system`; `user`; `wait` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.cpu.state`](/docs/attributes-registry/process.md) | string | A process SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. | `system`; `user`; `wait` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`process.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.

Expand Down
56 changes: 11 additions & 45 deletions model/metrics/process-metrics.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
groups:
- id: attributes.process.cpu
prefix: process.cpu
type: attribute_group
brief: "Attributes for process CPU metrics."
attributes:
- id: state
brief: "The CPU state for this data point. A process 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: system
value: 'system'
stability: experimental
- id: user
value: 'user'
stability: experimental
- id: wait
value: 'wait'
stability: experimental
stability: experimental
- id: metric.process.cpu.time
type: metric
metric_name: process.cpu.time
Expand All @@ -28,16 +8,24 @@ groups:
unit: "s"
attributes:
- ref: process.cpu.state
brief: >
A process SHOULD be characterized _either_ by data points with no `state`
labels, _or only_ data points with `state` labels.
- id: metric.process.cpu.utilization
type: metric
metric_name: process.cpu.utilization
stability: experimental
brief: "Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process."
brief:
Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs
available to the process.
instrument: gauge
unit: "1"
attributes:
- ref: process.cpu.state
brief: >
A process SHOULD be characterized _either_ by data points with no `state`
labels, _or only_ data points with `state` labels.
- id: metric.process.memory.usage
type: metric
Expand Down Expand Up @@ -102,18 +90,7 @@ groups:
instrument: counter
unit: "{count}"
attributes:
- id: process.context_switch_type
brief: "Specifies whether the context switches for this data point were voluntary or involuntary."
type:
allow_custom_values: true
members:
- id: voluntary
value: 'voluntary'
stability: experimental
- id: involuntary
value: 'involuntary'
stability: experimental
stability: experimental
- ref: process.context_switch_type
- id: metric.process.paging.faults
type: metric
metric_name: process.paging.faults
Expand All @@ -122,15 +99,4 @@ groups:
instrument: counter
unit: "{fault}"
attributes:
- id: process.paging.fault_type
brief: "The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults."
type:
allow_custom_values: true
members:
- id: major
value: 'major'
stability: experimental
- id: minor
value: 'minor'
stability: experimental
stability: experimental
- ref: process.paging.fault_type
49 changes: 49 additions & 0 deletions model/registry/process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,52 @@ groups:
stability: experimental
brief: >
Whether the process is connected to an interactive shell.
- id: context_switch_type
brief: "Specifies whether the context switches for this data point were voluntary or involuntary."
type:
allow_custom_values: true
members:
- id: voluntary
value: 'voluntary'
stability: experimental
- id: involuntary
value: 'involuntary'
stability: experimental
stability: experimental
- id: paging.fault_type
brief: >
The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor`
is for minor/soft page faults.
type:
allow_custom_values: true
members:
- id: major
value: 'major'
stability: experimental
- id: minor
value: 'minor'
stability: experimental
stability: experimental

- id: registry.process.cpu
prefix: process.cpu
type: attribute_group
brief: >
Attributes for process CPU
attributes:
- id: state
brief: >
The CPU state of the process.
type:
allow_custom_values: true
members:
- id: system
value: 'system'
stability: experimental
- id: user
value: 'user'
stability: experimental
- id: wait
value: 'wait'
stability: experimental
stability: experimental

0 comments on commit e979d41

Please sign in to comment.