この記事は英語の原文を日本語に翻訳したものです。原文: https://opentelemetry.io/docs/specs/semconv/system/container-metrics/

翻訳元: open-telemetry/semantic-conventions v1.44.0(コミット e10a930

コンテナメトリクスに関するセマンティック規約

ステータス: Development

コンテナメトリクス

この文書では、OpenTelemetryにおける一般的なコンテナレベルのメトリクスのInstrumentと属性について説明します。 これらのメトリクスは、技術固有の明確に定義されたAPI(KubeletのAPIやコンテナランタイムなど)から収集されます。

メトリクス: container.uptime

このメトリクスは推奨です。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.uptimeGaugesコンテナが実行されている時間。[1]Developmentcontainer

[1]: 計装は、double型のgaugeを使用し、利用可能な最高精度の浮動小数点数で稼働時間を秒単位で計測すべきです(SHOULD)。 実際の精度は計装とオペレーティングシステムに依存します。

メトリクス: container.cpu.time

このメトリクスは推奨です。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.cpu.timeCounters消費された合計CPU時間。[1]Release Candidatecontainer

[1]: 利用可能なすべてのCPUコアにおいて、その特定のコンテナが消費したCPU時間

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
cpu.modeRelease CandidateConditionally Required [1]stringこのデータポイントのCPUモード。コンテナのCPUメトリクスは、modeラベルを持たないデータポイント、またはmodeラベルを持つデータポイントのいずれかのみによって特徴付けられるべきです(SHOULD)。[2]user; system

[1] cpu.mode: modeが利用可能な場合、つまりDocker Stats API、containerd statsまたはcAdvisorから取得されたメトリクスの場合は必須。

[2] cpu.mode: コンテナに利用可能であれば、次のモードを使用すべきです(SHOULD): usersystemopencontainers/cgroupMoby/DockercAdvisorのような実装では、それぞれの状態はcgroupの統計情報から直接取得されます。cgroup v1では、userモードとsystemモードはcpuacct.statファイルのそれぞれuser統計とsystem統計から取得されます。cgroup v2では、userモードとsystemモードはcpu.statファイルのそれぞれuser_usec統計とsystem_usec統計から取得されます。 Kubernetesは、Kubelet の statsAPIを通じて合計CPU時間(cpu.stat.usage_usec)のみを公開するため、このメトリクスはすべてのモードの合計を意味するmode属性なしで報告すべきです。 純粋なコンテナ環境では、通常CPUのモードが利用可能であり、cpu.modeを報告すべきです。その場合、各モードのCPU時間を合計すると、総CPU時間が得られます。


cpu.modeには、次のよく知られた値の一覧があります。いずれかが該当する場合はその値を使用しなければならず(MUST)、それ以外の場合は独自の値を使ってもかまいません(MAY)。

ValueDescriptionStability
idleIdleRelease Candidate
interruptInterruptRelease Candidate
iowaitIO WaitRelease Candidate
niceNiceRelease Candidate
stealStealRelease Candidate
systemSystemRelease Candidate
userUserRelease Candidate

メトリクス: container.cpu.usage

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.cpu.usageGauge{cpu}コンテナのCPU使用率。CPU数で計測され、0から割り当て可能なCPU数までの範囲を取ります。[1]Developmentcontainer

[1]: 利用可能なすべてのCPUコアにおける、その特定のコンテナのCPU使用率。これは、計測間隔における累積CPU時間(container.cpu.time)の変化量を、経過時間で割ることで算出されます: usageCores = (cpuTimeEnd - cpuTimeStart) / elapsedSeconds

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
cpu.modeRelease CandidateConditionally Required [1]stringこのデータポイントのCPUモード。コンテナのCPUメトリクスは、modeラベルを持たないデータポイント、またはmodeラベルを持つデータポイントのいずれかのみによって特徴付けられるべきです(SHOULD)。[2]user; system

[1] cpu.mode: modeが利用可能な場合、つまりDocker Stats API、containerd statsまたはcAdvisorから取得されたメトリクスの場合は必須。

[2] cpu.mode: コンテナに利用可能であれば、次のモードを使用すべきです(SHOULD): usersystem


cpu.modeには、次のよく知られた値の一覧があります。いずれかが該当する場合はその値を使用しなければならず(MUST)、それ以外の場合は独自の値を使ってもかまいません(MAY)。

ValueDescriptionStability
idleIdleRelease Candidate
interruptInterruptRelease Candidate
iowaitIO WaitRelease Candidate
niceNiceRelease Candidate
stealStealRelease Candidate
systemSystemRelease Candidate
userUserRelease Candidate

メトリクス: container.memory.usage

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.memory.usageUpDownCounterByコンテナのメモリ使用量。[1]Release Candidatecontainer

[1]: アクセスされた時期にかかわらず、すべてのメモリを含む現在のメモリ使用量。 一般に、このメトリクスはcadvisor、特にcontainer_memory_usage_bytesメトリクスから導出できます。 K8sでは、このメトリクスはKubeletのstats APIのContainerStats.MemoryMemoryStats.UsageBytesフィールドから導出されます。

メトリクス: container.memory.available

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.memory.availableUpDownCounterByコンテナで利用可能なメモリ。[1]Release Candidatecontainer

[1]: 利用可能なメモリ。これは、メモリ上限 - workingSetBytesとして定義されます。メモリ上限が未定義の場合、利用可能バイト数は省略されます。 一般に、このメトリクスはcadvisorから、container_spec_memory_limit_bytesメトリクスからcontainer_memory_working_set_bytesメトリクスを減算することで導出できます。 K8sでは、このメトリクスはKubeletのstats APIのContainerStats.MemoryMemoryStats.AvailableBytesフィールドから導出されます。

メトリクス: container.memory.rss

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.memory.rssUpDownCounterByコンテナのメモリRSS。[1]Release Candidatecontainer

[1]: 一般に、このメトリクスはcadvisor、特にcontainer_memory_rssメトリクスから導出できます。 K8sでは、このメトリクスはKubeletのstats APIのContainerStats.MemoryMemoryStats.RSSBytesフィールドから導出されます。

メトリクス: container.memory.working_set

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.memory.working_setUpDownCounterByコンテナのworking setメモリ。[1]Release Candidatecontainer

[1]: 一般に、このメトリクスはcadvisor、特にcontainer_memory_working_set_bytesメトリクスから導出できます。 K8sでは、このメトリクスはKubeletのstats APIのContainerStats.MemoryMemoryStats.WorkingSetBytesフィールドから導出されます。

メトリクス: container.paging.faults

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.paging.faultsCounter{fault}コンテナのメモリページングフォルト。[1]Developmentcontainer

[1]: 一般に、このメトリクスはcadvisor、特にcontainer_memory_failures_total{failure_type=pgfault, scope=container}メトリクスとcontainer_memory_failures_total{failure_type=pgmajfault, scope=container}メトリクスから導出できます。 K8sでは、このメトリクスはKubeletのstats APIのContainerStats.MemoryMemoryStats.PageFaultsフィールドとMemoryStats.MajorPageFaultsフィールドから導出されます。

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
system.paging.fault.typeRelease CandidateRecommendedstringページングフォルトの種別minor

system.paging.fault.typeには、次のよく知られた値の一覧があります。いずれかが該当する場合はその値を使用しなければならず(MUST)、それ以外の場合は独自の値を使ってもかまいません(MAY)。

ValueDescriptionStability
majormajorRelease Candidate
minorminorRelease Candidate

メトリクス: container.disk.io

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.disk.ioCounterByコンテナのディスクバイト数。[1]Developmentcontainer

[1]: 正常に読み書きされたバイト数の合計(すべてのディスクから集計)。

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
disk.io.directionRelease CandidateRecommendedstringディスクIO操作の方向。read
system.deviceDevelopmentRecommendedstringデバイス識別子(identifier)

disk.io.directionには、次のよく知られた値の一覧があります。いずれかが該当する場合はその値を使用しなければならず(MUST)、それ以外の場合は独自の値を使ってもかまいません(MAY)。

ValueDescriptionStability
readreadRelease Candidate
writewriteRelease Candidate

メトリクス: container.network.io

このメトリクスはopt-inです。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.network.ioCounterByコンテナのネットワークバイト数。[1]Developmentcontainer

[1]: コンテナのすべてのネットワークインターフェースで送受信されたバイト数。

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
network.interface.nameRelease CandidateRecommendedstringネットワークインターフェース名。lo; eth0
network.io.directionRelease CandidateRecommendedstring観測対象ホストの物理または仮想ネットワークインターフェースの視点から見たトラフィックの方向。ステートフルな接続やネットワークフローの論理的な方向を表すために使用すべきではありません。transmit

network.io.directionには、次のよく知られた値の一覧があります。いずれかが該当する場合はその値を使用しなければならず(MUST)、それ以外の場合は独自の値を使ってもかまいません(MAY)。

ValueDescriptionStability
receivereceiveRelease Candidate
transmittransmitRelease Candidate

メトリクス: container.filesystem.available

このメトリクスは推奨です。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.filesystem.availableUpDownCounterByコンテナのファイルシステムの利用可能バイト数。[1]Developmentcontainer

[1]: K8sでは、このメトリクスはKubeletのstats APIの ContainerStats.RootfsFsStats.AvailableBytesフィールドから導出されます。

メトリクス: container.filesystem.capacity

このメトリクスは推奨です。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.filesystem.capacityUpDownCounterByコンテナのファイルシステム容量。[1]Developmentcontainer

[1]: K8sでは、このメトリクスはKubeletのstats APIの ContainerStats.RootfsFsStats.CapacityBytesフィールドから導出されます。

メトリクス: container.filesystem.usage

このメトリクスは推奨です。

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
container.filesystem.usageUpDownCounterByコンテナのファイルシステム使用量。[1]Developmentcontainer

[1]: これはcapacity - availableと等しくない場合があります。

K8sでは、このメトリクスはKubeletのstats APIの ContainerStats.RootfsFsStats.UsedBytesフィールドから導出されます。