Repository navigation
fix(monitoring): correct Omi Core Features dashboard measurement scopes - #24833
Conversation
Pin journey queries to their emitting jobs and preserve absent denominators as not measured. Failure-Class: new
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6802de202b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "uid": "prometheus" | ||
| }, | ||
| "expr": "sum by (journey) (rate(omi_journey_accepted_total[5m]))", | ||
| "expr": "sum by (journey) ((rate(omi_journey_accepted_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[5m]) or rate(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[5m]) or rate(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[5m])))", |
There was a problem hiding this comment.
Scope finalization acceptances to their admission emitter
For live captures, acceptance is emitted by listen, not pusher: backend/routers/listen/conversations.py:337–343 calls lifecycle_service.request_finalization, which increments record_journey_accepted('capture_finalization') in backend/utils/conversations/lifecycle.py:1086–1087. Pusher executes the handed-off job and emits its terminal outcome. Filtering the acceptance counter to pusher-metrics therefore removes actual live admissions from this graph, while the same selector in panel 5 prevents capture finalization from contributing to “Journeys (of 3)”. Use the admission-emitting job for acceptance selectors rather than applying terminal ownership to both metric families, and update the ownership test accordingly.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
3 issues found across 4 files
Confidence score: 3/5
- In
omi-core-features.json, thecapture_finalizationacceptance panel and trend can attribute admissions to the wrong job;pusher-metricsowns terminal outcomes, not these admissions. Scope them to listen and update the ownership test. - In
test_core_feature_headline_contract.py, the contract can pass with an unscoped metric query because it skips bare references and never requires ajobmatcher. Match bare and braced references, then require an allowed job matcher. - In
omi-core-features.json, thechat_responsebranch still includes Cloud Run sync because both exporters use the same job, and sync pre-creates zero-valued journey children. Add a discriminator that excludes sync from this branch.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/unit/test_core_feature_headline_contract.py">
<violation number="1" location="backend/tests/unit/test_core_feature_headline_contract.py:277">
P2: This contract test can pass unscoped metric queries: it skips bare metric references and never requires the listed `job` label. Match both bare and braced occurrences, then require an allowed job matcher or explicitly exempt aggregate panels.</violation>
</file>
<file name="backend/charts/monitoring/dashboards/general/omi-core-features.json">
<violation number="1" location="backend/charts/monitoring/dashboards/general/omi-core-features.json:1651">
P2: Scope `capture_finalization` acceptance to listen’s emitting job in this panel and the acceptance trend, and update the ownership test; `pusher-metrics` owns the terminal outcomes, not these admissions.</violation>
<violation number="2" location="backend/charts/monitoring/dashboards/general/omi-core-features.json:2017">
P2: `job="cloud-run-application-metrics"` does not exclude Cloud Run sync from the `chat_response` branch: both exporters use this job, and sync processes pre-create zero-valued journey children. The resulting `rate()`/`sum by` graph can render absent chat telemetry as zero; add a verified `service_name` selector for the actual chat emitter (or keep this branch not measured until joint labels are confirmed).</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| for panel in _panels().values(): | ||
| for target in panel.get('targets', []): | ||
| for metric, labels in allowed.items(): | ||
| for selector in re.findall(r'\b' + metric + r'\{([^}]*)\}', target.get('expr', '')): |
There was a problem hiding this comment.
P2: This contract test can pass unscoped metric queries: it skips bare metric references and never requires the listed job label. Match both bare and braced occurrences, then require an allowed job matcher or explicitly exempt aggregate panels.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_core_feature_headline_contract.py, line 277:
<comment>This contract test can pass unscoped metric queries: it skips bare metric references and never requires the listed `job` label. Match both bare and braced occurrences, then require an allowed job matcher or explicitly exempt aggregate panels.</comment>
<file context>
@@ -189,3 +197,101 @@ def test_headline_tiles_name_the_user_result_they_actually_count():
+ for panel in _panels().values():
+ for target in panel.get('targets', []):
+ for metric, labels in allowed.items():
+ for selector in re.findall(r'\b' + metric + r'\{([^}]*)\}', target.get('expr', '')):
+ assert 'journey' not in selector, (panel['id'], metric)
+ for label, _, value in re.findall(r'(\w+)(=~|!~|!=|=)"([^"]*)"', selector):
</file context>
| "uid": "prometheus" | ||
| }, | ||
| "expr": "sum by (journey,outcome) (rate(omi_journey_terminal_total[5m]))", | ||
| "expr": "sum by (journey,outcome) ((rate(omi_journey_terminal_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[5m]) or rate(omi_journey_terminal_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[5m]) or rate(omi_journey_terminal_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[5m])))", |
There was a problem hiding this comment.
P2: job="cloud-run-application-metrics" does not exclude Cloud Run sync from the chat_response branch: both exporters use this job, and sync processes pre-create zero-valued journey children. The resulting rate()/sum by graph can render absent chat telemetry as zero; add a verified service_name selector for the actual chat emitter (or keep this branch not measured until joint labels are confirmed).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/monitoring/dashboards/general/omi-core-features.json, line 2017:
<comment>`job="cloud-run-application-metrics"` does not exclude Cloud Run sync from the `chat_response` branch: both exporters use this job, and sync processes pre-create zero-valued journey children. The resulting `rate()`/`sum by` graph can render absent chat telemetry as zero; add a verified `service_name` selector for the actual chat emitter (or keep this branch not measured until joint labels are confirmed).</comment>
<file context>
@@ -2009,7 +2014,7 @@
"uid": "prometheus"
},
- "expr": "sum by (journey,outcome) (rate(omi_journey_terminal_total[5m]))",
+ "expr": "sum by (journey,outcome) ((rate(omi_journey_terminal_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[5m]) or rate(omi_journey_terminal_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[5m]) or rate(omi_journey_terminal_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[5m])))",
"legendFormat": "{{journey}} · {{outcome}}",
"refId": "A"
</file context>
| "uid": "prometheus" | ||
| }, | ||
| "expr": "count(count by (journey) (increase(omi_journey_accepted_total[$__range]) > 0)) or vector(0)", | ||
| "expr": "count(count by (journey) ((increase(omi_journey_accepted_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[$__range])) > 0)) or (0 * sum((increase(omi_journey_accepted_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[$__range]))))", |
There was a problem hiding this comment.
P2: Scope capture_finalization acceptance to listen’s emitting job in this panel and the acceptance trend, and update the ownership test; pusher-metrics owns the terminal outcomes, not these admissions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/monitoring/dashboards/general/omi-core-features.json, line 1651:
<comment>Scope `capture_finalization` acceptance to listen’s emitting job in this panel and the acceptance trend, and update the ownership test; `pusher-metrics` owns the terminal outcomes, not these admissions.</comment>
<file context>
@@ -1647,7 +1648,7 @@
"uid": "prometheus"
},
- "expr": "count(count by (journey) (increase(omi_journey_accepted_total[$__range]) > 0)) or vector(0)",
+ "expr": "count(count by (journey) ((increase(omi_journey_accepted_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[$__range])) > 0)) or (0 * sum((increase(omi_journey_accepted_total{job=\"cloud-run-application-metrics\",journey=\"chat_response\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"pusher_session\"}[$__range]) or increase(omi_journey_accepted_total{job=\"pusher-metrics\",journey=\"capture_finalization\"}[$__range]))))",
"instant": true,
"refId": "A"
</file context>
…ore Features pins (#24848) <!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} --> _Requested by **David**_ ## What changed and why Restores main to green. `test_committed_inventory_is_current` in `backend/tests/unit/test_monitoring_gmp_shadow.py` failed on main at a767a4b, because the Core Features dashboard changed in #24833 without the committed migration inventory being regenerated. That also blocks shard 5/8 on #24828. This PR regenerates `backend/charts/monitoring/gmp-query-migration-inventory.json` with the repo's own command, `python3 backend/scripts/monitoring_gmp_shadow.py --inventory`. The diff is limited to the `job="..."` pins on the Core Features journey panels, which is what #24833 changed. ## Product invariants affected None. The inventory is a generated, read-only record. ## How it was verified - `backend/tests/unit/test_monitoring_gmp_shadow.py`: 35 passed, in the task worktree's backend venv. - The regeneration command above is read-only and makes no datasource or rule change. ## Tests `test_committed_inventory_is_current` passes. ## UI evidence Not applicable. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24848?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24848?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24848&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
…ore Features pins The Core Features dashboard changed in BasedHardware#24833 without the committed migration inventory being regenerated, which failed test_committed_inventory_is_current on main. Regenerate it with the repo's read-only inventory command.
Requested by David
What changed and why
The Core Features dashboard combined server journeys from unrelated scrape jobs and could render absent telemetry as a measured zero. Pin server journeys to their owning jobs, show
not measuredfor missing denominators (including the absentrealtime_voicejourney), and anchor event-count zeros to reporting counters. Preserve the first-screen layout, thresholds, sparkline windows, and query budget.Section 3 only. The funnel row, vendorBalance, section 4, Index write (70/87), and listen_audio_outcome (63/80) are unchanged. No merge, deployment, dashboard save, or production provisioning was performed.
Changes c/d already partly hold at the base: server panels already use
omi_journey_*, and pusher closes, gateway requests, listen accepts, and subscription events already have no journey filter. Retain those fixes and enforce their observed label values in the contracts.frames_seen=audio, reasonsqueue_wait_timeout|application_error, listentranscription_source=omi, gatewayoutcome=success, and subscription eventscreated|ended|cancellation_requested|cancellation_revertedare from evidence (c), not guessed values.Job pins (change a)
Source: workspace
data/run-2026-11-07-dashboard-fix/prod-evidence.md(b), ~04:05Z, and (d), ~04:10Z on 2026-11-07. The table separates observed ownership from joint-count availability.All ten
omi_journey_*panels (2, 4, 5, 6, 7, 8, 9, 78, 82, 84) use these explicit journey/job pairs. Shared graphs union the disjoint selectors before aggregating. Capture stats and trends are explicitly live-only; Cloud Run sync is excluded consistently. Lead2 confirmed this live-on-pusher ownership choice at 04:45Z (bus answer3e6137, answeringe2c182): pin capture panels to pusher-metrics and describe live-on-pusher accurately.Evidence (b) gives these marginal counts; they are not per-journey job counts:
A fresh joint-count probe could not run because Grafana access was unauthorized. No joint counts are inferred from these marginals.
Explore verification (change f)
Run on 2026-11-07 against the prod Prometheus datasource (uid
prometheus) throughhttps://monitor.omi.me/api/datasources/proxy/uid/prometheus/api/v1/query, one instant query per Prometheus target on the dashboard as it is at head6802de202b5b. The token came from the hostctl secretomi-grafana-readand was read only inside the script, never printed or stored in the repo. Only metric values were read; no user data.Summary: targets 80 ok=69 empty=11 error=0 skipped=0. Panels with no series are listed below, and the Cloud Monitoring panels were not in this pass.
Expected empty panels: the Cloud PTT panels (
realtime_voiceis not a journey in prod, per the spec, so they stay "not measured"). Not expected:Capture failures by reasonand two untitled rows, which need a look by the dashboard thread.Per-target results (80)
Product invariants affected
none
Local verification
Repository:
BasedHardware/omi; path:backend/charts/monitoring/dashboards/general/omi-core-features.json; branch:lane/core-features-dashboard; commit:6802de202b5b2d05dfef85bbc7a2bd44dca999e1; base:fd5828604046d30c763aff52c1ccf96a735e622c.Task tree:
/Volumes/Ephemeral/scratch/worktrees/omi/omi-lane-core-features-dashboard-upstream-keep-clean.All successful checks ran locally through the normal
omi-heavyGit-push pool and the unchanged pre-push hook. The hook confirmed the interpreter was this task tree'sbackend/.venv/bin/python, Python 3.11.15. No skip switches were used.Command run from the task-tree root:
Result: exit 0, bounded pre-push gate passed, branch pushed. The hook ran
scripts/pr-preflight --lane local --base fd5828604046d30c763aff52c1ccf96a735e622c --head HEAD --head-branch lane/core-features-dashboard, readingOMI_PR_BODY_FILE: 37 checks passed. Failure-class schema/declaration validated. Backend typecheck: 0 errors (existing warnings).From
backend/, the hook ran these commands (BACKEND_PYTHONresolved to this tree's absolute.venv/bin/python; the generated selection listed exactly the three files below):Test environment preflight: 18 passed, 8 optional warnings, 0 failed. Pinned formatting check passed for both edited Python files. These are local unit/static results, not live Grafana verification.
Earlier standalone
make preflightand six-file pytest attempts were not admitted to the saturated main pool (exit 75 after 900s/1800s); no test result is inferred from those attempts. The successful normal push-pool run above supplies the local results. The four additional, untouched monitoring files in the earlier six-file attempt were not run.omi-lane startandmake setupfetched current main. A workspace-widemake syncwas not run because this task is confined to its product lane and must preserve other agents' checkouts. Unrelated Flutter setup changes were restored before the commit.A structural comparison against the base confirms protected panels 21, 28, 29, 30, 31, 63, 70, 73, 80, 83, and 87 are identical (AI circuit, Active WS, Pusher breaker, Oldest job, Dead letters, audio-outcome pair, Index-write pair, and recap pair). JSON retains its original two-space formatting and key order.
Failure class
Failure-Class: new
New definition:
FC-dashboard-selector-diverges-from-emitter. Existing classes cover query-budget overruns, provisioned editor shape, cache-key freshness, and dropped exporter series; none covers a dashboard selecting the wrong metric labels/owner and masking absent denominators.Violated contract: selectors must match actual emitted metric families, jobs, and bounded label values; absence is not a success rate or measured zero. Canonical prevention: the two existing dashboard contracts now enforce owner pairs, the production label vocabulary, the client/server family boundary, and denominator-backed missing-data behavior. The triggering incident is the 2026-11-07 Core Features dashboard diagnosis and evidence referenced above.
Why this is a contract rather than a shared runtime primitive: these are hand-maintained dashboard queries with distinct populations; normalizing them at runtime would not establish emitter ownership or validate production label values. The regression assertions extend the existing dashboard contracts.
UI-Evidence: none -- production Explore/rendering access returned 401; this PR changes dashboard query definitions only and does not claim a visual pass.
Rollback: revert this PR's commit before any approved provisioning. Provisioning must follow merge and David's production approval gate.