Repository navigation
feat(actions): size arc-job-report runners from the job's 7-day history - #382
Merged
Merged
Conversation
One run is not safe to size on: cache hits change a job's peak memory a lot (monorepo Typecheck peaks at 1.5 GB in a typical run, 13.1 GB in the worst), so a cached run suggested a runner the next uncached run would be OOM-killed on. The suggestion now reads the job's last 7 days from the arc:job_memory_working_set_bytes:max1m and arc:job_cpu_usage_cores:rate1m recording rules (monta-app/terraform) and treats the two resources differently, since runners have a memory limit but only a CPU request: - memory is a hard floor: 1.3 x the 7-day peak, and an OOM kill always moves up a size; - CPU is a labelled trade-off: "CPU-bound, faster" when the median is at least 85% of the runner's vCPU, and a smaller size must cover the median, marked "trial: may be slower" when the peak would not fit. Smaller sizes need 5 runs in the window, which replaces the 2-minute cut-off. The local path now calls the datasource proxy through gcx api, like CI, because gcx metrics query widens the step to about 100 points. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
JesperTerkelsen
marked this pull request as ready for review
October 13, 2026 15:17
JesperTerkelsen
requested review from
prasad-manu
and removed request for
a team
October 13, 2026 15:17
sudheer-monta
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #381. The runner suggestion is now based on the job's last 7 days of runs, and memory and CPU are treated differently. That's because runners have a memory limit but only a CPU request: too little memory gets the job OOM-killed, while too little CPU only makes it slower.
Why one run isn't enough: cache hits change a job's peak memory a lot. Over 6 hours of monorepo-typescript runs:
The rule (
suggest()injob_resources.py):The suggestion table now shows the reason, the 7-day peak memory, median and peak CPU, and the run count.
Where the history comes from: the
arc:job_memory_working_set_bytes:max1mandarc:job_cpu_usage_cores:rate1mrecording rules in https://github.com/monta-app/terraform/pull/261. The report runs four instant queries per run, all grouped byjob_name, that read only the selected jobs' recorded series. It never joins raw cAdvisor series at read time; doing that over 7 days OOM-killed the mimir-internal query-frontends today.Local path:
job_resources.pynow calls the same Grafana datasource-proxy URL as CI, throughgcx api.gcx metrics querysilently widened the step to fit about 100 points, so long jobs were coarser locally than in CI.Testing
python3 -m unittest discover -s .github/actions/arc-job-report -p 'test_*.py': 12 tests. They cover every branch ofsuggest()(memory floor, OOM, CPU-bound, fits/trial, the 5-run gate, runners outside the catalog), the escaping in the history query, and the new table header and row.job_resources.pyagainst https://github.com/monta-app/monorepo-typescript/actions/runs/38407948093 with no recorded history yet: every job iskeepand nothing errors.The same run's
arc_job_report.py --dry-run, with history stubbed from the 6-hour numbers above:That run caught a name clash with the comment's existing
HISTORYregex, which is fixed, and the render test now checks the header.Gaps
repository+job_name. Two workflows in one repo with the same job name share a history, which can only make the memory floor higher.Testgate job and theTest (shard N)jobs are separate names, so they have separate histories. The table row still shows the shard job as "Test", as before.🤖 Generated with Claude Code