Repository navigation
Conversation
A13xB0
force-pushed
the
upstream/pr-2153
branch
from
October 10, 2026 23:02
a86e686 to
323b18d
Compare
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.
From upstream
This PR brings in upstream Kpa-clawbot/CoreScope#2153 by @n30nex. It is open upstream at the time of writing and addresses upstream issue Kpa-clawbot#2151. Its own two commits are cherry-picked unchanged with
-x:1a60606dperf(ingestor): yield between committed retention batches (perf: let live ingestion run between retention batches Kpa-clawbot/CoreScope#2151) (upstreamb70a9f6b)a86e6861docs(perf): report paired retention gains and service-time tradeoffs (upstream323b18d4)Upstream's PR also carries
test: respect native permissions and fixture release context, the same change already brought in by the Kpa-clawbot#2149 PR on this fork; it is left out here so the two PRs do not apply it twice. Nothing in this PR was written for the fork.What it changes
PruneOldPacketsdeletes old transmissions in bounded batches under the writer lock. Between committed batches it now callsruntime.Gosched(), after the commit and the writer-lock release, so the serial ingest consumer gets CPU to finish a packet and submit its next write before retention competes for the next batch. It does not bound a single dense batch (one transaction with very many observations). Tests use an injected hook instead of the global scheduler.Performance
Upstream's measurement
Five alternating pairs on an Actions host, 128k transmissions / 2.05M observations, 50 ingest events/s and 20 HTTP requests/s, retention starting mid-window (full report in
docs/performance/sqlite-retention-b5-2026-10-09.md, included). By median paired ratio: additional-observation ingest p95 -5.0% and p99 -8.1%; per-event service time p99 +29.1%; cleanup +0.5%. Upstream describes it as a narrow scheduling benefit with a service-time trade-off, not a general speed-up.Our run of upstream's benchmark
BenchmarkRetentionConcurrentIngest(upstream's own, from this PR) uses only the publicPruneOldPackets, so it runs unchanged againstmastertoo. 10 runs each; each run reports a JSON profile; medians:On this machine the effect is larger than upstream's CI measurement and retention itself is not slower.
singleHotis unchanged, as upstream says: one huge transaction has no batch boundary to yield at.Not measured on pre-prod: retention runs once a day there, and the pre-prod host is in a 24-hour soak; upstream's paired run and the benchmark above are the evidence.
Tests
From upstream:
retention_fanout_test.go(yields after committed full batches; no yield for disabled, empty or failed work; late fresh arrivals between batches are kept; skewed children and empty parents keep fresh evidence; a failure rolls back only the current batch), and two extra plan assertions inprune_chunked_test.go(child work must seek by transmission key, never scan observations).All ingestor retention and prune tests pass;
make test: 16 of 16 modules pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H