Skip to content

feat(monitoring): ingest Cloud Run application metrics - #11998

Merged
Git-on-my-level merged 9 commits into
mainfrom
feat/cloudrun-metrics-egress
Aug 22, 2026
Merged

Git-on-my-level merged 9 commits into
mainfrom
feat/cloudrun-metrics-egress

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • expose each backend and desktop-backend process registry on loopback and attach Google's pinned GMP Cloud Run sidecar to every zero-traffic candidate
  • import only prometheus.googleapis.com/omi_* Cloud Run series through a dedicated Stackdriver exporter that the existing GKE Prometheus scrapes every 30 seconds
  • add a deployment owner that atomically installs both the exporter and Prometheus scrape configuration: automatic for dev after relevant merges, protected manual dispatch for prod
  • bind METRICS_SECRET to desktop-backend while keeping the public /metrics route fail-closed, and document counter/cardinality/cost/rollback behavior

The design and live evidence are in backend/docs/runbooks/cloud-run-metrics-ingestion.md. A public Cloud Run URL scrape was rejected because it reaches one random autoscaled instance and corrupts counter/histogram aggregation. Grafana's Cloud Monitoring datasource remains a fallback, but it would not place the series in the Prometheus datasource used by the current alert contract.

Live evidence

  • Managed Prometheus is enabled in both GKE clusters; both have gmp-system/gmp-public, a running operator, and managed collectors (dev 10, prod 26)
  • the live Stackdriver exporter reads only the two existing load-balancer prefixes and its GSA already has Monitoring Viewer
  • live Helm ownership is dev-kube-prometheus-stack in dev and prod-omi-kube-prometheus-stack in prod; the new workflow encodes those observed names rather than deriving the wrong dev release
  • both Cloud Run runtime service accounts already have project-level Secret Accessor and metric-write capability; cloud-run-gmp-config is absent and will be created on first rollout
  • Cloud Run server-side services replace --dry-run accepted patched live dev exports for both services without creating a revision or changing traffic

Product invariants affected

  • INV-DATA-1
  • INV-MEM-4

Verification

  • focused deploy/monitoring/workflow contracts: 179 passed in 7.17s
  • actionlint passed for both changed workflows
  • high-risk workflow contract registry validation passed
  • runtime env composition: generated manifest is up to date
  • Helm 4.8.3 exporter and Helm 75.15.1 Prometheus upgrades passed server-side dry runs against both live GKE clusters without mutation
  • pinned GMP sidecar digest exists in Artifact Registry

cloud-run-application-metrics remains coverage_status: declared: exporter up alone cannot prove Cloud Run ingestion. After rollout, verify the exact normalized series name and add a separate per-service freshness rule rather than claiming false coverage.

Requires a human

  1. Verify the GitHub deploy service account represented by GCP_CREDENTIALS can create/update Secret Manager secrets and add versions in both projects. If it cannot, grant it for the rollout (replace the placeholder):
    DEPLOY_SA='<github-deploy-service-account>@<project>.iam.gserviceaccount.com'
    for PROJECT in based-hardware-dev based-hardware; do
      gcloud projects add-iam-policy-binding "$PROJECT" \
        --member="serviceAccount:$DEPLOY_SA" \
        --role=roles/secretmanager.admin
    done
    No new runtime credential is required for the current services; their verified runtime accounts already have roles/secretmanager.secretAccessor and metric-write access.
  2. After merge, confirm the automatic Deploy Cloud Run Metrics Egress development run succeeds. Retry only from reviewed main if needed:
    gh workflow run gcp_cloud_run_metrics_egress.yml --ref main -f environment=development
  3. After a successful Release Eligibility run, deploy dev Cloud Run candidates:
    SHA="$(git rev-parse origin/main)"
    gh workflow run gcp_backend.yml -f environment=development -f mode=deploy -f deploy_targets=cloud-run-only -f release_sha="$SHA"
    gh workflow run desktop_backend_auto_dev.yml -f candidate_only=false
  4. Verify dev end to end: both services have their ingress container plus collector; collector logs show successful scrapes; Metrics Explorer contains prometheus.googleapis.com/omi_* with cluster="__run__" and both service namespaces; Prometheus target cloud-run-application-metrics is up; a known journey increments the same counter in Cloud Monitoring and Grafana Explore.
  5. Deploy the production exporter and Prometheus scrape configuration through the protected workflow:
    gh workflow run gcp_cloud_run_metrics_egress.yml --ref main -f environment=prod
  6. Deploy prod using the admitted main SHA and the existing confirmations, then repeat the end-to-end checks before adding journey alerts:
    SHA='<merged-main-sha-with-successful-release-eligibility>'
    gh workflow run gcp_backend.yml -f environment=prod -f mode=deploy -f deploy_targets=cloud-run-only -f release_sha="$SHA"
    gh workflow run desktop_backend_prod.yml -f release_sha="$SHA" \
      -f confirm=deploy-desktop-backend-prod -f reason='Enable per-instance GMP metrics'

Git-on-my-level and others added 7 commits August 21, 2026 01:16
Route per-instance Cloud Run registries through GMP and an isolated Cloud Monitoring bridge so existing Prometheus-backed alerts can consume them safely across autoscaling.

Failure-Class: new
Keep the new non-secret runtime binding inside the checked-in deployment setting boundary.
Keep the production routing guard fail-closed for deployment ownership while allowing the dedicated Stackdriver exporter to name the Cloud Run desktop service it observes.
Install both sides of the Cloud Monitoring-to-Prometheus bridge through a protected, test-covered workflow so checked-in exporter values cannot remain inert.
Keep the persistent monitoring writer inside the audited environment-scoped mutation graph so concurrent Helm upgrades cannot bypass repository deployment policy.
Bind protected monitoring deployments to the workflow event SHA so approval or queue delay cannot substitute a newer main configuration.
Ingested-but-unmatched is the same outage as never-ingested.

The Stackdriver exporter renames everything it imports to
stackdriver_<resource>_<metric type>_<value type>. Without a rewrite,
omi_journey_accepted_total arrives from Cloud Run as
stackdriver_prometheus_target_prometheus_googleapis_com_omi_journey_accepted_total_counter,
and the entire existing alert corpus — including omi-journey-chat-fail and
omi-journey-signal-dead — goes on matching nothing while the metrics are
demonstrably flowing. That is precisely the shape that kept a 19-hour outage
silent, rebuilt in a new place.

The cloud-run-application-metrics job now rewrites __name__ back to the plain
form, so a GKE-sourced and a Cloud Run-sourced series are one metric told apart
by service_name, and existing PromQL works unchanged.

The exact exporter naming cannot be confirmed until the pipeline is live, so
the regex is a prediction. omi-cloud-run-metric-names-unnormalized fires when
any un-normalized omi series survives the rewrite, which turns a wrong guess
into a page instead of into silence.

Verified: the regex recovers all four realistic name shapes including
histogram suffixes and a metric whose own name contains "counter", leaves
unrelated series untouched, and removing it fails the contract test.

Co-Authored-By: Claude Opus 5 <[email protected]>

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature/infra (Cloud Run metrics ingestion), not a bug fix — approve-only. DIRTY, and touches .github/workflows/ so flagging for visibility, not merging.

r added 2 commits August 22, 2026 15:29
…-egress

# Conflicts:
#	backend/tests/unit/test_desktop_backend_cors.py
…'s bytes

The merge of origin/main into feat/cloudrun-metrics-egress ran the
local Dart/Prettier formatters against files the merge brought in
that this PR does not touch. Restoring them byte-for-byte to
origin/main avoids scope creep and unrelated CODEOWNERS.
@Git-on-my-level
Git-on-my-level merged commit 44b672c into main Aug 22, 2026
37 checks passed
@Git-on-my-level
Git-on-my-level deleted the feat/cloudrun-metrics-egress branch August 22, 2026 19:46
Git-on-my-level added a commit that referenced this pull request Aug 23, 2026
…2080)

Automatic development deploys have failed since the Managed Prometheus
sidecar landed in #11998:

    preflight-cloud-run-deploy.py: error: Legacy public-binding migration
    requires exactly one container per Cloud Run service

The sidecar is attached to the candidate revision after the deploy, so the
service carries two containers from then on. `_single_container` counted
containers to prove there was one unambiguous set of runtime bindings to
read, and the collector -- which holds none of those bindings -- broke that
count. Select the application container by excluding the sidecar by name
instead, which is the same rule `attach_cloud_run_gmp_sidecar.py` already
applies when it resolves the ingress container.

This is not development-only. `check_runtime_bindings` is gated to the
auto-dev profile, but `migrate_legacy_public_bindings` runs unconditionally
in `deploy-backend-stack`, and the sidecar attach is likewise ungated. The
first production deploy would attach the sidecar and succeed; every
production deploy after it would fail this argument check. Production has
one container today (`backend-1`), so the fix lands before the trap arms
rather than after.

Tests cover both call sites and both directions: a service carrying the
collector passes, and a service with two genuine application containers is
still rejected. Both new tests fail against the current script with the
exact error seen in CI.

Co-authored-by: r <r@r>
Co-authored-by: Claude Opus 5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Aug 23, 2026
…12081)

Development backend deploys still fail after #12080, now inside gcloud:

    ERROR: gcloud crashed (ValueError): Invalid secret path
    'projects/based-hardware-dev/secrets/cloud-run-gmp-config' in annotation

`_merge_secret_annotation` wrote the config secret into
`run.googleapis.com/secrets` using the project ID. gcloud parses that
annotation with

    ^projects/(?P<project>[0-9]{1,19})/secrets/(?P<secret>[a-zA-Z0-9-_]{1,255})...

(googlecloudsdk/command_lib/run/secrets_mapping.py), so the project segment
must be numeric. Resolve the project number and write that instead.

The shape of this is worth naming. Cloud Run accepts the attach with either
form, so nothing fails at attach time; the annotation is only re-parsed by
the *next* `gcloud run deploy` on that service. The first deploy after the
sidecar lands succeeds, and the one after it crashes on a service nobody
touched in between -- which is why this read as unrelated to #11998.

Production has no sidecar attached yet, so it has never written this
annotation and is not carrying the defect. It would have written it on its
first deploy and crashed on its second.

`patch_service` stays pure: `attach_sidecar` resolves the number and passes
it in, so no test needs a subprocess. A numeric project is passed through
without calling gcloud at all. The new annotation test asserts against the
gcloud regex verbatim rather than a hand-copied expectation.

Failure-Class: new

Co-authored-by: r <r@r>
Co-authored-by: Claude Opus 5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Aug 23, 2026
…Monitoring (#12099)

* fix(monitoring): accept the Cloud Run metrics egress filter at Cloud Monitoring

The dedicated Stackdriver exporter added in #11998 has never imported a
single series. Cloud Monitoring rejects a filter that mixes AND with OR
across resource.labels restrictions, so every descriptor query returned
HTTP 400 while the exporter stayed Available, its Prometheus target
stayed up, and Grafana showed empty panels that read as no traffic.

Express the namespace disjunction as one_of(...), which the filter
grammar defines for this case. Keep the namespace scope: dropping it
would import every omi_ series from every Cloud Run service in the
project.

Add omi-cloud-run-metrics-egress-query-rejected, alerting on the
exporter's own upstream error rather than on its liveness. Extend the
exporter contract test to cover the dev values file, which was
unasserted and is what the automatic post-merge rollout installs.
Correct the runbook's verification step, which queried the mangled
metric name that a healthy deployment no longer produces.

* fix(monitoring): key the Cloud Run observer exemption on the monitored resource

The production-data-plane-routing guard exempts the Stackdriver egress
values files from its retired-GKE-desktop-backend rule only when they
contain the literal resource.labels.namespace="desktop-backend". That
pins the exemption to one spelling of a filter rather than to what makes
the file a Cloud Run observer, so rewriting the disjunction as one_of(...)
to satisfy Cloud Monitoring's grammar made a read-only metrics reader
look like retired GKE ownership.

Key the exemption on resource.labels.cluster="__run__" instead. That is
Cloud Run's reserved pseudo-cluster, so together with the
prometheus.googleapis.com/ prefix it identifies the monitored resource
directly and survives any future edit to the namespace set.

---------

Co-authored-by: r <r@r>
formed2forge pushed a commit to formed2forge/omi that referenced this pull request Aug 24, 2026
…sedHardware#12080)

Automatic development deploys have failed since the Managed Prometheus
sidecar landed in BasedHardware#11998:

    preflight-cloud-run-deploy.py: error: Legacy public-binding migration
    requires exactly one container per Cloud Run service

The sidecar is attached to the candidate revision after the deploy, so the
service carries two containers from then on. `_single_container` counted
containers to prove there was one unambiguous set of runtime bindings to
read, and the collector -- which holds none of those bindings -- broke that
count. Select the application container by excluding the sidecar by name
instead, which is the same rule `attach_cloud_run_gmp_sidecar.py` already
applies when it resolves the ingress container.

This is not development-only. `check_runtime_bindings` is gated to the
auto-dev profile, but `migrate_legacy_public_bindings` runs unconditionally
in `deploy-backend-stack`, and the sidecar attach is likewise ungated. The
first production deploy would attach the sidecar and succeed; every
production deploy after it would fail this argument check. Production has
one container today (`backend-1`), so the fix lands before the trap arms
rather than after.

Tests cover both call sites and both directions: a service carrying the
collector passes, and a service with two genuine application containers is
still rejected. Both new tests fail against the current script with the
exact error seen in CI.

Co-authored-by: r <r@r>
Co-authored-by: Claude Opus 5 <[email protected]>
formed2forge pushed a commit to formed2forge/omi that referenced this pull request Aug 24, 2026
…asedHardware#12081)

Development backend deploys still fail after BasedHardware#12080, now inside gcloud:

    ERROR: gcloud crashed (ValueError): Invalid secret path
    'projects/based-hardware-dev/secrets/cloud-run-gmp-config' in annotation

`_merge_secret_annotation` wrote the config secret into
`run.googleapis.com/secrets` using the project ID. gcloud parses that
annotation with

    ^projects/(?P<project>[0-9]{1,19})/secrets/(?P<secret>[a-zA-Z0-9-_]{1,255})...

(googlecloudsdk/command_lib/run/secrets_mapping.py), so the project segment
must be numeric. Resolve the project number and write that instead.

The shape of this is worth naming. Cloud Run accepts the attach with either
form, so nothing fails at attach time; the annotation is only re-parsed by
the *next* `gcloud run deploy` on that service. The first deploy after the
sidecar lands succeeds, and the one after it crashes on a service nobody
touched in between -- which is why this read as unrelated to BasedHardware#11998.

Production has no sidecar attached yet, so it has never written this
annotation and is not carrying the defect. It would have written it on its
first deploy and crashed on its second.

`patch_service` stays pure: `attach_sidecar` resolves the number and passes
it in, so no test needs a subprocess. A numeric project is passed through
without calling gcloud at all. The new annotation test asserts against the
gcloud regex verbatim rather than a hand-copied expectation.

Failure-Class: new

Co-authored-by: r <r@r>
Co-authored-by: Claude Opus 5 <[email protected]>
formed2forge pushed a commit to formed2forge/omi that referenced this pull request Aug 24, 2026
…Monitoring (BasedHardware#12099)

* fix(monitoring): accept the Cloud Run metrics egress filter at Cloud Monitoring

The dedicated Stackdriver exporter added in BasedHardware#11998 has never imported a
single series. Cloud Monitoring rejects a filter that mixes AND with OR
across resource.labels restrictions, so every descriptor query returned
HTTP 400 while the exporter stayed Available, its Prometheus target
stayed up, and Grafana showed empty panels that read as no traffic.

Express the namespace disjunction as one_of(...), which the filter
grammar defines for this case. Keep the namespace scope: dropping it
would import every omi_ series from every Cloud Run service in the
project.

Add omi-cloud-run-metrics-egress-query-rejected, alerting on the
exporter's own upstream error rather than on its liveness. Extend the
exporter contract test to cover the dev values file, which was
unasserted and is what the automatic post-merge rollout installs.
Correct the runbook's verification step, which queried the mangled
metric name that a healthy deployment no longer produces.

* fix(monitoring): key the Cloud Run observer exemption on the monitored resource

The production-data-plane-routing guard exempts the Stackdriver egress
values files from its retired-GKE-desktop-backend rule only when they
contain the literal resource.labels.namespace="desktop-backend". That
pins the exemption to one spelling of a filter rather than to what makes
the file a Cloud Run observer, so rewriting the disjunction as one_of(...)
to satisfy Cloud Monitoring's grammar made a read-only metrics reader
look like retired GKE ownership.

Key the exemption on resource.labels.cluster="__run__" instead. That is
Cloud Run's reserved pseudo-cluster, so together with the
prometheus.googleapis.com/ prefix it identifies the monitored resource
directly and survives any future edit to the namespace set.

---------

Co-authored-by: r <r@r>
Git-on-my-level added a commit that referenced this pull request Aug 24, 2026
…#12156)

status.imageDigest is the legacy single-container scalar in the Cloud Run v1
Revision API and comes back empty on any multi-container revision. The
Managed Prometheus sidecar (#11998) made every desktop-backend candidate
two-container, so the field went empty and image lineage verification has
failed closed on every dev/prod candidate since. Extract the runtime image
from the named desktop-backend-1 container instead, asserting exactly one
match so the guard still fails closed on an ambiguous topology.

Co-authored-by: r <r@r>
Co-authored-by: Claude Opus 5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Aug 31, 2026
…12446)

## Why this change

On 2026-08-30 a voice-capture outage left `capture_finalization` success
at **0% for hours** while every existing critical stayed Normal: listen
ready=5, listen WS≈325, pusher WS≈326, LB traffic flowing, 5xx rps=0.
The existing criticals only watch zero LB traffic, zero ready pods, WS <
10, and 5xx rates. The rules that did read user outcomes
(`omi-journey-*-fail`, #11991) are **warning-class**, and the [Omi Core
Features
dashboard](https://monitor.omi.me/d/omi-core-features/omi-core-features)
that plots these SLIs is visualization-only — panel thresholds, zero
alert rules. **Dashboard ≠ alert**: the signal existed, nothing paged on
it.

Incident fingerprint (last 1h at peak):
`omi_journey_terminal_total{journey="capture_finalization"}` success=0,
failure≈360, stale≈290; accepted≈750; oldest unfinished finalization job
≈ 5.9 days; dead letters ≈ 2.5k/24h.

## What was added

Six `severity: critical` rules in the `Resilience` group (split source
`backend/charts/monitoring/alerts/resilience.json`, mirrored into the
combined `backend/charts/monitoring/alert-rules.json`), plus one rule
change. Every rule links the Core Features panel that plots its own
signal.

| Metric / SLI | Existing rule (git = live mirror) | False-negative
class this incident hit | New / changed UID | noDataState | Traffic gate
|
|---|---|---|---|---|---|
| `capture_finalization` success share | `omi-journey-capture-fail`
(warning, #11991; reads `listen_finalization_durable_jobs` deltas) |
warning-class — ticket lane, no page; incident kept it out of the paging
path | `omi-journey-capture-success-critical` | `NoData` | ≥ 20 accepted
/ 30m |
| accepted-without-terminal (accepted vs settled) |
`omi-capture-finalization-dead-emission` (warning; fires only on
**zero** terminal movement) | incident had *flowing* failure/stale
terminals, so the zero-terminal condition never applied at page class |
`omi-journey-capture-settle-gap` | `NoData` | ≥ 100 accepted / 1h |
| `listen_finalization_dead_letter_total` | **missing** (dashboard panel
only) | ~2.5k dead letters/day with zero alerts reading it |
`omi-capture-dead-letter-surge` | `Alerting` | none — each dead letter
is a lost capture (> 50/1h) |
| `listen_finalization_oldest_nonterminal_age_seconds` | **missing**
(backlog panel from #12211 only) | oldest job aged to 5.9 days with zero
alerts reading it | `omi-capture-oldest-nonterminal` | `Alerting` | none
— queue age is traffic-independent (> 3600s) |
| `pusher_session` success share | `omi-journey-pusher-fail` (warning) |
warning-class only | `omi-journey-pusher-success-critical` | `NoData` |
≥ 20 accepted / 30m |
| `chat_response` success share | `omi-journey-chat-fail` (warning;
unfirable for its whole life before the Cloud Run bridge) |
warning-class + counter historically absent from Prometheus |
`omi-journey-chat-success-critical` | `NoData` | ≥ 20 accepted / 30m |
| journey counter liveness | `omi-journey-signal-dead` covered only
`pusher_session\|capture_finalization`; `chat_response` exempt | a dead
chat counter would silently disarm every chat alert (the exact
2026-08-19 hole) | `omi-journey-signal-dead` **changed** — adds a
`chat_response` arm | `Alerting` | chat arm gated on
`llm_gateway_requests_total{lane_id="omi:auto:chat-agent"} > 20/1h` |

### PromQL

Success-rate rules pair numerator and denominator from the same emitter
(`omi_journey_terminal_total` for one `journey`), gated on that
journey's accepted counter (example: capture):

```promql
# A — gate
sum(increase(omi_journey_accepted_total{journey="capture_finalization"}[30m]))
# B — success share (a total terminal stall with real traffic reads 0 and pages)
sum(increase(omi_journey_terminal_total{journey="capture_finalization",outcome="success"}[30m]))
  / clamp_min(sum(increase(omi_journey_terminal_total{journey="capture_finalization",outcome=~"success|failure"}[30m])), 1)
# C — $A >= 20 && $B < 0.90, for 10m
```

Settle gap (accepted minus all terminal outcomes, 1h): `$A >= 100 && $B
> 50`, for 15m.
Oldest job: `max(listen_finalization_oldest_nonterminal_age_seconds) >
3600`, for 15m.
Dead letters: `sum(increase(listen_finalization_dead_letter_total[1h]))
> 50`, for 15m.
Liveness chat arm (added to `omi-journey-signal-dead`):

```promql
or (sum by (journey) (increase(omi_journey_accepted_total{journey="chat_response"}[1h])) < bool 1)
   * on() group_left() (sum(increase(llm_gateway_requests_total{lane_id="omi:auto:chat-agent"}[1h])) > bool 20)
```

### noData semantics

- Success-rate and gap rules: `NoData` (the documented
`traffic_gated_journey` class) — missing series are visible as NoData,
never healthy; counter death pages via `omi-journey-signal-dead` and
`omi-journey-scrape-missing`.
- Queue rules (`oldest-nonterminal`, `dead-letter`): `Alerting` — both
series are unlabeled and zero-initialized on every backend-listen
replica, so absence during real traffic means the emitter or its scrape
is gone. Documented as `finalization_queue_health` in
`expected-targets.prod.yaml`.

### Threshold calibration (documented in
`backend/docs/runbooks/real-traffic-journeys.md`)

- 0.90 paging floor vs the dashboard's 95/99 display thresholds; the
incident sat at 0%.
- ≥ 20 accepted/30m gate (same floor the existing warning rules use);
the incident ran ~375 accepted/30m.
- Gap > 50/h at ≥ 100 accepted/h: the incident left ~100/h
accepted-but-never-settled; healthy in-flight work settles in minutes.
- Oldest job > 1h: healthy drain is minutes; incident oldest was ~5.9
days.
- Dead letters > 50/h: incident ran ~104/h (2.5k/day).
- Chat liveness gate > 20/h sits above the chat-agent lane's measured
p05 (min 9, p01 15, p05 23, median 55 req/h over 7 prod days), so quiet
hours do not page.

These are incident-calibrated initial values; replay them against
production history when importing (the repo has no live Prometheus
access from a PR-checkout environment).

## Live vs git reconciliation

- Live Grafana (issue-verified 2026-08-30 ~23:30 UTC): **68 unified
rules**; git before this PR: **80**. The 12-rule delta is recently
merged rules not yet imported (Firestore #12193/#12201/#12241, cloud-run
ingestion #11998/#12146, etc.) — the documented apply path is a
maintainer import of `alert-rules.json`; no CI writes Grafana, and this
PR follows that path (no API writes).
- The pre-incident journey rules (from #11991, merged 2026-08-22)
predate the outage window; their gap was severity class, not presence.
- Metric label sets were discovered from the emitter contract, not
guessed: `utils/metrics.py`, `utils/observability/journeys.py`
(`journey` ∈ {`chat_response`, `pusher_session`,
`capture_finalization`}; `outcome` ∈ {`success`, `failure`, `cancelled`,
`stale`}), `services/conversation_finalization.py` (unlabeled
dead-letter counter, unlabeled oldest-age gauge, `state`-labeled durable
gauge), and the closed vocabulary in
`backend/docs/runbooks/real-traffic-journeys.md`. Direct live
Prometheus/Grafana queries were not available from this environment
(auth required); the `chat_response` ingestion path is evidenced by
#12146's measured live prod scrape (~28MB, 52,662 `omi_*` series).

## Tests

Extended `test_monitoring_alert_rule_contract.py`:

- `LIVENESS_EXEMPT_JOURNEYS` is now empty — the `chat_response`
exemption's own deletion clause fired once the Cloud Run bridge was
verified live;
`test_every_alerted_journey_is_covered_by_the_liveness_rule` now
enforces chat coverage instead.
- New:
`test_page_class_journey_rules_cover_the_capture_outage_fingerprint`
(severity, component, noData, `for` window, receiver, exact math gates),
`test_page_class_success_rules_pair_numerator_and_denominator_from_one_emitter`,
`test_finalization_queue_rules_read_the_replicated_series_correctly`
(max-aggregation for the replicated gauge).

## Verification

```bash
cd backend && .venv/bin/python -m pytest \
  tests/unit/test_journey_observability.py \
  tests/unit/test_monitoring_alert_rule_contract.py \
  tests/unit/test_monitoring_dashboard_absence_contract.py \
  tests/unit/test_monitoring_telemetry_contract.py -q
# 63 passed  (the exact set scripts/select_backend_unit_tests.py selects for these changed files)

make preflight   # PR preflight passed: 11 checks in 28.55s
```

Closes SCA-379


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/12446?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="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
pull Bot pushed a commit to AmirulAndalib/omi that referenced this pull request Aug 31, 2026
The 2026-08-30 capture-finalization outage sat at 0% success for hours
(failure ~360/h, stale ~290/h, accepted ~750/h, oldest job ~5.9d, dead
letters ~2.5k/day) while every listen/pusher critical stayed Normal:
they only watch LB traffic, ready pods, WS counts, and 5xx rates. The
journey rules that did read user outcomes were warning-class (BasedHardware#11991),
and the Core Features dashboard tiles were visualization-only.

Add six severity:critical rules plus liveness coverage for chat:

- omi-journey-capture-success-critical / -pusher- / -chat-: success
  share < 0.90 for 10m at >= 20 accepted/30m (numerator and denominator
  from the same omi_journey_terminal_total emitter)
- omi-journey-capture-settle-gap: accepted - settled > 50/h at >= 100
  accepted/h for 15m
- omi-capture-oldest-nonterminal: max age > 3600s for 15m
- omi-capture-dead-letter-surge: > 50 dead letters/h for 15m
- omi-journey-signal-dead now covers chat_response behind a chat-agent
  lane gate (> 20/h, above the lane's measured p05); the
  LIVENESS_EXEMPT_JOURNEYS entry is deleted per its own instruction now
  that the Cloud Run metrics bridge is verified live (BasedHardware#11998, BasedHardware#12146)

Contract tests pin severity, components, gates, noData semantics, and
single-emitter pairing; expected-targets documents the new
finalization_queue_health: Alerting no-data class; runbooks updated.

Verification: pytest tests/unit/test_journey_observability.py
tests/unit/test_monitoring_alert_rule_contract.py
tests/unit/test_monitoring_dashboard_absence_contract.py
tests/unit/test_monitoring_telemetry_contract.py -> 63 passed;
make preflight -> 11 checks passed.

Co-authored-by: multica-agent <[email protected]>
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.

2 participants