Skip to content

fix(metrics): keep the projection-finish counters in the Cloud Run sync scrape - #25291

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/scrape-keep-projection-finish-counters
Nov 14, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/scrape-keep-projection-finish-counters

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Why

omi_batch_projection_finish_reads_total and omi_batch_projection_finish_completed_total gate the finish-backoff lever (runbook backend/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_ENABLED is true only there). The keep rule in backend/deploy/cloud_run_gmp_sync.yaml listed thirteen batch_projection_* families and neither of these, so they were dropped at ingestion.

What changed

  • The keep rule gains batch_projection_finish_(reads|completed)_total.
  • The two tests that read the rule from the deploy YAML pin both names.

Nothing else. Two label-less counters, one series each per instance.

Tests

tests/unit/test_attach_cloud_run_gmp_sidecar.py and tests/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

View guided diff Turn on auto-fix

…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 Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SHIP at 11d4888129b31339751c9832baf4e7f2bd6f8c02. No blocking findings in this three-file change.

  1. backend/deploy/cloud_run_gmp_sync.yaml:64 parses as YAML and the regex compiles. Removing only |batch_projection_finish_(reads|completed)_total recovers the previous regex byte for byte. The new alternative and batch_projection_drains_skipped_total both sit at depth 1 inside omi_(...); every previously accepted name remains accepted.
  2. backend/utils/batch_pipeline/metrics.py:34-41 declares both exact names. I instantiated those AST-extracted declarations with the repository-locked prometheus-client==0.21.1 in an isolated registry: the emitted samples are omi_batch_projection_finish_reads_total and omi_batch_projection_finish_completed_total. Counter normalization strips the constructor's _total internally and adds it once on exposition; neither name becomes _total_total. Both counters are unlabelled. Optional _created samples remain excluded, as intended.
  3. The only later relabel rule (cloud_run_gmp_sync.yaml:67-71) drops omi_fallback_total for 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-env to 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.
  4. From backend/, ran python -m pytest -q tests/unit/test_attach_cloud_run_gmp_sidecar.py tests/unit/test_enrichment_llm_cost_metrics_are_scraped.py using 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
Git-on-my-level merged commit ea808b9 into main Nov 14, 2026
67 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/scrape-keep-projection-finish-counters branch November 14, 2026 13:30
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.
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