Repository navigation
metrics: cut pre-created bucket and label products on the churn-heavy emitters - #23039
Merged
Git-on-my-level merged 1 commit intoOct 21, 2026
Conversation
… emitters Prod in-cluster Prometheus held 2.27M head series on 2026-10-21 against ~200k live in the top families: every pod and Cloud Run instance replacement re-creates each emitter's full pre-built product (121 distinct listen pods and ~1,500 bridge instances per 6h), so a bucket or label is a standing head cost, not a one-time one. Names and label sets are unchanged; only the products shrink. - omi_journey_latency_seconds: 15 -> 10 finite buckets (0.5..21600s); 192 -> 132 series per emitter (-31%). The 3x4 journey/outcome pre-create stays. Only p50/p95 quantile panels read this histogram; no rule reads an explicit le= boundary. - CONVERSATION_DURATION_BUCKETS: 18 -> 11 finite buckets, keeping 10 and 15 (omi_conversation_shape contract log) and 120 (Core Features long-conversation share, le="120.0"); 114 -> 72 series per emitter for duration and for speech seconds each (-37%). - omi_sync_phase_duration_seconds 10 -> 7 and omi_sync_phase_calls_per_job 10 -> 6 finite buckets, keeping the le=0/le=1 pair that isolates zero-call attempts; 130 -> 100 series per backend-sync instance (-23%), on both the custom-metric write and the GMP sidecar export. - omi_fallback_total: the import-time zero baseline drops the transcript-outcome tokens text/no_text (never fallback reasons): 48 fewer series per emitter. The rest of the ~984-series matrix stays deliberately -- increase() cannot observe a one-off burst on a lazily created counter, and the retired-provider and capacity_full-by-to_mode alerts select across the whole from x to x reason product -- and the docstring now says so. tests/unit/test_metrics_cardinality_contract.py pins the four budgets and asserts the baseline still covers the alert matrix while excluding the transcript tokens. Measured on prod before the change: journey 31.3k live -> 322k distinct series per 6h; conversation 18.6k -> 191k; sync phase 13.6k -> 136k. Estimated head after: -190k (journey -100k, conversation -91k) on top of the exporter pin PR. Failure-Class: FC-alert-never-provably-fired
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
Companion to the exporter-pin PR. The four churn-heaviest families pre-create their full label × bucket product at import, and every listen/pusher pod and Cloud Run instance replacement re-creates it (121 distinct listen pods and ~1,500 bridge instances per 6h on 2026-10-21, against 2.27M head series for ~200k live). This trims the products without changing metric names or label sets.
Changes
omi_journey_latency_secondsomi_conversation_duration_seconds,omi_conversation_speech_secondsomi_conversation_shapecontract log) and 120 (Core Features long-conversation share,le="120.0")omi_sync_phase_duration_seconds,omi_sync_phase_calls_per_joble=0/le=1pair that isolates zero-call attemptsomi_fallback_totaltext/no_text(transcript-outcome tokens, never fallback reasons)New
tests/unit/test_metrics_cardinality_contract.pypins the four budgets and asserts the fallback baseline still covers the alert matrix while excluding the transcript tokens.test_conversation_shape.py(le=10/15/120),test_modulate_capacity_failover.py(zero-baseline contract),test_sync_phase_metrics.py,test_journey_observability.pyandtest_monitoring_telemetry_contract.pypass unchanged.Why the fallback matrix mostly stays
increase()cannot observe a one-off burst on a lazily created counter: its first sample already holds the burst and the flat tail reads as 0. The retired-provider alert (component=~"stt_selection|stt_live_session", to_mode!="unavailable"byto_mode, 6h window), the capacity_full-by-to_mode alert and the chain-exhaustion ratio select across the whole from × to × reason product, so each of those series needs a zero baseline on every pod — the exact classtest_exhausted_children_have_a_zero_baseline_before_the_first_burstguards. Shrinking it further means shrinking the reason vocabulary or moving that alert onto a pre-aggregated per-to_modecounter (follow-up; would remove ~540 of the ~984 per emitter).Bucket boundaries checked
No alert, recording rule or dashboard reads an explicit
le=on the journey or sync-phase histograms; the only explicit read anywhere isomi_conversation_duration_seconds_bucket{le="120.0"}(kept). All other consumers arehistogram_quantilep10/p50/p90/p95 panels (Core Features, resilience-fallbacks, omi-core-selfheal doc, sync rightsizing runbook on GMP).Before / after (prod, 2026-10-21)
Today, live → distinct series per 6h: journey 31.3k → 322k; conversation 18.6k → 191k; sync phase 13.6k → 136k. Estimated head after this PR: −190k (journey −100k, conversation −91k, fallback −7k). Together with the exporter-pin PR: ~1.7M vs 2.27M today.
Product invariants affected
None. Metric names and label sets are unchanged; only histogram bucket boundaries and the set of pre-created zero-valued
omi_fallback_totalseries change.Rollout
Touches listen (
utils/metrics.pyandutils/observability/fallback.pyship in the listen image, alongside pusher, llm-gateway, backend-api and backend-sync). Deploy off-peak (before 13:00Z or after 22:00Z), carried by the rollout lead. During the rolling restart,sum by (le)quantile panels mix old and new bucket sets for roughly one scrape window per pod and read slightly skewed; nothing is lost once the roll completes.UI-Evidence: none -- metrics emitter change; no user-facing surface.
Failure-Class: FC-alert-never-provably-fired