Skip to content

feat(observability): count no-op Firestore writes by caller - #24226

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/fswrites-noop-writes
Nov 1, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/fswrites-noop-writes

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Cloud Monitoring document/write_count shows about 15-20% of fleet Firestore writes as UPDATE_NOOP: about 300k of 1.6-1.9M writes per hour on 10-30 weekdays. These writes are billed and changed nothing. That is roughly 7-8M writes/day, about $10/day at $1.385/M. Nothing names the callers.

Firestore's WriteResult.update_time is the document's previous update time when the write did not change it. A write that changed the document carries the commit time. The write probe (#24218) therefore counts a Commit write whose result update_time is earlier than the response commit_time on a new counter, omi_firestore_noop_writes_by_caller_total{collection, caller}. Labels reuse the probe's bounded collection allowlist and caller set; there are no IDs. Deletes carry no update_time and are skipped. BatchWrite has no commit time and is not classified.

The sync Cloud Run scrape keeps the new counter. The doc is updated (backend/docs/firestore-write-attribution.md).

This finds no-op writers for the Firestore write-cost mission (anx card:firestore-writes-about-57-day-no-lever). The cuts come once callers are named.

Product invariants affected

none. Observe-only: the probe never changes a request, a response or an error, and recording never raises.

Verification

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

  • tests/unit/test_firestore_write_probe.py: 10 passed. New test: one commit with a changed write (update_time = commit_time), an unchanged write (earlier update_time) and a delete counts exactly one no-op for the calling function.
  • test_attach_cloud_run_gmp_sidecar.py 117, test_memory_change_head.py 50, test_list_projection.py 20: pass.

Not run: live traffic. The check after deploy is that fleet no-op counts track Cloud Monitoring UPDATE_NOOP for the default database.

Rollback

Revert. Counters only.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 2 commits November 1, 2026 15:20
Cloud Monitoring reports ~15-20% of fleet writes as UPDATE_NOOP (about
300k of 1.6-1.9M writes/hour on 10-30 weekdays): billed, changed nothing,
no caller. Firestore returns the document's previous update_time in a
WriteResult when the write did not change it, so a Commit result whose
update_time predates the response commit_time is a no-op. The write probe
now counts those on omi_firestore_noop_writes_by_caller_total{collection,
caller}, which the sync scrape keeps. BatchWrite has no commit time and is
not classified.

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

Luna r1 P2: a second write to the same document in one Commit reports this
commit as its previous update_time whether or not it changed anything, so
the response cannot classify it. Document the undercount instead of guessing.

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.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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

@Git-on-my-level
Git-on-my-level merged commit d2e6600 into main Nov 1, 2026
60 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/fswrites-noop-writes branch November 1, 2026 10:06
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