* Support CPU request override for containerized deployments
Media processing pods intentionally omit CPU limits to avoid CFS throttling on real-time media workloads. Without a limit, NumCPU() falls back to runtime.NumCPU() which returns the full node CPU count. This could inflate the admission budget — on a 64-core node with a 15-CPU request, the monitor thinks it has 64 CPUs available and accepts too many jobs. Goruntime GOMAXPROC env variable will also be set to too high value which could affect go runtime goroutine scheduling (frequent context switches).
CPU requests are a scheduler-level concept with no cgroup representation, so cgroup-based approaches (automaxprocs, Go 1.25 container awareness) can't help. The Kubernetes Downward API can expose requests.cpu as an env var, which this change reads.
EffectiveCPURequest() in cpu.go reads the env var once at startup and NumCPU() returns it when set, falling back to platform detection otherwise — monitorProcesses picks this up automatically. A new maxprocs package caps GOMAXPROCS down to ceil(request) via init(), never increasing it beyond the current value so explicit settings and cgroup quotas are respected.
* Adjust memory usage for inactive file.
Inactive file can be reclaimed if necessary. But, croup
memory.usage_in_bytes shows a high value if the memory has grown and
does not need to be reclaimed. So, using that inflates the actual memory
usage.
Adjust usage by discounting reclaimable inactive file memory.
* generated protobuf
* clean up
* fix stupid mistakes, thank you @milos-lk
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Use cgroup for memory stats.
This is not going to work well when limit is not set.
It falls back to go-osstat if limits are not set.
* generated protobuf
* fall back to osstat
* generated protobuf
* maxVal
* generated protobuf
* Create pretty-gifts-look.md
* static check
* generated protobuf
* static check
* generated protobuf
* static check
* generated protobuf
* static check
* generated protobuf
* comment
* generated protobuf
* leading slash
* use physical memory
* static check
* typo, thanks DZ
* generated protobuf
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>