Repository navigation
feat(observability): profile dedicated batch worker stages - #23514
Merged
Merged
Conversation
… 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
…ckets 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
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. |
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
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/metricsregistry. 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_ENABLEDdefaults on forOMI_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. Seebackend/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 documentedbackend/test.shharness 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, includingbatch-two-workers, without a retry.make preflightpassed. These bounded commands ran on m1-mac-studio because all four m5 heavy slots were occupied; each used that host's sharedomi-heavygate, a worktree-owned Python 3.11 environment andnice -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 hitjournal_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, andbackend/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