Skip to content

feat(observability): write-probe kill switch; raise Cloud Run GMP sample cap - #24228

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/fswrites-write-probe-switch
Nov 1, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/fswrites-write-probe-switch

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Train safety for the GMP sidecar's per-scrape samples cap (lead ruling 3d124a). Above the cap, GMP drops the instance's whole scrape, not just the new series.

Backend Cloud Run max scrape, read-only GMP aggregates (scrape_samples_scraped, job omi-cloud-run-application-metrics):

Service Max scrape Note
backend 9,339 now; 9,873 24h max 3 instances, median 9,224
backend-sync 7,704
backend-sync-backfill 6,769
backend-integration 6,042
desktop-backend 3,151

The next train adds to backend, beyond the write probe:

That is up to about 118 samples against roughly 127 of headroom.

Two changes:

  1. OMI_FIRESTORE_WRITE_PROBE_ENABLED kill switch for the feat(observability): count Firestore writes by collection, caller and origin #24218 write probe. It is on unless the literal false. Off means database._client never wraps the transport, so no labelled write series exist in that process. That leaves 2 unlabelled counter samples. It is registered in config/feature-flags.yaml as ops_kill, and the registry doc is re-rendered.
  2. Shared Cloud Run sidecar cap 10,000 → 15,000 (backend/deploy/cloud_run_gmp_sidecar.yaml: backend, desktop-backend, notifications-job). Today backend is about 1% from losing all metrics on any new series; this restores headroom. GMP bills per sample emitted, so the cap itself costs nothing. The sync sidecar (cloud_run_gmp_sync.yaml, max 7,704) is unchanged.

Series behaviour:

  • Write probe series are per instance. They grow with code-path diversity (distinct caller × collection × op an instance has executed, capped), not with write volume.
  • At batch 100%, instance count may grow and each instance sees more batch callers. Per-instance cardinality rises toward the caps, not with load.

Recommended for the train: merge this. If the cap raise is not wanted in this train, set OMI_FIRESTORE_WRITE_PROBE_ENABLED=false on backend Cloud Run only. Sync, listen and pusher keep the probe.

Product invariants affected

none. Observability config only; no data path.

Verification

All runs used backend/test.sh under bin/omi-heavy + nice -n 19, at the unit layer:

  • test_firestore_write_probe.py: 16 passed, including the kill switch (literal false and FALSE leave FirestoreClient.commit unwrapped; unset, empty, true, 0, off stay on).
  • The other tests that read the sidecar config: test_attach_cloud_run_gmp_sidecar (117), test_external_list_cache, test_fleet_deployment, test_parakeet_request_metrics, test_relevance_metric_is_scraped, test_sync_absorption_metrics. All pass.
  • scripts/check_feature_flag_registry.py: OK.

Rollback

Set the switch to false on any service, or revert. The cap can return to 10,000 only if the max scrape is well below it.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…ple cap

Backend Cloud Run peaked at 9,873 samples per scrape against the shared
sidecar cap of 10,000; over the cap GMP drops the whole scrape. Add
OMI_FIRESTORE_WRITE_PROBE_ENABLED (on unless literal false) so a service can
skip the write probe entirely, and raise the shared sidecar cap to 15,000.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 5 files

Confidence score: 5/5

  • backend/docs/feature-flag-registry.md still shows an older as-of date, so consumers may not realize the catalog includes the 2026-11-01 flag. Update the snapshot date.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/docs/feature-flag-registry.md">

<violation number="1" location="backend/docs/feature-flag-registry.md:523">
P3: Update the registry’s as-of date when adding this 2026-11-01 flag; otherwise consumers cannot tell that the catalog includes information newer than its stated snapshot.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

| `OMI_EXTERNAL_LIST_CACHE_ENABLED` | Default on unless false; Encrypted authorized external list responses; ten seconds unless collection write coverage admits a versioned cache; expiry anchored before the origin query | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
| `OMI_EXTERNAL_LIST_METRICS_ENABLED` | Default on unless false; Count four external list GETs and staged promote POST including auth rate-limit validation and server errors | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
| `OMI_EXTERNAL_LIST_SINGLE_FLIGHT_ENABLED` | Default on; coalesce simultaneous identical external-list cache misses after each request passes authorization | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
| `OMI_FIRESTORE_WRITE_PROBE_ENABLED` | Default on; count committed Firestore writes by collection, op, caller and origin at the GAPIC Commit/BatchWrite boundary | backend | env | open | — | — | — | — | keep | keep | — | fswrites |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Update the registry’s as-of date when adding this 2026-11-01 flag; otherwise consumers cannot tell that the catalog includes information newer than its stated snapshot.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/feature-flag-registry.md, line 523:

<comment>Update the registry’s as-of date when adding this 2026-11-01 flag; otherwise consumers cannot tell that the catalog includes information newer than its stated snapshot.</comment>

<file context>
@@ -520,6 +520,7 @@ and an explicit empty literal renders as `''`.
 | `OMI_EXTERNAL_LIST_CACHE_ENABLED` | Default on unless false; Encrypted authorized external list responses; ten seconds unless collection write coverage admits a versioned cache; expiry anchored before the origin query | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
 | `OMI_EXTERNAL_LIST_METRICS_ENABLED` | Default on unless false; Count four external list GETs and staged promote POST including auth rate-limit validation and server errors | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
 | `OMI_EXTERNAL_LIST_SINGLE_FLIGHT_ENABLED` | Default on; coalesce simultaneous identical external-list cache misses after each request passes authorization | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
+| `OMI_FIRESTORE_WRITE_PROBE_ENABLED` | Default on; count committed Firestore writes by collection, op, caller and origin at the GAPIC Commit/BatchWrite boundary | backend | env | open | — | — | — | — | keep | keep | — | fswrites |
 | `OMI_GEMINI_OVERFLOW_ENABLED` | Enable overflow routing to Gemini | backend, llm-gateway | env | open | — | — | — | — | keep | keep | — | unowned |
 | `OMI_LIST_PROJECTION_WRITER_ENABLED` | Default on; atomically maintain compact conversation/action metadata rows and opaque list versions | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
</file context>

@Git-on-my-level
Git-on-my-level merged commit 5d0888b into main Nov 1, 2026
73 of 75 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/fswrites-write-probe-switch branch November 1, 2026 09:51
Git-on-my-level added a commit that referenced this pull request Nov 1, 2026
Conflict only in config/feature-flags.yaml with #24228; registry regenerated.

Co-Authored-By: Claude Opus 5.5 <[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.

1 participant