Repository navigation
Logs expire on a schedule you can set - #79
Merged
Merged
Conversation
`Recorder::gc` has been written and tested for a while and nothing ever called it, so the request log only ever grew. There was no setting either. Two clocks, because the two things cost three orders of magnitude apart. A request or response body is tens of KB and a busy day makes hundreds of MB of them; a row — time, model, usage, amount — is a few hundred bytes, and a quarter of those is tens of MB. One clock for both means either throwing away "what did last month cost" early or letting the disk pay for bodies. Defaults: bodies 7 days, rows 90. The size cap is for the weeks that are not typical. What days of retention costs depends on usage, and usage has weeks that run ten times normal; without a ceiling that week fills the disk and the first anyone hears of it is the disk being full. Default 2 GB of bodies, oldest whole days going first. It runs once at startup and then hourly. Only at startup and a machine that stays on never gets to it; only on a timer and a machine shut overnight never does either. Each pass re-reads the config, so changing a limit takes effect on the next pass rather than needing a restart. `RetentionView` carries what bodies currently occupy alongside the settings: "2 GB" is a number nobody can judge without knowing what is in use. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fylorn
force-pushed
the
feat/log-retention
branch
from
September 21, 2026 12:05
d55ecc3 to
5e4f9b9
Compare
This was referenced Sep 21, 2026
Merged
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.
Recorder::gchas been written and tested for a while and nothing ever called it, so the request log only ever grew. There was no setting for it either.Two clocks
A request or response body is tens of KB, and a busy day makes hundreds of MB of them. A row — time, model, usage, amount — is a few hundred bytes, and a quarter of those is tens of MB. One clock for both means either throwing away "what did last month cost" early, or letting the disk pay for bodies.
body_daysrow_daysbody_max_bytesThe size cap is for the weeks that are not typical. What days of retention costs depends on usage, and usage has weeks that run ten times normal; without a ceiling that week fills the disk and the first anyone hears of it is the disk being full. Oldest whole days go first — half a day of records is harder to explain than none ("why is this morning's request empty?"), which is what the blob store already did.
When it runs
Once at startup, then hourly. Only at startup and a machine that stays on never gets to it; only on a timer and a machine shut overnight never does either. Each pass re-reads the config, so changing a limit takes effect on the next pass instead of needing a restart.
What the UI gets
RetentionViewcarriesbody_bytes_nowalongside the three settings. "2 GB" is a number nobody can judge as tight or loose without seeing what is currently in use.Tests
That the two clocks are independent (a body past its day count goes while its row stays, and the row goes only when its own count passes); that the size cap bites even when nothing is old enough; that defaults stay out of the config file but a choice does not, and that an unwritten field stays at its default rather than becoming 0 — 0 would tell gc to delete everything; and that a typo in the section is rejected rather than silently ignored, which is the lesson already recorded on
Limits.🤖 Generated with Claude Code