prometheus / prometheus/node_exporter

[FEATURE] add processor cstate metrics

Open
#3,497 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.8k
Forks
2.7k
Avg merge
1d 23h
Merged PRs (30d)
8

Description

I recently debugged a machine with high c-state transition counts and latency.
The problem I found was cstate transitions × cstate latency > 1% wall time

There are several highly relevant files that we should probably export, documented as part of cpuidle

root@goa:/sys/devices/system/cpu/cpu0/cpuidle# grep -Hirn '.*' .
./state3/disable:1:0
./state3/above:1:24243157
./state3/time:1:185600277204
./state3/rejected:1:0
./state3/power:1:0
./state3/residency:1:700
./state3/latency:1:350
./state3/usage:1:50200069
./state3/desc:1:ACPI IOPORT 0x415
./state3/below:1:0
./state3/default_status:1:enabled
./state3/name:1:C3
./state3/s2idle/time:1:4745151344
./state3/s2idle/usage:1:52

General metadata

  • disabled
  • symbolic name (C3)
  • description
  • latency (350µs) - transition latency
  • residency (700µs) - target residency

As well as several counters:

  • usage - number of times the cstate was entered
  • time - time in µs spent in this state
  • above - number of times a higher cstate would have been better (we were below the target residency)
  • below - number of times a lower cstate would have been better

So for my laptop ~50% of the time I would have been better off staying in C2. Which has a latency of 18µs.

I would like to see node_exporter being able to export this data. Several interesting metrics and warnings can be derived from this data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to Linux's /sys/devices/system/cpu/cpu0/cpuidle interface and the kernel cpuidle documentation; start by examining how node_exporter currently reads machine metrics. Done means exporting the listed per-state metadata and counters, with appropriate units and state identification, and validating the results against the sample values.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
observability, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.