Skip to content

Commit

Permalink
Add Linux process cgroup attribute (open-telemetry#1364)
Browse files Browse the repository at this point in the history
Co-authored-by: Joao Grassi <5938087+joaopgrassi@users.noreply.github.com>
Co-authored-by: Liudmila Molkova <limolkova@microsoft.com>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 5a13679 commit b75c8c2
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .chloggen/add_process_cgroup.yaml
Original file line number Diff line number Diff line change
@@ -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: linux

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add linux.process.cgroup attribute

# 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: [1357]

# (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:
11 changes: 11 additions & 0 deletions docs/attributes-registry/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Process

- [Process Attributes](#process-attributes)
- [Process Linux Attributes](#process-linux-attributes)
- [Deprecated Process Attributes](#deprecated-process-attributes)

## Process Attributes
Expand Down Expand Up @@ -72,6 +73,16 @@ An operating system process.
| `major` | major | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `minor` | minor | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

## Process Linux Attributes

Describes Linux Process attributes

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <a id="process-linux-cgroup" href="#process-linux-cgroup">`process.linux.cgroup`</a> | string | The control group associated with the process. [4] | `1:name=systemd:/user.slice/user-1000.slice/session-3.scope`; `0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[4] `process.linux.cgroup`:** Control groups (cgroups) are a kernel feature used to organize and manage process resources. This attribute provides the path(s) to the cgroup(s) associated with the process, which should match the contents of the [/proc/<PID>/cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html) file.

## Deprecated Process Attributes

Deprecated process attributes.
Expand Down
3 changes: 3 additions & 0 deletions docs/resource/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
| [`process.command_line`](/docs/attributes-registry/process.md) | 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"` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.executable.name`](/docs/attributes-registry/process.md) | 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` | `Conditionally Required` [4] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.executable.path`](/docs/attributes-registry/process.md) | 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` | `Conditionally Required` [5] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.linux.cgroup`](/docs/attributes-registry/process.md) | string | The control group associated with the process. [6] | `1:name=systemd:/user.slice/user-1000.slice/session-3.scope`; `0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.owner`](/docs/attributes-registry/process.md) | string | The username of the user that owns the process. | `root` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.parent_pid`](/docs/attributes-registry/process.md) | int | Parent Process identifier (PPID). | `111` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`process.pid`](/docs/attributes-registry/process.md) | int | Process identifier (PID). | `1234` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand All @@ -56,6 +57,8 @@

**[5] `process.executable.path`:** See [Selecting process attributes](#selecting-process-attributes) for details.

**[6] `process.linux.cgroup`:** Control groups (cgroups) are a kernel feature used to organize and manage process resources. This attribute provides the path(s) to the cgroup(s) associated with the process, which should match the contents of the [/proc/<PID>/cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html) file.

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
Expand Down
17 changes: 17 additions & 0 deletions model/process/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,20 @@ groups:
value: 'minor'
stability: experimental
stability: experimental
# process.linux* attribute group
- id: registry.process.linux
type: attribute_group
brief: "Describes Linux Process attributes"
attributes:
- id: process.linux.cgroup
type: string
stability: experimental
brief: The control group associated with the process.
examples: ["1:name=systemd:/user.slice/user-1000.slice/session-3.scope", "0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope"]
note: >
Control groups (cgroups) are a kernel feature used to organize and
manage process resources. This attribute provides the path(s) to the
cgroup(s) associated with the process, which should match the contents
of the
[/proc/<PID>/cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html)
file.
1 change: 1 addition & 0 deletions model/process/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ groups:
requirement_level:
conditionally_required: See [Selecting process attributes](#selecting-process-attributes) for details.
- ref: process.owner
- ref: process.linux.cgroup

- id: resource.process.runtime
type: resource
Expand Down

0 comments on commit b75c8c2

Please sign in to comment.