prometheus / prometheus/node_exporter
Add per-process schedstat metrics collector
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13.8k
- Forks
- 2.7k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 8
Description
Feature Request
Currently, the schedstat collector only exports system-wide per-CPU metrics from /proc/schedstat.
However, /proc/[pid]/schedstat exposes per-process scheduler statistics:
- Running time in nanoseconds
- Waiting time in nanoseconds
- Number of timeslices
The procfs library already has ProcSchedstat struct that parses this file, so no new parsing code is needed.
Proposal
Add an opt-in per-process schedstat collector (defaultDisabled, similar to the existing processes collector) that exports:
- node_schedstat_process_running_seconds_total{pid, comm}
- node_schedstat_process_waiting_seconds_total{pid, comm}
- node_schedstat_process_timeslices_total{pid, comm}
Implementation
Would follow the same pattern as collector/processes_linux.go — iterate AllProcs(), call pid.Schedstat() per process, export metrics labeled with pid and comm.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with collector/processes_linux.go and the procfs ProcSchedstat struct, then trace how AllProcs() and per-process Schedstat() are used. Implement the opt-in, default-disabled collector and verify that it exports running time, waiting time, and timeslices with pid and comm labels in the specified metric names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100