Commit graph

6 commits

Author SHA1 Message Date
d713c25fa5
Rename repo from forgejo-runner-resource-collector
All checks were successful
ci / build (push) Successful in 26s
ci / goreleaser (push) Successful in 23s
2026-02-12 09:55:04 +01:00
90c89583a0
Ignore data with no delta (first datapoint or underflow)
All checks were successful
ci / build (push) Successful in 28s
2026-02-09 17:37:53 +01:00
0af8c28bc2
fix(aggregator): prevent CPU cores overflow when processes restart
All checks were successful
ci / build (push) Successful in 28s
Guard against unsigned integer underflow in cgroup CPU calculation.
When processes exit and new ones start, totalTicks can be less than
the previous value, causing the subtraction to wrap around to a huge
positive number.

Now checks totalTicks >= prev before calculating delta, treating
process churn as 0 CPU usage for that sample.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 15:15:30 +01:00
5e470c33a5
feat(collector): group CPU and memory metrics by cgroup
All checks were successful
ci / build (push) Successful in 30s
Add cgroup-based process grouping to the resource collector. Processes are
grouped by their cgroup path, with container names resolved via configurable
process-to-container mapping.

New features:
- Read cgroup info from /proc/[pid]/cgroup (supports v1 and v2)
- Parse K8s resource notation (500m, 1Gi, etc.) for CPU/memory limits
- Group metrics by container using CGROUP_PROCESS_MAP env var
- Calculate usage percentages against limits from CGROUP_LIMITS env var
- Output cgroup metrics with CPU cores used, memory RSS, and percentages

Environment variables:
- CGROUP_PROCESS_MAP: Map process names to container names for discovery
- CGROUP_LIMITS: Define CPU/memory limits per container in K8s notation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 14:50:36 +01:00
ddaf5fbd0f
chore: update module path to DevFW-CICD org
Some checks failed
ci / goreleaser (push) Failing after 1s
Rename module from edp.buildth.ing/DevFW/forgejo-runner-resource-collector
to edp.buildth.ing/DevFW-CICD/forgejo-runner-resource-collector
2026-02-04 14:25:50 +01:00
219d26959f
feat: add resource collector for Forgejo runners
Add Go application that collects CPU and RAM metrics from /proc filesystem:
- Parse /proc/[pid]/stat for CPU usage (user/system time)
- Parse /proc/[pid]/status for memory usage (RSS, VmSize, etc.)
- Aggregate metrics across all processes
- Output via structured logging (JSON/text)
- Continuous collection with configurable interval

Designed for monitoring pipeline runner resource utilization to enable
dynamic runner sizing.
2026-02-04 14:13:24 +01:00