Repository navigation
fix(metrics): keep the projection-finish counters in the Cloud Run sync scrape - #25291
Merged
Merged
Conversation
…nc scrape backend-integration is the only service that runs the projection finish sweep, and its collector keep rule listed thirteen batch_projection families but neither omi_batch_projection_finish_reads_total nor omi_batch_projection_finish_completed_total. Both were exported on /metrics and dropped at ingestion, so the finish-backoff re-enable bar and the reads-per-completion alert read "no data". Add the two names to the keep rule and pin them in the two tests that read the rule from the deploy YAML. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Git-on-my-level
commented
Nov 14, 2026
Git-on-my-level
left a comment
Member
Author
There was a problem hiding this comment.
SHIP at 11d4888129b31339751c9832baf4e7f2bd6f8c02. No blocking findings in this three-file change.
backend/deploy/cloud_run_gmp_sync.yaml:64parses as YAML and the regex compiles. Removing only|batch_projection_finish_(reads|completed)_totalrecovers the previous regex byte for byte. The new alternative andbatch_projection_drains_skipped_totalboth sit at depth 1 insideomi_(...); every previously accepted name remains accepted.backend/utils/batch_pipeline/metrics.py:34-41declares both exact names. I instantiated those AST-extracted declarations with the repository-lockedprometheus-client==0.21.1in an isolated registry: the emitted samples areomi_batch_projection_finish_reads_totalandomi_batch_projection_finish_completed_total. Counter normalization strips the constructor's_totalinternally and adds it once on exposition; neither name becomes_total_total. Both counters are unlabelled. Optional_createdsamples remain excluded, as intended.- The only later relabel rule (
cloud_run_gmp_sync.yaml:67-71) dropsomi_fallback_totalfor two live-STT components; neither finish counter matches it. The deployment action (.github/actions/deploy-backend-stack/action.yml:1007-1022) passes this profile with--config-envto backend-integration, and the attachment script writes that revision-local config directly to the collector entrypoint. No additional repository-configured name filter was found on that path. The existing limits at YAML lines 77-81 still apply: 15,000 samples, 30 labels, name/value lengths 100/256. Exceeding the sample ceiling can reject the whole scrape, but this change adds only two unlabelled retained samples per target. Live headroom was not measured: this review used no production access and does not certify live ingestion. - From
backend/, ranpython -m pytest -q tests/unit/test_attach_cloud_run_gmp_sidecar.py tests/unit/test_enrichment_llm_cost_metrics_are_scraped.pyusing an isolated Python 3.11.15 environment with installed import dependencies and real prometheus-client 0.21.1: 124 passed, 1 warning in 8.64s (audioop deprecation).
PR head rechecked before posting: unchanged at the SHA above. Review only; no source changes, push, merge, or production access.
Git-on-my-level
deleted the
fix/scrape-keep-projection-finish-counters
branch
November 14, 2026 13:30
This was referenced Nov 14, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Nov 14, 2026
…tegration (#25307) ## Why `BATCH_PROJECTION_FINISH_BACKOFF_ENABLED` is being turned on for prod backend-integration on the push captain's go (SCA-2222, SCA-2166, 2026-11-14), applied by the release executor as a config-only revision. Repo config did not declare the lever at all, so the next deploy rendered from the repo would drop it. That is what happened to five hand-set Firestore lever values at 13:45Z today (fixed by #25277). This PR makes the repo say what production is meant to run. Both conditions of the runbook's re-enable bar that could be met from code are met: - the one-time stamping pass completed at 12:46Z (read-only preview: complete, 0 missing), using #25225 and #25287; - the finish counters export from backend-integration since Train 1 (#25291): `omi_batch_projection_finish_reads_total` read 46,459 in ten minutes at 16:44Z with `omi_batch_projection_finish_completed_total` at 0. ## What changed - `backend/deploy/runtime_env/prod.overlay.yaml`: `BATCH_PROJECTION_FINISH_BACKOFF_ENABLED: 'true'` (category rollout) for `backend-integration`, which runs the finish sweep, and for `backend-sync`, which can reach the same sweep through its authenticated reconcile and batch metrics routes (review SCA-2270; its finish counters read 0 in production today, so this is consistency, not a second saving). - `backend/deploy/runtime_env.yaml`: regenerated. - `config/deployment-setting-classification.json`: the binding is classified as config. - `backend/docs/feature-flag-registry.md`: regenerated. - `backend/tests/unit/test_render_backend_runtime_env.py`: the pin moves from "absent everywhere" to "true on prod backend-integration and backend-sync, absent on every other service and environment". ## What did not change No code path. No other service: prod backend and backend-sync-backfill render an empty `BATCH_PIPELINE_WORKER_AUDIENCE`, so the authenticated reconcile route that reaches the sweep cannot be invoked on them. No dev environment. The code default stays off. ## Tests `tests/unit/test_render_backend_runtime_env.py` and `tests/unit/test_backend_runtime_env_validator.py`: 364 passed. Both generator `--check` commands pass. ## Rollout Rides the next backend train; until then the release executor's config-only revision carries the value. Proof after the flip, posted on SCA-2173: finish reads per ten minutes before and after, completions, fresh commits per ten minutes not below half the 15:12-15:42Z baseline, and no rise in over-SLA or unfinished projections. Kill switch: `BATCH_PROJECTION_FINISH_BACKOFF_ENABLED=false` restores the legacy finish page immediately. ## Product invariants affected - INV-MEM-4 Named because `backend/deploy/runtime_env.yaml` changes. This PR adds one batch-projection binding for backend-integration and touches no memory intake, consolidation, promotion or privacy TTL setting; INV-MEM-4 behaviour is unchanged. Failure-Class: FC-deploy-literal-reverts-operator-value 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level
added a commit
to Git-on-my-level/omi
that referenced
this pull request
Nov 14, 2026
…tegration The finish-backoff lever is being turned on for backend-integration, the only service that runs the projection finish sweep, now that the one-time stamping pass has completed (BasedHardware#25225, BasedHardware#25287) and the finish counters export from that service (BasedHardware#25291). Repo config did not declare the lever at all, so the next deploy would have dropped a hand-set value. Declare BATCH_PROJECTION_FINISH_BACKOFF_ENABLED=true for prod backend-integration only, regenerate runtime_env.yaml, and move the renderer pin: present and true on prod backend-integration, absent on every other service and environment. Kill switch: BATCH_PROJECTION_FINISH_BACKOFF_ENABLED=false. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Nov 15, 2026
The projection-finish counters are already kept on main by PR #25291. This PR adds focused regression coverage for their producer registrations, the sync and shared collector profiles, neighboring projection metrics, and rejected near misses. Merged current main into the existing branch and resolved the stale YAML conflict by retaining main's collector configuration verbatim. The final diff contains only `backend/tests/unit/test_projection_finish_metrics_are_scraped.py`. Verification: the focused projection-finish, sidecar attachment, enrichment cost, quiet-check, and timeliness suites pass. Repository preflight and normal push hooks are run before handoff; their results are recorded on SCA-2216. The collector YAML is embedded in the Cloud Run revision specification by the deployment attach step, rather than baked into the application image. An env-only revision outside that step inherits its existing collector config; no deployment is performed by this PR. Failure-Class: FC-metric-dropped-by-scrape-allowlist Closes SCA-2216.
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.
Why
omi_batch_projection_finish_reads_totalandomi_batch_projection_finish_completed_totalgate the finish-backoff lever (runbookbackend/docs/runbooks/projection-finish-backfill.md, re-enable bar item 2) and feed the reads-per-completion alert. Measured in production monitoring on 2026-11-14: both read 0 on backend and backend-listen and have no series at all on backend-integration, which is the only service that runs the finish sweep (BATCH_PIPELINE_SERVING_ENABLEDis true only there). The keep rule inbackend/deploy/cloud_run_gmp_sync.yamllisted thirteenbatch_projection_*families and neither of these, so they were dropped at ingestion.What changed
batch_projection_finish_(reads|completed)_total.Nothing else. Two label-less counters, one series each per instance.
Tests
tests/unit/test_attach_cloud_run_gmp_sidecar.pyandtests/unit/test_enrichment_llm_cost_metrics_are_scraped.py: 124 passed.Rollout
The collector config is revision-local, so it takes effect on the next backend-integration, backend-sync and backend-sync-backfill revisions built from a commit that contains it (Train 1, SCA-2222). Acceptance after the roll: both counters non-zero in monitoring for backend-integration. Not covered here: the Stackdriver exporter prefix list used for dashboards does not name these two families; the re-enable bar reads managed Prometheus directly.
Failure-Class: FC-metric-dropped-by-scrape-allowlist
🤖 Generated with Claude Code