Skip to content

fix(metrics): keep quiet-check counters in both GMP sidecar allowlists - #25033

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/listen-metrics
Nov 10, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/listen-metrics

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

The quiet-check counters never reached GMP. Two independent causes, one per
ingestion path:

  1. Cloud Run copies were dropped by the GMP sidecar keep rule. Both names
    predate the omi_ prefix, and both keep rules kept only omi_.* plus a
    short exception list. listen_quiet_check_empty_exit_total is born only
    in the finalization route, which runs on backend-sync, so it was never
    ingested anywhere.
  2. The GKE listen/pusher copies are not scraped at all. The
    prod-omi-backend-listen / prod-omi-pusher PodMonitoring targets report
    up=0 and scrape_samples_scraped=0; the GMP collector's secret watcher
    cannot read metrics-scrape-token
    (watch: unknown (get secrets)). That is a deployment gap, not a code gap,
    and its fix (fix(metrics): supply GMP scrape token and collector RBAC #24961) was reverted from main at 8141729fccd9 for an
    unrelated CI hang.

This PR fixes (1) in code and documents (2) as the exact deploy steps below.

Per-counter cause

Counter Increment site Process Why it is absent from GMP
listen_quiet_check_arm_total{outcome} backend/database/conversation_quiet_checks.py:137 (ARM_METRICS[outcome].inc()), children created at import (:32) listen + pusher (GKE) and the finalization route (Cloud Run backend-sync) GKE: PodMonitoring scrape up=0 (collector cannot read the scrape secret). Cloud Run: dropped by the keep rule at backend/deploy/cloud_run_gmp_sidecar.yaml:19 and backend/deploy/cloud_run_gmp_sync.yaml:48 — the name has no omi_ prefix.
listen_quiet_check_empty_exit_total{disposition,mode} backend/database/conversation_quiet_checks.py:226 (EMPTY_OUTCOMES.labels(...).inc()), inside _evaluate_quiet_check finalization route only (Cloud Run backend-sync); never runs in listen/pusher — confirmed absent from the in-cluster Prometheus backend-listen-metrics and pusher-metrics jobs Dropped by the same two keep rules. This is the only counter that had no scraped process at all.
omi_episode_boundary_total{outcome} backend/utils/episodes/metrics.py:366 (record_boundary), children primed at import (:272) listen + pusher (GKE) and Cloud Run Passes the keep rule (omi_ prefix), so GMP holds only the Cloud Run zero children (namespace=backend 180 series, desktop-backend 8). The real listen/pusher increments are missing for the same GKE scrape reason as the arm counter.

Evidence (read-only, 2026-11-10):

  • GMP based-hardware: up{job="prod-omi-backend-listen"} = 0 for all 34
    targets, scrape_samples_scraped = 0; same for prod-omi-pusher (23
    targets). omi_episode_boundary_total exists only under
    job="omi-cloud-run-application-metrics".
  • In-cluster Prometheus prod-omi-gke: listen_quiet_check_arm_total has 140
    series on backend-listen-metrics and 92 on pusher-metrics;
    omi_episode_boundary_total has 700 / 460; listen_quiet_check_empty_exit_total
    has none — the evaluate path never runs in a listen/pusher process.
  • GMP collector log: {"component":"secret manager","err":"watch: unknown (get secrets)","msg":"secret watcher failed to start","name":"metrics-scrape-token", "namespace":"prod-omi-backend"}. The live prod Role/RoleBinding and the
    metrics-scrape-token ExternalSecret were applied at 09:07Z today, but no
    collector has restarted since, and the source change (fix(metrics): supply GMP scrape token and collector RBAC #24961) is no longer on
    main.
  • Dev based-hardware-dev: up{job="dev-omi-backend-listen"} = 0 and
    up{job="dev-omi-pusher"} = 0; dev has the PodMonitoring but no
    *-metrics-scrape Role/RoleBinding at all.

Fix

  • backend/deploy/cloud_run_gmp_sidecar.yaml and
    backend/deploy/cloud_run_gmp_sync.yaml: keep listen_quiet_check_.*
    explicitly. Names are unchanged, so the in-cluster series the quiet-exit
    rollout is judged on keep their continuity.
  • backend/charts/monitoring/metric-inventory.prod.json: declare
    listen_quiet_check_empty_exit_total (source-backed, not yet in the
    snapshot).
  • backend/tests/unit/test_quiet_check_metrics_are_scraped.py: pins both
    counter names against both keep rules and asserts the module registers them.
  • backend/tests/unit/test_attach_cloud_run_gmp_sidecar.py: updates the pinned
    shared-regex contract.
  • .github/failure-classes/FC-metric-dropped-by-scrape-allowlist.json: adds the
    new test as a guard artifact.
  • Change note under backend/docs/listen_pusher_pipeline/changes/.

Tests

cd backend
.venv/bin/python -m pytest -q \
  tests/unit/test_quiet_check_metrics_are_scraped.py \
  tests/unit/test_attach_cloud_run_gmp_sidecar.py \
  tests/unit/test_monitoring_telemetry_contract.py \
  tests/unit/test_monitoring_alert_rule_contract.py \
  tests/unit/test_conversation_quiet_finalization.py \
  tests/unit/test_quiet_check_retirement.py \
  tests/unit/test_serving_podmonitoring_chart.py \
  tests/unit/test_monitoring_alert_backtest.py

Result: 429 passed (247 + 182 across the two runs), 0 failed.

Deploy steps (cl2-deploy)

Repository changes alone do not mutate Cloud Run or GKE.

  1. Cloud Run allowlist — the sidecar config is revision-local
    (OMI_GMP_RUN_MONITORING_CONFIG), so it ships with the next normal deploy of
    each service. Dev first, then prod:
    • gh workflow run gcp_backend_auto_dev.yml --ref main (backend + backend-sync
      • backend-integration candidates), then the prod backend dispatch.
    • Confirm the new revision's collector env carries the updated regex before
      promotion; the deploy helper validates the config locally.
  2. GKE scrape auth — blocked on re-landing fix(metrics): supply GMP scrape token and collector RBAC #24961 (reverted at
    8141729fccd9). Until it re-lands, the listen/pusher PodMonitoring targets
    stay up=0 and no GKE-sourced counter can reach GMP. The live prod cluster
    already has the Role/RoleBinding and the metrics-scrape-token secret from
    the 09:07Z apply; dev has neither.
  3. Restart the GMP collectors so the secret watcher starts with the RBAC:
    kubectl --context gke_based-hardware-dev_us-central1_dev-omi-gke \
      -n gmp-system rollout restart daemonset/collector
    kubectl --context gke_based-hardware_us-central1_prod-omi-gke \
      -n gmp-system rollout restart daemonset/collector
    
  4. Verify (read-only):
    sum(up{job="prod-omi-backend-listen"}) == count(up{job="prod-omi-backend-listen"})
    sum(up{job="prod-omi-pusher"}) == count(up{job="prod-omi-pusher"})
    
    Require a nonzero target count and nonzero scrape_samples_scraped.

Confirming one series in dev after deploy

With QUIET_EMPTY_EXIT_ENABLED=true on dev listen and the dev Cloud Run
services:

# GKE listen copy (after the collector restart)
sum by (outcome) (increase(listen_quiet_check_arm_total{
  job="dev-omi-backend-listen"}[15m]))

# Finalization-route copy (after the dev backend-sync deploy)
sum by (disposition, mode) (increase(listen_quiet_check_empty_exit_total{
  job="omi-cloud-run-application-metrics", namespace="backend-sync"}[15m]))

# Episode boundary decisions from the listen fleet
sum by (outcome) (increase(omi_episode_boundary_total{
  job="dev-omi-backend-listen"}[15m]))

A single non-zero listen_quiet_check_empty_exit_total{disposition="delete_empty",mode="serve"}
series is the acceptance signal for the quiet-exit rollout.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

🤖 Generated with Claude Code

listen_quiet_check_arm_total and listen_quiet_check_empty_exit_total predate
the omi_ prefix, so both Cloud Run GMP keep rules dropped them at ingestion.
The empty-exit counter is born only in the finalization route (backend-sync),
so it was never ingested anywhere; the arm counter's Cloud Run copy was
dropped the same way. Keep listen_quiet_check_.* explicitly in the shared and
sync profiles, declare the empty-exit counter in the metric inventory, and pin
both names against both keep rules.

The GKE listen/pusher copies are a separate deployment gap: the PodMonitoring
targets report up=0 because the GMP collector cannot read metrics-scrape-token.
The chart RBAC and backend-secrets copy already exist; the collector needs a
restart after they are applied. Deploy steps are in the PR body.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T11:26:32.464258Z 4c39ec9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level
Git-on-my-level merged commit c8959fd into main Nov 10, 2026
68 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/listen-metrics branch November 10, 2026 12:03
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