1.5 KiB
1.5 KiB
026 — Settings: maximum logs kept in memory
Summary
ottyl currently keeps every ingested log forever in the in-memory BTreeMap. The
wishlist wants a settings-configurable cap on how many logs are retained, with no
cap (unlimited) as the default.
Scope
- New
Settingsfield (e.g.max_logs: Option<usize>),None/unset = unlimited, matching the existing "by default it should be unlimited" requirement. - Enforce the cap in the engine's ingest path: once the
IngestedLogrange exceeds the configured max, evict the oldest entries (lowestsequence) to bring it back under the cap. - Decide and document what happens to data that references evicted logs:
- Params/metrics already derived into
Bucketvalues from an evicted log are not retroactively removed (buckets are aggregate data, not raw logs) — state this explicitly so it's not treated as a bug later. sequencenumbering does not reset/renumber on eviction.
- Params/metrics already derived into
- Expose the setting in the Settings API/NavMenu settings panel (a numeric input, clearable back to "unlimited").
Acceptance criteria
- With no cap configured, behavior is unchanged (unbounded retention, as today).
- Setting a cap and ingesting past it keeps memory usage bounded — oldest logs
are evicted, newest
max_logsremain queryable viaGET /api/logs. - Changing the cap at runtime (via settings) takes effect on the next ingest without requiring a restart.
Depends on
None — extends the existing Settings model.