Skip to content

Sync: aggregate phase timing and request-bound metrics export - #20659

Merged
Git-on-my-level merged 16 commits into
mainfrom
lane/sync-cloudrun-rightsize
Oct 4, 2026
Merged

Git-on-my-level merged 16 commits into
mainfrom
lane/sync-cloudrun-rightsize

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Adds aggregate sync phase timing and calls-per-attempt for decode/VAD, GCS, Parakeet HTTP attempts, speaker ID and Firestore persistence, and a bounded background Cloud Monitoring export path consumed by the existing Prometheus exporter for both sync services.

The exporter runs in one daemon worker with a one-slot, drop-on-overflow queue; app shutdown closes admission and drains/joins the worker with a hard two-second wait cap; requests never await network or ADC work, with fixed lane/phase labels, platform process identity and a kill switch. Sync decisions, queue limits and CPU billing stay unchanged. Review and dev export/scrape acceptance precede any production rollout. No production writes were made.

Validation: blocked-export request completion, export-disabled, queue overflow and worker failure tests, plus phase/monitoring tests (33) and existing sync router tests (285) passed with the normal CPU guard; deployment-state fixture tests, async blocker scanning, runtime manifest validation, type checking and preflight passed. Live acceptance remains for the coordinator's reviewed deploy.

Cost, request-lifetime audit, headroom evidence, acceptance gates and rollback: backend/docs/runbooks/sync-cloudrun-rightsizing.md.

Failure-Class: none

INV-MEM-4: canonical promotion authority is preserved; lifecycle additions only time existing sync persistence.

Line-Count-Exception: backend/routers/sync.py | 2498 -> 2501 | Add bounded observability hooks at existing operations without changing sync decisions.

Line-Count-Exception: backend/utils/other/storage.py | 1981 -> 1987 | Add bounded observability hooks at existing operations without changing sync decisions.

Line-Count-Exception: backend/utils/stt/pre_recorded.py | 1266 -> 1269 | Add bounded observability hooks at existing operations without changing sync decisions.

Line-Count-Exception: backend/utils/sync/pipeline.py | 3021 -> 3028 | Add bounded observability hooks at existing operations without changing sync decisions.

Round 3 shutdown regression coverage: in-flight plus queued export drain and worker join, idle stop, repeated stop, startup/shutdown race, app shutdown handler, and hung export deadlines (including a requested timeout above the two-second cap). backend/.venv/bin/python -m pytest backend/tests/unit/test_sync_phase_metrics.py -q: 15 passed.

Post-main reconciliation validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-20659-r3-test-list.txt bash backend/test.sh selected shutdown/metrics and runtime manifest fixtures: 164 passed with the normal CPU guard. bash backend/scripts/typecheck.sh: zero errors. Async blocker scan: zero findings. PR metadata preflight: all four checks passed.

…ghtsize

# Conflicts:
#	backend/deploy/runtime_env.yaml
#	backend/deploy/runtime_env/dev.overlay.yaml
#	backend/deploy/runtime_env/prod.overlay.yaml
#	backend/tests/unit/test_backend_runtime_env_validator.py
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 4, 2026 20:39
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Git-on-my-level
Git-on-my-level merged commit 93b7ac9 into main Oct 4, 2026
57 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sync-cloudrun-rightsize branch October 4, 2026 20:40
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