Repository navigation
Description
Problem or Motivation
Prometheus has no per-container thread series, so nobody can measure the peak thread count of one runner pod. dan-petty/homelab#44 needs that peak to set a per-pod PID limit on the kubelet (pod-max-pids). A guessed limit can kill a runner step. The pids cgroup counts each thread, so the measure is container_threads, not container_processes.
Evidence (https://github.com/dan-petty/homelab/issues/44#issuecomment-6993672688, 2026-11-18):
container_threads,container_processesandcontainer_threads_maxgive no series in the last 30 days. The only process series are per node (node_processes_pids,node_processes_threads).- Cause: Alloy keeps only the 11 cAdvisor metrics of
clusterMetrics.cadvisor.metricsTuning.includeMetricsink8s/monitoring/k8s-monitoring-values.yaml:43. - The kubelet exposes the metrics: the cAdvisor endpoint of a node (
/api/v1/nodes/<node>/proxy/metrics/cadvisor) listscontainer_threads,container_processesandcontainer_threads_max. - homelab copies this file from devops-cli (
make k8s-parity), so the change starts in devops-cli.
Proposed Solution & Architectural Design
- Add
container_threadsto theincludeMetricslist. Considercontainer_threads_maxtoo: it gives the limit that applies to each container. - After the sync, record the number of new series (
count(container_threads)), about one for each container. - After 7 days, give the peak of one runner pod to homelab#44, for example
max_over_time(sum by (namespace, pod) (container_threads{namespace="<runner namespace>"})[7d:5m]).
Target Subsystem
Monitoring (k8s/monitoring/).
Existing Tool Considered
The cAdvisor metrics of the kubelet, which Alloy scrapes already. No new tool.
Acceptance Criteria
- After the sync,
container_threadshas series for the runner pods (a PromQL query proves it). - The comment of the item gives the series count, and after 7 days the peak thread count of one runner pod.
Alternatives check of 2026-11-19: in-use.
The repository already uses this tool.
Tool: google/cadvisor (https://github.com/google/cadvisor), NOASSERTION, last activity 2026-11-18, maintained.
Reason: The searches found no other maintained tool with per-container thread counts; the kubelet's cAdvisor, which the issue names as already scraped by Alloy, exposes container_threads and container_threads_max, so only the includeMetrics filter blocks the series.
Covers:
- Per-container thread count series container_threads
- Per-container thread/PID limit via container_threads_max
- Metrics served on the kubelet cAdvisor endpoint
Lacks:
- Series are dropped unless Alloy includeMetrics lists them
- No peak-over-time; needs PromQL max_over_time
- No per-thread or per-process detail beyond counts
Proposed design
Problem statement
Prometheus has no per-container thread series. Alloy keeps only the 11 cAdvisor metrics that clusterMetrics.cadvisor.metricsTuning.includeMetrics lists in k8s/monitoring/k8s-monitoring-values.yaml:43. homelab#44 needs the peak thread count of one runner pod to set pod-max-pids. The pids cgroup counts each thread. The change adds container_threads and container_threads_max to that list. homelab copies the file from devops-cli with make k8s-parity, so the change starts here.
Acceptance criteria
Requirement: cAdvisor thread metrics are kept
The cAdvisor metricsTuning.includeMetrics list in k8s/monitoring/k8s-monitoring-values.yaml SHALL include container_threads and container_threads_max.
Scenario: k8s manifest check
- WHEN
uv run devops ci --check --only k8sruns on the branch - THEN the command reports success with no error
Existing Tool Considered
google/cadvisor (https://github.com/google/cadvisor), verdict in-use. The alternatives check of 2026-11-19 in the issue body gives the reason and lists what the tool covers and lacks. The proposal answers the lack that blocks the series: it adds container_threads and container_threads_max to the cAdvisor includeMetrics list, so Alloy keeps their series. No new tool is needed.
Key questions
- Does an open, maintained tool cover the per-container thread count?: Yes. google/cadvisor is already in use. The alternatives check of 2026-11-19 in the issue body gives the verdict in-use. Alloy already scrapes the kubelet cAdvisor endpoint. [sources: k8s/monitoring/k8s-monitoring-values.yaml:43]
- Which cAdvisor metrics does the change add to the includeMetrics list?: Add
container_threadsandcontainer_threads_maxto the cAdvisorincludeMetricslist atk8s/monitoring/k8s-monitoring-values.yaml:43. (best practice) [sources: k8s/monitoring/k8s-monitoring-values.yaml:43]- Chosen: Both container_threads and container_threads_max. The pod-max-pids decision needs the observed peak and the current per-container limit. The alternatives check covers both. Each adds one series per container.
- Rejected: Only container_threads. It gives the observed peak but not the current per-container limit that the pod-max-pids decision needs.
- Rejected: Only container_threads_max. It gives the limit but not the observed thread count that the issue needs.
- Which file and list hold the cAdvisor includeMetrics filter?:
k8s/monitoring/k8s-monitoring-values.yaml:43holds the cAdvisorincludeMetricslist. Line 60 holds the KSM list. The change does not touch the KSM list. [sources: k8s/monitoring/k8s-monitoring-values.yaml:43, k8s/monitoring/k8s-monitoring-values.yaml:60] - How is the manifest change proven offline, and where does the 7-day peak go?:
uv run devops ci --check --only k8svalidates the k8s tree. The series count and the 7-day peak wait on the homelab sync and a 7-day window. They are deferred to a new issue. (best practice) [sources: k8s/monitoring/k8s-monitoring-values.yaml:43]- Chosen: k8s check plus a deferred measurement. The manifest change needs no cluster. The measurement waits on an outside sync and a date, so it cannot gate this pull request.
- Rejected: Live PromQL check in this pull request. It waits on the homelab sync and a 7-day window, which are outside this repository.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 18, 2026
Both use Prometheus data to set container limits, but 4992 runs KRR to size memory and CPU, while the candidate enables the container_threads metric series so a PID limit can be set.devops-cli-service commentedon Nov 19, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (4)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 19, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
dan-petty commentedon Nov 22, 2026
After the merge of #6711 and the sync (2026-11-22 01:20 UTC):
count(container_threads)gives 329 series, as expected, and the runner pods have series. The 7 days of data for #6392 start now, so its peak query can run on 2026-11-29 (the query in the comment on #6392).devops-cli-service commentedon Nov 22, 2026
Released in v0.191.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.191.0
devops-cli-service commentedon Nov 22, 2026
Live since 2026-11-22 01:30 UTC