Repository navigation
perf(observability): cut routine log volume (listen access records, sync per-segment INFO, queue + gateway sampling) - #23676
Merged
Merged
Conversation
…ync per-segment INFO, queue + gateway log sampling) - main.py: access_policy='platform' stops backend-listen's per-request uvicorn access records (~21M INFO lines/day, ~23 GiB/day billed, duplicates the fronting LB records); Cloud Run behavior unchanged - sync pipeline/router/sequencer: demote per-segment/per-file/per-dispatch success lifecycle lines to DEBUG; per-job summary, WARNING+ and two-lane triage outcomes stay INFO; metrics unaffected - ops/prod.yaml: sync-jobs-fresh + sync-backfill-fresh log_sampling_ratio 0.1 - loki prod values: gateway verboseLogging false (4xx/5xx still log) - runbook: record the listen access-policy supersession with the cost basis
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. |
…aging ops file test_staging_mirrors_prod_except_names pins staging/prod queue-field parity; the staging twins of sync-jobs-fresh and sync-backfill-fresh still carried 1.0.
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.
What changed and why
Logging-cost tail (margin-50 N7): four routine-noise cuts with no metric, alert,
or dashboard consumers. Measured 7d (10-19..10-25, ro-prod, billing +
logging.googleapis.com/byte_count): Log Storage $38.8/day, and two log stormsin four days (10-22 backend-sync 50 GiB; 10-25 sync+backfill 99 GiB, $66 that
day).
main.py):access_policy='platform'isalready the effective policy on Cloud Run; on this entrypoint's only GKE
deployment (backend-listen) it stops the per-request uvicorn access records
that grew 2.8M → 21-26M INFO lines/day on 10-23 (now the fleet's largest
single stdout source, ~23 GiB/day ≈ $310/mo) and duplicate the fronting LB's
request records. Supersedes the runbook's "keep general access records for
listen until route coverage is proven" (2026-10-26, at ~8× the volume that
ruling was made at); WARNING+ app records and VADGate lines are unaffected.
llm-gateway and diarizer-batch keep their access records.
per-file
sync_vadsuccess andaudio_merge: built artifact, per-dispatchoutcome=enqueued,sync_assignment outcome=superseded, retryoutcome=deduplicated): rates stay observable viaomi_sync_transcription_*/omi_sync_dispatch_*metrics; the per-jobstatus=finalizedsummary and all WARNING+ / error-outcome lines stay INFO;per-job terminal outcomes (
outcome=skipped|superseded|reconciled,deferrals) stay INFO for two-lane triage. None of the 26 logs-based metrics,
the sentinel phrase filters (
sync_lane_admission,sync_reprocess+outcome=error), or the vad-streaming sink matches a demoted phrase.log_sampling_ratio1.0 → 0.1 onsync-jobs-freshandsync-backfill-fresh(2.8 GiB/day oftask_operations_log): queuedepth/age alerting uses platform metrics; no logs-based metric reads
task-op logs.
verboseLogging: false(1.9 GiB/day of nginx access linesbilled at ERROR severity; 4xx/5xx still log).
Expected saving ≈ $550-700/mo at current volumes (listen ~$310, sync stdout
~60-70% of ~$250-350 clean-day baseline + proportional storm shrinkage, queues
~$34, gateway ~$25), plus storm insurance (each storm day currently adds
$35-45).
Product invariants affected
none
How it was verified
logging.googleapis.com/byte_count/log_entry_countby log × service × severity (metrics only, no entries read),billing export daily SKU trend; consumer sweep over the 26 logs-based metric
filters (
gcloud logging metrics list),backend/charts/monitoringalerts/dashboards, sentinel phrase filters in
data/run-2026-10-13-two-lane-nemotron/sentinel/scripts/, and backend tests.BACKEND_UNIT_TEST_FILE_LIST(7 files: sync capture pipeline, omi_logging,audio_merge ×3, uid_sequencer, logging entrypoint guard) — 51 passed.
expected; backend-sync stdout −60-70%;
task_operations_log~2.8 → ~0.3GiB/day; gateway nginx stderr → ~0.
Tests
Log-level and config-value changes only; the one behavior-bearing line
(per-segment outcome level) keeps its existing correlation-ref assertions —
test_sync_capture_pipeline.pycaplog context widened INFO → DEBUG for thesuccess-outcome case. No new tests: no control flow, payload, or metric changes.
UI evidence
UI-Evidence: none -- backend logging/config only, no UI change
Failure class (fixes)
Failure-Class: none
Rollout / kill switch
plan; Loki via the next
prod-omi-lokihelm deploy.main.pypolicy arg (access records return on thenext listen deploy); revert the
logger.debugsites (lines return at INFO);log_sampling_ratio: 1.0inops/prod.yaml(config-train reapplies);verboseLogging: truein the Loki values.alert or dashboard input changes (verified above).