Skip to content

fix(monitoring): rename custom-metric API aggregates back to their plain omi_ names - #21409

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/obs-metric-normalize
Oct 13, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/obs-metric-normalize

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

omi-cloud-run-metric-names-unnormalized (critical) has been pending and firing on prod since this morning. It counts 390 series: backend-sync's omi_sync_phase_calls_per_job_* and omi_sync_phase_duration_seconds_* histograms (exported since 0aa2513, 2026-10-04).

The cause is that these series are written through the Cloud Monitoring custom-metric API. The Stackdriver exporter names them stackdriver_generic_task_custom_googleapis_com_<name>, with no value-type suffix, and the existing rewrite only matches stackdriver_prometheus_target_prometheus_googleapis_com_*. So the alert is a true positive: the series are ingested but sit outside the plain omi_ namespace that dashboards query. The metric inventory had also recorded the mangled names.

  • Adds a second metric_relabel_configs rewrite in dev and prod for stackdriver_generic_task_custom_googleapis_com_(omi_.+) → ${1}.
  • Replaces the six mangled inventory entries with their plain names.
  • Adds test_custom_metric_api_aggregates_are_renamed_back_too. It checks the rewrite in both environments, the name recovery, and that no inventoried metric still matches the alert's stackdriver_.*_omi_.* pattern.

Verification

  • Prod Prometheus (ro-prod, read-only): count by (__name__)({job="cloud-run-application-metrics", __name__=~"stackdriver_.*_omi_.*"}) returns exactly those six families (165+15+15 series each).
  • backend/test.sh with every tests/unit/test_monitoring*.py: pass. alert_backtest.py --lint: failures: {}.

Rollout

Monitoring Helm rollout (gcp_cloud_run_metrics_egress.yml, prod). Then confirm the unnormalized count is 0 and that omi_sync_phase_duration_seconds_count{service_name="backend-sync"} exists.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…ain omi_ names

backend-sync's omi_sync_phase_* histograms arrive as
stackdriver_generic_task_custom_googleapis_com_<name>, which the existing rewrite
does not match, so omi-cloud-run-metric-names-unnormalized has been pending at
critical and the inventory recorded the mangled names.

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

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T15:05:26.931507Z 3cc3184 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 7e3f4d7 into main Oct 13, 2026
68 of 70 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/obs-metric-normalize branch October 13, 2026 15:48
Git-on-my-level added a commit that referenced this pull request Oct 14, 2026
…rrupted-stream rule

Review revision of #21455 round 1:

- Prometheus CPU limit back to "2": load is sustained 1.5-2.2 cores over
  14h (the ~2.9-core spikes were kubelet scrape-timeout artifacts), 0%
  CFS-throttled, and the Prometheus-backed rules already time out - the
  1600m cap would throttle them and the adapter's HPA metrics further.
  Starvation is fixed with requests plus the pool resize runbook instead.
- Loki read path (ingester/querier 50m/256Mi, index-gateway/ruler
  20m/128Mi) gets requests, arithmetic in the values file: jzv7 1913m of
  1930m allocatable, mczx 1488m. loki values normalized CRLF->LF
  (file untouched since #2708; the hygiene check rejects new CRLF lines).
- README: rollback now records the pre-apply helm revision (rolling back
  to rev 14 would revert #21306/#21389/#21358/#21409; #21389 is
  screenshots-off, the 10-13 502 fix); corrected the "renders with no
  diff" claim; added the 4-vCPU pool resize runbook (exact gcloud create
  + cordon/drain, zonal us-central1-a so the Grafana/Prometheus PVCs
  reattach); stack applies marked off-peak (Prometheus WAL replay of
  ~700k-980k head series freezes the pusher/listen/parakeet/VAD/diarizer
  HPAs; #21448's inert diarizer scrape job rides along); the 109/286
  down-target count (34 stale kubelet endpoints) noted as operator
  crash-loop fallout expected to clear.
- New metric rule omi-listen-audio-decode-failures shadows the paused
  corrupted-stream log rule on omi_listen_audio_decode_failures_total
  (startup zero-init children added); listen-429, ASGI-handshake and
  direct-OpenAI-quota gaps tracked in #21461.
Git-on-my-level added a commit that referenced this pull request Oct 14, 2026
…g-node CPU (#21455)

* fix(monitoring): hold raw-line Loki alert rules and reserve monitoring-node CPU

2026-10-14 prod: Grafana /api/health flapped 502, alert evaluation logged
190 failures + 120 dropped ticks over 20 minutes, the prometheus operator
restarted 48x and the adapter 35x in 31h, and every pusher deploy failed on
alert provisioning. Two causes, both read-verified against prod:

1. Four committed alert rules query the Loki datasource for raw log lines
   (whole-namespace regex scans, 60s ticks, one with [$__auto]). They caused
   340 of 410 rule-eval failures in 3h (196 from afd0krbk1bugwf alone), each
   timing out past the 30s datasource budget - the same failure class as the
   2026-10-13 Cloud Logging rule (#21390). Pause all four and hold them in
   metric-inventory admission_holds; re-admit only on bounded counters.

2. Grafana, the operator and the adapter ran BestEffort on a ~1.93
   allocatable-core monitoring node while Prometheus's 2-CPU limit exceeded
   total node capacity, so Prometheus bursts starved kubelet probes (the
   operator/adapter restart mechanism - SIGTERM after probe timeout) and
   Grafana's HTTP server. Cap Prometheus at 1600m and give Grafana, the
   operator and the adapter explicit requests.

New contract test rejects any unpaused rule referencing a log datasource
(type or prod Loki UID); README documents the policy. The 2-vCPU monitoring
node pool remains undersized for 592k head series - resizing it is the
follow-up (owner: infra).

* fix(monitoring): Loki read-path requests, metric shadow for paused corrupted-stream rule

Review revision of #21455 round 1:

- Prometheus CPU limit back to "2": load is sustained 1.5-2.2 cores over
  14h (the ~2.9-core spikes were kubelet scrape-timeout artifacts), 0%
  CFS-throttled, and the Prometheus-backed rules already time out - the
  1600m cap would throttle them and the adapter's HPA metrics further.
  Starvation is fixed with requests plus the pool resize runbook instead.
- Loki read path (ingester/querier 50m/256Mi, index-gateway/ruler
  20m/128Mi) gets requests, arithmetic in the values file: jzv7 1913m of
  1930m allocatable, mczx 1488m. loki values normalized CRLF->LF
  (file untouched since #2708; the hygiene check rejects new CRLF lines).
- README: rollback now records the pre-apply helm revision (rolling back
  to rev 14 would revert #21306/#21389/#21358/#21409; #21389 is
  screenshots-off, the 10-13 502 fix); corrected the "renders with no
  diff" claim; added the 4-vCPU pool resize runbook (exact gcloud create
  + cordon/drain, zonal us-central1-a so the Grafana/Prometheus PVCs
  reattach); stack applies marked off-peak (Prometheus WAL replay of
  ~700k-980k head series freezes the pusher/listen/parakeet/VAD/diarizer
  HPAs; #21448's inert diarizer scrape job rides along); the 109/286
  down-target count (34 stale kubelet endpoints) noted as operator
  crash-loop fallout expected to clear.
- New metric rule omi-listen-audio-decode-failures shadows the paused
  corrupted-stream log rule on omi_listen_audio_decode_failures_total
  (startup zero-init children added); listen-429, ASGI-handshake and
  direct-OpenAI-quota gaps tracked in #21461.
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