Skip to content

feat(observability): profile dedicated batch worker stages - #23514

Merged
Git-on-my-level merged 6 commits into
mainfrom
lane/bprof
Oct 24, 2026
Merged

Git-on-my-level merged 6 commits into
mainfrom
lane/bprof

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

The dedicated batch worker exposes no stage breakdown, so low GPU utilization cannot identify its throughput limit. Add content-free omi_batch_pipeline_stage_seconds{stage} wall-time histograms on the worker's private /metrics registry. This adopts the timer design from stalled #22324 against the current pump and model chain.

Measure download metadata, download, decrypt, decode, VAD, window assembly, batched STT/recovery, serial/packed diarization, speaker embedding, encrypt/upload/artifact registration, CUDA quiescence and lease bookkeeping/merge/projection. IO timers run on the IO thread. Static labels contain no IDs, content, URIs or exceptions. Failed calls are observed; timing failures preserve work and original errors. No new CUDA synchronization, precision, model, scheduling, result or deploy change.

BATCH_PIPELINE_STAGE_PROFILING_ENABLED defaults on for OMI_ENV_STAGE=dev, off for prod/unset; explicit true/false overrides at startup. Rollback: set false and restart the worker. This is an observability flag, with no withheld product fix or production flag flip. Parent/child and concurrent timers overlap. Batched p50/p95 describe calls; summed time divided by leased events gives amortized seconds/lease, not per-lease percentiles. See backend/docs/batch-pipeline-worker.md.

The paired public-audio dev L4 experiment is separate from this metrics-only PR. It found embedding dominates and rejected FP16 speaker embeddings for label regression. No candidate optimization or production rollout is included here.

Validation

At 8c67db8c3757, the documented backend/test.sh harness passed 1,143 tests across 25 files (five skipped, one deselected), including real artifact encryption, failed decryption, thread isolation, model-hook restoration, packed embeddings, retained-source decoding, pump and runtime export. The full batch Sync Cloud Tasks Firestore/Redis emulator family passed, including batch-two-workers, without a retry. make preflight passed. These bounded commands ran on m1-mac-studio because all four m5 heavy slots were occupied; each used that host's shared omi-heavy gate, a worktree-owned Python 3.11 environment and nice -n 19.

The final dev L4 profiler smoke passed at 8c67db8c3757: flag explicitly unset, dev default on, same public corpus and actual worker/model chain, 26 unique commits. Its private registry exported populated download/decrypt/decode/VAD/ASR/diarization/embedding/encrypt/upload and lease/pump histograms. Two warmup units explain 28 leaf samples and 27 non-silent diarization samples. The task-owned pod was removed after copying receipts; peak dev cluster allocation was three L4s, under the cap of four. Independent read-only Luna review and terminal CI are required before merge. GPU performance experiments are diagnostic; they do not establish production Firestore/projection throughput or broad WER/DER acceptance.

Scope

No .github/, Helm, HPA, deployment, IAM, user-data or production configuration changes. No production deployment is authorized by this PR. The rollout lead owns adoption.

Review and current CI

Independent read-only Luna full-diff review at exact head 8c67db8c375777331116916911cb1b89f3eb9a5f: SHIP, no findings. The initial agentctl collection hit journal_busy; retrying the identical request recovered the verdict without another counted review round.

Merge is held: backend CI run 40105415129 fails before unit tests on five pyright errors introduced by newer main in backend/utils/retrieval/tools/omi_tools.py:64, result_bounds.py:40,65,67, and backend/utils/wrapped/generate_2025.py:102. None is in this PR's diff. The tested profiler source has zero type errors; the synthetic merge contains these main changes. The rollout lead has the exact errors for main repair. Stack gauntlet, hermetic backend E2E and source-closure CI passed. No checks were bypassed or blindly rerun.

Failure-Class: none

… dev-default flag

Add metrics-only per-stage wall-clock histograms for the dedicated batch GPU
worker, adopting the instrumentation design of stalled PR #22324 (StageTimings
context manager, static stage labels, omi_batch_pipeline_stage_seconds) without
its HPA/scrape changes.

Pump stages: pump_cycle, maintenance, pull, admission, renew, publication,
ordered_merge, projection, worker_flight. Worker-chain leaves: fetch_decode,
vad, windows, asr, asr_recovery, flight_segment, flight_diarize, diarize,
persist, cuda_sync. Timings include executor wait and failed calls; prefetched
decode and submitted persist are observed on the background IO threads where
they run; optional or skipped stages emit no samples; telemetry failures are
swallowed and never invalidate compute or durable transitions.

BATCH_PIPELINE_STAGE_PROFILING_ENABLED gates histogram creation once at worker
startup: default on only for OMI_ENV_STAGE=dev, prod/unset off, explicit
true/false override (local/offline opt in). The histogram registers on the
dedicated worker's explicit CollectorRegistry (/metrics). No runtime behavior,
precision or concurrency change; cuda_sync times the pre-existing synchronize,
profiling adds no new GPU synchronization. Speaker embedding stays inside the
pyannote adapter seams (diarize / flight_diarize) and is documented as not
separately timed.

Failure-Class: none
…age timings

Observe authenticated download, decrypt, decode, encryption and upload on the
worker's actual IO thread, plus serial and packed pyannote embedding forwards.
Keep labels static and telemetry failures isolated from compute and custody.

Failure-Class: none
Include generation-pinned retained downloads, framed decryption and codec
decoding in the dedicated worker's scoped leaf timers. Non-worker callers
remain unprofiled; ownership, validation and source bytes are unchanged.

Failure-Class: none
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T18:22:22.036516Z b73446e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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
Git-on-my-level merged commit 2a1c059 into main Oct 24, 2026
57 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/bprof branch October 24, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant