Repository navigation
perf(batch): enable production worker autoscaling - #23891
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Git-on-my-level
added a commit
that referenced
this pull request
Oct 29, 2026
…Prometheus (#24079) ## Why The prometheus-adapter (`prod-omi-prometheus-adapter`) reads the in-cluster Prometheus (`prod-omi-kube-prometheus-stack`), not GMP. The external rules behind the batch worker HPA (#23891) — `omi_batch_pipeline_admissible_ready_units` and `omi_batch_pipeline_ready_age_seconds`, already present in `prod_omi_prometheus_adapter.yaml` — match zero series today because no scrape job selects the `batch-pipeline-worker` pods into that Prometheus; they only feed GMP. Until this lands, the worker HPA cannot scale batch to 100%: the external metrics API returns no values. ## What Adds a `batch-pipeline-worker-metrics` job to `additionalScrapeConfigs`, mirroring the `diarizer-batch-metrics` precedent from #21448 (the 2026-10-14 diarizer-batch cutover): - `scrape_interval: 15s`, `role: pod`, `namespaces: [prod-omi-backend]` - keeps on the `app.kubernetes.io/name: batch-pipeline-worker` label (selects every chart release, not one instance name), the `http` container port (8080 — the same port the chart's GMP PodMonitoring scrapes), and `Running` phase - relabels exactly `namespace` + `pod`: the adapter's freshness joins run `on (namespace, worker_release, pod)`, so the scrape must attach those two; `priority` and `worker_release` ride the metric samples themselves and are left untouched (no `metric_relabel_configs`) Declares the job in `expected-targets.prod.yaml` (mechanism `additionalScrapeConfigs`, `auth: null` — the worker's `/metrics` handler is unauthenticated, namespace `prod-omi-backend`, `coverage_status: declared` with no coverage alert, same class as `diarizer-batch-metrics`) and pins the whole shape in `test_batch_pipeline_chart.py` next to the worker's other scrape contracts. The telemetry contract test enforces values↔inventory bidirectionally, so both sides land together. ## Series this enables (at today's 3 replicas) | family | labels | series | | --- | --- | --- | | `omi_batch_pipeline_admissible_ready_units` | priority, worker_release, namespace | 9 (3 pods × 3 priorities) | | `omi_batch_pipeline_capacity_refreshed_at_seconds` | worker_release, namespace | 3 | | `omi_batch_pipeline_ready_age_seconds` | priority, worker_release, namespace | 9 | | `omi_batch_pipeline_metrics_refreshed_at_seconds` | worker_release, namespace | 3 | ## Risk - **Cardinality:** the four adapter-consumed families add 24 series at 3 pods. The job scrapes the worker's full `/metrics` exposition (as the diarizer job does for its pods), bounded by the runtime's registry — an O(100) series addition against the 2.25M-series head, ingested locally by both Prometheus replicas, no Cloud Monitoring reads. Negligible. - **No behavioral change until applied:** this only edits repo values. The rollout lead applies the stack with the pinned-chart runbook (helm upgrade `prod-omi-kube-prometheus-stack`, chart 75.15.1, per the monitoring README) in the same window as the prometheus-adapter apply that carries the HPA rules. No `.github/` changes, no flag flip, no IAM change, no data mutation. - **Target growth is bounded:** targets exist only while worker pods run (today 3; #23891's maxReplicas 16 bounds the ceiling). ## Test plan - Local backend unit shard (BACKEND_UNIT_TEST_FILE_LIST) green: 86 passed across `test_batch_pipeline_chart.py` (new pin), `test_monitoring_telemetry_contract.py` (inventory bidirectional + declared-gap rules), `test_diarizer_batch_prereqs.py` (neighbor job unaffected). - CI backend unit shard covers the same three files. Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24079?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24079?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24079&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
MichaelC001
pushed a commit
to MichaelC001/omi
that referenced
this pull request
Oct 30, 2026
…Prometheus The prometheus-adapter reads the in-cluster Prometheus, not GMP, so the omi_batch_pipeline_* external rules behind the worker HPA (BasedHardware#23891) matched zero series: nothing scraped the batch-pipeline-worker pods into that Prometheus. Add a batch-pipeline-worker-metrics additionalScrapeConfigs job mirroring diarizer-batch-metrics (BasedHardware#21448): 15s, role pod, prod-omi-backend, keep on the app.kubernetes.io/name label, the http port and Running phase, relabel exactly namespace+pod so the adapter's per-pod freshness join (namespace, worker_release, pod) resolves; priority and worker_release ride the metric samples. Declare the job in expected-targets.prod.yaml as a declared batch target with no coverage alert, and pin the whole contract in test_batch_pipeline_chart.py alongside the worker's other scrape checks.
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.
Change
Enable the existing production OD-first demand scaler in the batch-pipeline-worker chart values. The already-merged #23860 sets the worker budget to min 3 / max 16; balanced pools remain disabled.
With autoscaling enabled, the chart keeps
spec.replicasin the Deployment manifest and uses Helmlookupto carry forward the live count on upgrades. The first HPA install therefore keeps the existing count instead of allowing the API to default it to 1; later chart upgrades also preserve the HPA's current scale. Fresh installs and offline renders usereplicaCount.25% soak sequence
Existing STOP and rollback guards remain authoritative.
Local validation
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=backend/tests/unit/test_batch_pipeline_chart.py: 39 passed.make preflighton the58a123etree (merge baseebd6553): 35 checks passed.