> Source: https://www.ymotongpoo.com/works/otel-specs-ja/semconv/resource/process/


# Processおよびプロセスランタイムリソース

**Status**: [Development][DocumentStatus]

## Process

<!-- semconv entity.process -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->

**Status:** ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid)

**type:** `process`

**Description:** オペレーティングシステムのプロセス。

**Attributes:**

| Role | Key | Stability | [Requirement Level](/works/otel-specs-ja/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
| --- | --- | --- | --- | --- | --- | --- |
| Identity | [`process.creation.time`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Required` | string | プロセスが生成された日時。ISO 8601形式。 | `2023-11-21T09:25:34.853Z` |
| Identity | [`process.pid`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Required` | int | プロセス識別子（PID）。 | `1234` |
| Description | [`process.command`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Recommended` | string | プロセスを起動するために使われたコマンド（すなわちコマンド名）。Linuxベースのシステムでは、`proc/[pid]/cmdline` の0番目の文字列に設定できます。Windowsでは、`GetCommandLineW` から抽出された最初のパラメータに設定できます。 | `cmd/otelcol` |
| Description | [`process.owner`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Recommended` | string | プロセスを所有するユーザーのユーザー名。 | `root` |
| Description | [`process.args_count`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | int | process.command_args配列の長さ。[1] | `4` |
| Description | [`process.command_args`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | string[] | プロセスが受け取った、すべてのコマンド引数（コマンドや実行ファイル自体を含む）。Linuxベースのシステム（およびprocfsをサポートする一部の他のUnix系システム）では、`proc/[pid]/cmdline` から抽出されたnull区切り文字列のリストに従って設定できます。libcベースの実行ファイルの場合、これは `main` に渡される完全なargvベクトルになります。機密データを除外するサニタイズが行われていない限り、デフォルトでは収集すべきではありません（SHOULD NOT）。 | `["cmd/otecol", "--config=config.yaml"]` |
| Description | [`process.command_line`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | string | プロセスを起動するために使われた完全なコマンドを表す単一の文字列。Windowsでは、`GetCommandLineW` の結果に設定できます。監視のためだけに組み立てる必要がある場合はこれを設定せず、代わりに `process.command_args` を使ってください。機密データを除外するサニタイズが行われていない限り、デフォルトでは収集すべきではありません（SHOULD NOT）。 | `C:\cmd\otecol --config="my directory\config.yaml"` |
| Description | [`process.interactive`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | boolean | プロセスが対話的シェルに接続されているかどうか。 | |
| Description | [`process.linux.cgroup`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | string | プロセスに関連付けられたコントロールグループ。[2] | `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` |
| Description | [`process.parent_pid`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | int | 親プロセス識別子（PPID）。 | `111` |
| Description | [`process.title`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | string | プロセスタイトル（proctitle）。[3] | `cat /etc/hostname`; `xfce4-session`; `bash` |
| Description | [`process.working_directory`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Opt-In` | string | プロセスの作業ディレクトリ。 | `/root` |

**[1] `process.args_count`:** このフィールドは、プロセスの起動時にいくつの引数が渡されたかを問い合わせたり、バケット分析したりする際に役立ちます。引数が多いことは、疑わしい活動の兆候である場合があります。

**[2] `process.linux.cgroup`:** コントロールグループ（cgroups）は、プロセスリソースを整理・管理するために使われるカーネル機能です。この属性は、そのプロセスに関連付けられたcgroupへのパスを提供し、[/proc/\[PID\]/cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html)ファイルの内容と一致すべきです（SHOULD）。

**[3] `process.title`:** 多くのUnix系システムでは、プロセスタイトル（proctitle）は、ps、top、htopのようなシステム監視ツールによって表示される、実行中のプロセスの名前またはコマンドラインを表す文字列です。
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### プロセスコマンド属性の選び方

コマンド情報を提供する場合は、[`process.command_args`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/)を優先してください。[`process.command_line`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/)は、ネイティブの形式が単一の文字列であるシステムでのみ使用してください。サニタイズやプライバシーの都合でコマンド引数を収集できない場合は、代わりに[`process.command`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/)を[`process.args_count`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/)と組み合わせて使用してください。

## プロセスランタイム

<!-- semconv entity.process.runtime -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->

**Status:** ![Development](https://img.shields.io/badge/-development-blue)

**type:** `process.runtime`

**Description:** 監視対象となる単一の（言語）ランタイムインスタンス。

**Attributes:**

| Role | Key | Stability | [Requirement Level](/works/otel-specs-ja/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
| --- | --- | --- | --- | --- | --- | --- |
| Identity | [`process.runtime.name`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Recommended` | string | このプロセスのランタイムの名前。 | `OpenJDK Runtime Environment` |
| Identity | [`process.runtime.version`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Recommended` | string | このプロセスのランタイムのバージョン。ランタイムが変更なしに返す値。 | `14.0.2` |
| Description | [`process.runtime.description`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/process/) | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | `Recommended` | string | プロセスのランタイムに関する追加の説明。例えば、ランタイム環境に対する特定ベンダーによるカスタマイズなど。 | `Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0` |
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

これらの属性を特定のランタイム種別に対してどう設定するかは、以下の節で説明します。

これらの属性に加えて、[`telemetry.sdk.language`](https://opentelemetry.io/docs/specs/semconv/resource/#telemetry-sdk)を使うことで、使用されているランタイムの大まかな種類を判定できます。

### Erlangランタイム

- `process.runtime.name` - 使用されているErlang VMの名前。すなわち `erlang:system_info(machine)`。
- `process.runtime.version` - ランタイム（ERTS - Erlang Runtime System）のバージョン。すなわち `erlang:system_info(version)`。
- `process.runtime.description` - string | OTPバージョン（すなわち `erlang:system_info(otp_release)`）とERTSバージョンを組み合わせて作られる、ランタイムに関する追加の説明。

例:

| `process.runtime.name` | `process.runtime.version` | `process.runtime.description` |
| --- | --- | --- |
| `BEAM` | `11.1` | `Erlang/OTP 23 erts-11.1` |

### Goランタイム

Goランタイムは、次のように値を設定すべきです（SHOULD）。

- `process.runtime.name` - Goの[`runtime.Compiler`](https://pkg.go.dev/runtime#Compiler)定数を、次の規則に従って解釈した値を設定します。
  値が `gc` の場合は `go` を設定します。それ以外の場合は `runtime.Compiler` の値をそのまま設定します。

  これは、次のGoスニペットで実装できます。

  ```go
  import "runtime"

  func getRuntimeName() string {
    if runtime.Compiler == "gc" {
      return "go"
    }
    return runtime.Compiler
  }
  ```

- `process.runtime.version` - `runtime.Version()` が返す値をそのまま設定します。例えば `go1.17`。
- `process.runtime.description` - このフィールドの使用は推奨されません。

一部のGoコンパイラ・ランタイムの例:

| `process.runtime.name` | Description |
| --- | --- |
| `go` | 公式のGoコンパイラ。`cmd/compile`とも呼ばれます。 |
| `gccgo` | [gccgo](https://go.dev/doc/install/gccgo)は、GCCの[フロントエンド](https://gcc.gnu.org/frontends.html)として実装されたGoコンパイラです。 |
| `tinygo` | [TinyGo](https://tinygo.org/)コンパイラ。 |

### Javaランタイム

Javaの計装は、システムプロパティから値をコピーして設定すべきです（SHOULD）。

- `process.runtime.name` - `java.runtime.name` の値をそのまま設定します。
- `process.runtime.version` - `java.runtime.version` の値をそのまま設定します。
- `process.runtime.description` - `java.vm.vendor`、`java.vm.name`、`java.vm.version` の値を、
  この順序でスペース区切りにして設定します。

一部のJavaランタイムの例

| Name | `process.runtime.name` | `process.runtime.version` | `process.runtime.description` |
| --- | --- | --- | --- |
| OpenJDK | `OpenJDK Runtime Environment` | `11.0.8+10` | `Oracle Corporation OpenJDK 64-Bit Server VM 11.0.8+10` |
| AdoptOpenJDK Eclipse J9 | `OpenJDK Runtime Environment` | `11.0.8+10` | `Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0` |
| AdoptOpenJDK Hotspot | `OpenJDK Runtime Environment` | `11.0.8+10` | `AdoptOpenJDK OpenJDK 64-Bit Server VM 11.0.8+10` |
| SapMachine | `OpenJDK Runtime Environment` | `11.0.8+10-LTS-sapmachine` | `SAP SE OpenJDK 64-Bit Server VM 11.0.8+10-LTS-sapmachine` |
| Zulu OpenJDK | `OpenJDK Runtime Environment` | `11.0.8+10-LTS` | `Azul Systems, Inc OpenJDK 64-Bit Server VM Zulu11.41+23-CA` |
| Oracle Hotspot 8 (32 bit) | `Java(TM) SE Runtime Environment` | `1.8.0_221-b11` | `Oracle Corporation Java HotSpot(TM) Client VM 25.221-b11` |
| IBM J9 8 | `Java(TM) SE Runtime Environment` | `8.0.5.25 - pwa6480sr5fp25-20181030_01(SR5 FP25)` | `IBM Corporation IBM J9 VM 2.9` |
| Android 11 | `Android Runtime` | `0.9` | `The Android Project Dalvik 2.1.0` |

### JavaScriptランタイム

JavaScriptの計装は、組み込みのランタイム定数から値をコピーして設定すべきです（SHOULD）。

- `process.runtime.name`:
  - ランタイムがNode.jsの場合、定数値 `nodejs` を設定します。
  - ランタイムがWebブラウザの場合、定数値 `browser` を設定します。
- `process.runtime.version`:
  - ランタイムがNode.jsの場合、`process.versions.node` の値を設定します。
  - ランタイムがWebブラウザの場合、`navigator.userAgent` の値を設定します。

一部のJavaScriptランタイムの例

| Name | `process.runtime.name` | `process.runtime.version` |
| --- | --- | --- |
| Node.js | `nodejs` | `14.15.4` |
| Web Browser | `browser` | `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36` |

### .NETランタイム

.NETの計装は、次の値に従って設定すべきです（SHOULD）。

- `process.runtime.name` - ランタイムの名前を設定します。
- `process.runtime.version` - .NETでは `System.Environment.Version` の値を設定します。
  .NET Frameworkでは、[レジストリの値](https://learn.microsoft.com/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#query-the-registry-using-code)に基づいてバージョンを判定します。
- `process.runtime.description` - `System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription` の値を設定します。

`process.runtime.name` には、次のよく知られた値の一覧があります。いずれかが該当する場合はその値を使用すべきであり（SHOULD）、それ以外の場合は独自の値を使うべきです（SHOULD）。

- .NET Framework
- .NET
- .NET Core
- .NET Native

一部の.NETランタイムの例

| Name | `process.runtime.name` | `process.runtime.version` | `process.runtime.description` |
| --- | --- | --- | --- |
| .NET Framework | `.NET Framework` | `4.8` | `.NET Framework 4.8.9195.0` |
| .NET | `.NET` | `7.0.14` | `.NET 7.0.14` |

### Pythonランタイム

Pythonの計装は、次のように値を設定すべきです（SHOULD）。

- `process.runtime.name` -
  [`sys.implementation.name`][py_impl]の値を設定します。
- `process.runtime.version` -
  [`sys.implementation.version`][py_impl]の値をドットで連結して設定します。
  リリースレベルが `final` かつシリアルが0の場合は、
  リリースレベルとシリアルを省略します
  （両方を省略するか、両方とも省略しないかのいずれかにします）。

  これは、次のPythonスニペットで実装できます。

  ```python
  vinfo = sys.implementation.version
  result =  ".".join(map(
      str,
      vinfo[:3]
      if vinfo.releaselevel == "final" and not vinfo.serial
      else vinfo
  ))
  ```

- `process.runtime.description` - [`sys.version`](https://docs.python.org/3/library/sys.html#sys.version)の値をそのまま設定します。

[py_impl]: https://docs.python.org/3/library/sys.html#sys.implementation

一部のPythonランタイムの例:

| Name | `process.runtime.name` | `process.runtime.version` | `process.runtime.description` |
| --- | --- | --- | --- |
| CPython 3.7.3 on Windows | `cpython` | `3.7.3` | `3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]` |
| CPython 3.13.1 on Linux | `cpython` | `3.13.1` | `3.13.1 (main, Dec  6 2024, 18:40:43) [Clang 18.1.8 ]` |
| PyPy 3 7.3.17 on Linux | `pypy` | `7.3.17` | `3.10.14 (39dc8d3c85a7, Aug 27 2024, 14:32:27)<br>[PyPy 7.3.17 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]` |

CPythonのGCC・ClangによるLinuxビルド（3.9まで）とPyPyでは、`sys.version` 文字列の中に実際の改行が含まれることに注意してください。

### Rubyランタイム

Rubyの計装は、組み込みのランタイム定数から値をコピーして設定すべきです（SHOULD）。

- `process.runtime.name` - `RUBY_ENGINE` の値をそのまま設定します。
- `process.runtime.version` - `RUBY_VERSION` の値をそのまま設定します。
- `process.runtime.description` - `RUBY_DESCRIPTION` の値をそのまま設定します。

一部のRubyランタイムの例

| Name | `process.runtime.name` | `process.runtime.version` | `process.runtime.description` |
| --- | --- | --- | --- |
| MRI | `ruby` | `2.7.1` | `ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]` |
| TruffleRuby | `truffleruby` | `2.6.2` | `truffleruby (Shopify) 20.0.0-dev-92ed3059, like ruby 2.6.2, GraalVM CE Native [x86_64-darwin]` |

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

