Semantic Conventions for Kubernetes Metrics

Status: Experimental

K8s Metrics

This document describes instruments and attributes for common K8s level metrics in OpenTelemetry. These metrics are collected from technology-specific, well-defined APIs (e.g. Kubelet’s API).

Metrics in k8s. instruments SHOULD be attached to a K8s Resource and therefore inherit its attributes, like k8s.pod.name and k8s.pod.uid.

Metric: k8s.pod.uptime

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.pod.uptimeGaugesThe time the Pod has been running [1]Experimental

[1]: Instrumentations SHOULD use a gauge with type double and measure uptime in seconds as a floating point number with the highest precision available. The actual accuracy would depend on the instrumentation and operating system.

Metric: k8s.pod.cpu.time

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.pod.cpu.timeCountersTotal CPU time consumed [1]Experimental

[1]: Total CPU time consumed by the specific Pod on all available CPU cores

Metric: k8s.pod.cpu.usage

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.pod.cpu.usageGauge{cpu}Pod’s CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs [1]Experimental

[1]: CPU usage of the specific Pod on all available CPU cores, averaged over the sample window

Metric: k8s.pod.memory.usage

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.pod.memory.usageGaugeByMemory usage of the Pod [1]Experimental

[1]: Total memory usage of the Pod

Metric: k8s.pod.network.io

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.pod.network.ioCounterByNetwork bytes for the PodExperimental
AttributeTypeDescriptionExamplesRequirement LevelStability
network.interface.namestringThe network interface name.lo; eth0RecommendedExperimental
network.io.directionstringThe network IO operation direction.transmitRecommendedExperimental

network.io.direction 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.

ValueDescriptionStability
receivereceiveExperimental
transmittransmitExperimental

Metric: k8s.pod.network.errors

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.pod.network.errorsCounter{error}Pod network errorsExperimental
AttributeTypeDescriptionExamplesRequirement LevelStability
network.interface.namestringThe network interface name.lo; eth0RecommendedExperimental
network.io.directionstringThe network IO operation direction.transmitRecommendedExperimental

network.io.direction 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.

ValueDescriptionStability
receivereceiveExperimental
transmittransmitExperimental

Metric: k8s.node.uptime

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.node.uptimeGaugesThe time the Node has been running [1]Experimental

[1]: Instrumentations SHOULD use a gauge with type double and measure uptime in seconds as a floating point number with the highest precision available. The actual accuracy would depend on the instrumentation and operating system.

Metric: k8s.node.cpu.time

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.node.cpu.timeCountersTotal CPU time consumed [1]Experimental

[1]: Total CPU time consumed by the specific Node on all available CPU cores

Metric: k8s.node.cpu.usage

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.node.cpu.usageGauge{cpu}Node’s CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs [1]Experimental

[1]: CPU usage of the specific Node on all available CPU cores, averaged over the sample window

Metric: k8s.node.memory.usage

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.node.memory.usageGaugeByMemory usage of the Node [1]Experimental

[1]: Total memory usage of the Node

Metric: k8s.node.network.io

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.node.network.ioCounterByNetwork bytes for the NodeExperimental
AttributeTypeDescriptionExamplesRequirement LevelStability
network.interface.namestringThe network interface name.lo; eth0RecommendedExperimental
network.io.directionstringThe network IO operation direction.transmitRecommendedExperimental

network.io.direction 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.

ValueDescriptionStability
receivereceiveExperimental
transmittransmitExperimental

Metric: k8s.node.network.errors

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
k8s.node.network.errorsCounter{error}Node network errorsExperimental
AttributeTypeDescriptionExamplesRequirement LevelStability
network.interface.namestringThe network interface name.lo; eth0RecommendedExperimental
network.io.directionstringThe network IO operation direction.transmitRecommendedExperimental

network.io.direction 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.

ValueDescriptionStability
receivereceiveExperimental
transmittransmitExperimental