Semantic conventions for CPU metrics

Status: Experimental

This document describes instruments and attributes for common CPU level metrics in OpenTelemetry.

CPU Metrics

Metric: cpu.time

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
cpu.timeCountersSeconds each logical CPU spent on each modeDevelopment
AttributeTypeDescriptionExamplesRequirement LevelStability
cpu.logical_numberintThe logical CPU number [0..n-1]1RecommendedDevelopment
cpu.modestringThe mode of the CPU [1]user; systemRecommendedDevelopment

[1] cpu.mode: Following states SHOULD be used: user, system, nice, idle, iowait, interrupt, steal


cpu.mode 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
idleidleDevelopment
interruptinterruptDevelopment
iowaitiowaitDevelopment
kernelkernelDevelopment
niceniceDevelopment
stealstealDevelopment
systemsystemDevelopment
useruserDevelopment

Metric: cpu.utilization

This metric is opt-in.

NameInstrument TypeUnit (UCUM)DescriptionStability
cpu.utilizationGauge1For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time.Development
AttributeTypeDescriptionExamplesRequirement LevelStability
cpu.logical_numberintThe logical CPU number [0..n-1]1RecommendedDevelopment
cpu.modestringThe mode of the CPU [1]user; systemRecommendedDevelopment

[1] cpu.mode: Following modes SHOULD be used: user, system, nice, idle, iowait, interrupt, steal


cpu.mode 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
idleidleDevelopment
interruptinterruptDevelopment
iowaitiowaitDevelopment
kernelkernelDevelopment
niceniceDevelopment
stealstealDevelopment
systemsystemDevelopment
useruserDevelopment

Metric: cpu.frequency

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStability
cpu.frequencyGaugeHzOperating frequency of the logical CPU in Hertz.Development
AttributeTypeDescriptionExamplesRequirement LevelStability
cpu.logical_numberintThe logical CPU number [0..n-1]1RecommendedDevelopment