refactor: Rename from optimiser to sizer
All checks were successful
ci / ci (push) Successful in 1m48s

This commit is contained in:
Patrick Sy 2026-02-17 17:25:08 +01:00
parent e38c99acd6
commit 479c13f596
Signed by: Patrick.Sy
GPG key ID: DDDC8EC51823195E
25 changed files with 39 additions and 39 deletions

View file

@ -35,7 +35,7 @@ jobs:
run: |
REGISTRY="${{ forgejo.server_url }}"
echo "registry=${REGISTRY#https://}" >> "$GITHUB_OUTPUT"
ORG="${{ forgejo.repository_owner }}"
ORG="${{ github.repository_owner }}"
echo "org=$(echo "$ORG" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
id: sanitize_credentials

View file

@ -1,6 +1,6 @@
version: 2
project_name: optimiser
project_name: sizer
gitea_urls:
api: "{{ .Env.GITHUB_SERVER_URL }}/api/v1"
@ -53,7 +53,7 @@ dockers_v2:
ids:
- collector
images:
- "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_ORG }}/forgejo-runner-optimiser-collector"
- "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_ORG }}/forgejo-runner-sizer-collector"
tags:
- "{{ .Version }}"
- latest
@ -64,7 +64,7 @@ dockers_v2:
ids:
- receiver
images:
- "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_ORG }}/forgejo-runner-optimiser-receiver"
- "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_ORG }}/forgejo-runner-sizer-receiver"
tags:
- "{{ .Version }}"
- latest

View file

@ -28,7 +28,7 @@ make install-hooks # Install pre-commit and commit-msg hooks
## Architecture Overview
A resource optimiser for CI/CD environments with shared PID namespaces. It consists of two binaries — a **collector** and a **receiver** (which includes the **sizer**):
A resource sizer for CI/CD environments with shared PID namespaces. It consists of two binaries — a **collector** and a **receiver** (which includes the **sizer**):
### Collector (`cmd/collector`)
Runs alongside CI workloads, periodically reads `/proc` filesystem, and pushes a summary to the receiver on shutdown (SIGINT/SIGTERM).

View file

@ -10,7 +10,7 @@ COPY . .
# Collector build (no CGO needed)
FROM builder-base AS builder-collector
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /optimiser ./cmd/collector
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /sizer ./cmd/collector
# Receiver build
FROM builder-base AS builder-receiver
@ -20,9 +20,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /metrics-receiver ./cm
# Collector image
FROM alpine:3.19 AS collector
COPY --from=builder-collector /optimiser /usr/local/bin/optimiser
COPY --from=builder-collector /sizer /usr/local/bin/sizer
ENTRYPOINT ["/usr/local/bin/optimiser"]
ENTRYPOINT ["/usr/local/bin/sizer"]
# Receiver image
FROM alpine:3.19 AS receiver

View file

@ -1,7 +1,7 @@
# ABOUTME: Makefile for forgejo-runner-optimiser project.
# ABOUTME: Makefile for forgejo-runner-sizer project.
# ABOUTME: Provides targets for building, formatting, linting, and testing.
BINARY_NAME := optimiser
BINARY_NAME := sizer
CMD_PATH := ./cmd/collector
GO := go
GOLANGCI_LINT := $(GO) run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.2

View file

@ -1,6 +1,6 @@
# Forgejo Runner Optimiser
# Forgejo Runner Sizer
A resource optimiser for CI/CD workloads in shared PID namespace environments. The **collector** reads `/proc` to gather CPU and memory metrics grouped by container/cgroup, and pushes run summaries to the **receiver**. The receiver stores metrics and exposes a **sizer** API that computes right-sized Kubernetes resource requests and limits from historical data.
A resource sizer for CI/CD workloads in shared PID namespace environments. The **collector** reads `/proc` to gather CPU and memory metrics grouped by container/cgroup, and pushes run summaries to the **receiver**. The receiver stores metrics and exposes a **sizer** API that computes right-sized Kubernetes resource requests and limits from historical data.
## Architecture

View file

@ -10,9 +10,9 @@ import (
"syscall"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/collector"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/output"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/collector"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/output"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
const (

View file

@ -11,7 +11,7 @@ import (
"syscall"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/receiver"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/receiver"
)
const (

2
go.mod
View file

@ -1,4 +1,4 @@
module edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser
module edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer
go 1.25.6

View file

@ -6,9 +6,9 @@ import (
"log/slog"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/metrics"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/output"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/metrics"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/output"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
// Config holds the collector configuration

View file

@ -10,8 +10,8 @@ import (
"testing"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/output"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/output"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
func TestCollector_EmitsSummaryOnShutdown(t *testing.T) {

View file

@ -14,8 +14,8 @@ import (
"testing"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/receiver"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/receiver"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
const (

View file

@ -4,8 +4,8 @@ import (
"sort"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/cgroup"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/proc"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/cgroup"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/proc"
)
// Aggregator collects and aggregates metrics from processes

View file

@ -6,7 +6,7 @@ import (
"log/slog"
"os"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/metrics"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/metrics"
)
// LogFormat specifies the log output format

View file

@ -1,6 +1,6 @@
package output
import "edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/metrics"
import "edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/metrics"
// Writer defines the interface for outputting metrics
// This allows for different implementations (logging, HTTP push, etc.)

View file

@ -11,7 +11,7 @@ import (
"strings"
"testing"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
func TestHandler_ReceiveMetrics(t *testing.T) {

View file

@ -8,7 +8,7 @@ import (
"math"
"sort"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
// ResourceSize holds Kubernetes-formatted resource values

View file

@ -6,7 +6,7 @@ import (
"net/http/httptest"
"testing"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
func TestFormatMemoryK8s(t *testing.T) {

View file

@ -6,7 +6,7 @@ import (
"testing"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
)
func TestNewStore(t *testing.T) {

View file

@ -2,7 +2,7 @@
// ABOUTME: Defines MetricsPayload combining execution metadata with run summary.
package receiver
import "edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/summary"
import "edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/summary"
// ExecutionContext holds GitHub Actions style identifiers for a workflow run
type ExecutionContext struct {

View file

@ -7,7 +7,7 @@ import (
"sort"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/metrics"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/metrics"
)
// containerAccumulator tracks metrics for a single container

View file

@ -6,7 +6,7 @@ import (
"testing"
"time"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-optimiser/internal/metrics"
"edp.buildth.ing/DevFW-CICD/forgejo-runner-sizer/internal/metrics"
)
func TestAccumulator_NoSamples(t *testing.T) {

View file

@ -113,7 +113,7 @@ services:
# Cgroup configuration
# stress-ng-cpu is the worker process name for CPU stress
# stress-ng-vm is the worker process name for memory stress
CGROUP_PROCESS_MAP: '{"stress-ng-cpu":"cpu-stress","stress-ng-vm":"mem-stress","dd":"io-stress","resource-collec":"collector"}'
CGROUP_PROCESS_MAP: '{"stress-ng-cpu":"cpu-stress","stress-ng-vm":"mem-stress","dd":"io-stress","sizer":"collector"}'
CGROUP_LIMITS: '{"cpu-stress":{"cpu":"1","memory":"128Mi"},"mem-stress":{"cpu":"500m","memory":"256Mi"},"io-stress":{"cpu":"500m","memory":"128Mi"},"collector":{"cpu":"200m","memory":"64Mi"}}'
deploy:
resources:

View file

@ -68,7 +68,7 @@ services:
environment:
# Map unique process names to container names
# 'cat' runs only in runner, 'sleep' runs only in sidecar
CGROUP_PROCESS_MAP: '{"cat":"runner","sleep":"sidecar","resource-collec":"collector"}'
CGROUP_PROCESS_MAP: '{"cat":"runner","sleep":"sidecar","sizer":"collector"}'
CGROUP_LIMITS: '{"runner":{"cpu":"500m","memory":"256Mi"},"sidecar":{"cpu":"100m","memory":"128Mi"},"collector":{"cpu":"100m","memory":"64Mi"}}'
deploy:
resources:

View file

@ -55,7 +55,7 @@ spec:
# Resource collector sidecar
- name: collector
image: ghcr.io/your-org/forgejo-runner-optimiser:latest # Replace with your image
image: ghcr.io/your-org/forgejo-runner-sizer:latest
args:
- --interval=5s
- --top=3
@ -121,7 +121,7 @@ spec:
# Collector
- name: collector
image: ghcr.io/your-org/forgejo-runner-optimiser:latest # Replace with your image
image: ghcr.io/your-org/forgejo-runner-sizer:latest
args:
- --interval=2s
- --top=5