Repository navigation
feat(observability): count no-op Firestore writes by caller - #24226
Merged
Merged
Conversation
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]>
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.
Summary
Cloud Monitoring
document/write_countshows about 15-20% of fleet Firestore writes asUPDATE_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_timeis 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 resultupdate_timeis earlier than the responsecommit_timeon 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 noupdate_timeand 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.shunderbin/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 (earlierupdate_time) and a delete counts exactly one no-op for the calling function.test_attach_cloud_run_gmp_sidecar.py117,test_memory_change_head.py50,test_list_projection.py20: pass.Not run: live traffic. The check after deploy is that fleet no-op counts track Cloud Monitoring
UPDATE_NOOPfor the default database.Rollback
Revert. Counters only.
Failure-Class: none
🤖 Generated with Claude Code