Repository navigation
[2.0] Fixes #37889: Wait for the metrics worker's in-flight item before summarizing - #37899
Conversation
…marizing (#37890) * fix(ingestion): wait for the metrics worker's in-flight item before summarizing * fix(ingestion): record the metrics flush and lock decisions, make the race test deterministic - Release the held worker only once the summary waits on the queue, so the regression test cannot pass without the fix. - Read thread ids under the lock in merge_all_threads. - Update the docstring and field comment that still called recording lock-free. - Add decision records for the 1s flush wait and the shared record/merge lock. * docs: state when a metrics summary read can take the full flush wait (cherry picked from commit 930926a)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved 🟡 Medium riskLocking metric recording and merging, plus bounded queue flushing, changes in-process aggregation; a one-second timeout could leave in-flight metrics out of summaries. Backport of the metrics worker fix to 2.0: summary reads now wait up to 1s for the worker's in-flight item, and recording and merging share a lock. Worker marks dequeued items done in a finally block, and a shared VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Backport of #37890 to 2.0. Fixes #37889
OperationMetricsState.__init__; kept 2.0'sDicthints.test_operation_metrics.pypasses on 2.0; the new test fails on 2.0 without the fix.🤖 Generated with Claude Code
Summary by Gitar
finallyblock so flushes never hang_drain_async_queuehelper is shared by shutdown, clearing, and summary flushes_record_syncwhen_worker_is_alive()returns falseThis will update automatically on new commits.


Confidence Score: 5/5
The PR appears safe to merge, with the previous documentation finding fully addressed.Summary
The PR makes metrics summaries wait for work already taken by the background worker and puts recording and merging under the same lock.
Reviews (2) · Last reviewed commit: "docs: the metrics flush ADR bounds only ..." · Reviewed by Greptile