Skip to content

Enforce daily telemetry event storage limits - #326

Open
gmemuriuki wants to merge 3 commits into
mainfrom
telemetry/event-storage-limits
Open

gmemuriuki wants to merge 3 commits into
mainfrom
telemetry/event-storage-limits

Conversation

@gmemuriuki

@gmemuriuki gmemuriuki commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds bounded low-volume event storage on top of the private storage foundation.

Complete relationship batches are serialized before the event file is opened and appended with one batch write. If an earlier failed append left an unterminated line, the writer closes that line before appending new rows so the new batch cannot be swallowed by malformed data.

The daily size policy accounts for both event and metric files, reserves space for the largest marker the running build can emit, and writes at most one storage_limit marker before stopping event appends for that day. Aggregate recording remains independent of a stopped event day.

Tests cover exact-fit and one-byte-over boundaries, tail repair, whole-batch rejection, marker recovery from the file, stopped-day rollover, permission handling, and inspection or marker-preparation failures.

Disclosure questions

AI disclosure.

  • The AI tool authored large parts of the code

Questions for reviewers.

Could reviewers check the distinction between a capacity-closed day and an attempt-scoped suppression? Only a real capacity decision persists a stopped day; inspection and marker-preparation failures leave it open.

@gmemuriuki gmemuriuki self-assigned this Oct 8, 2026
@gmemuriuki
gmemuriuki added this pull request to stack #331 October 8, 2026 18:34
@gmemuriuki
gmemuriuki force-pushed the telemetry/event-storage-limits branch 2 times, most recently from f5031c8 to 037e0e4 Compare October 14, 2026 07:51
Base automatically changed from telemetry/private-storage-foundation to main October 16, 2026 09:02
@nikomatsakis
nikomatsakis force-pushed the telemetry/event-storage-limits branch from 037e0e4 to e584e4a Compare October 16, 2026 09:02
Introduce a typed LowVolumeRow boundary so aggregate metric rows cannot enter
the append-only event log. EventBatch validates one authoritative UTC day and
serializes the complete ordered batch before opening a file.

Append batches through LockedStorage using the canonical daily path. Existing
partial final lines are closed before new rows are written, owner-only
permissions are restored where supported, and failures identify the
preparation, inspection, repair, or write stage.

Share event and metric filename rules with daily-file discovery and document
the tail-repair and storage-allowance behavior in the telemetry contract and
module guide.
Add the low-volume event admission policy for the shared 8 MiB
daily ceiling. Measure event and metric files under the telemetry
lock, reserve the largest version 1 storage-limit marker, and make
whole-batch append, marker, or suppression decisions with saturating
arithmetic.

Bound final-line inspection and treat complete unterminated markers as
authoritative so a failed append cannot reopen a closed day. Track the
stopped UTC day in private state while keeping inspection and marker
preparation failures scoped to one attempt.

Document the wire limit, state lifecycle, and event-before-snapshot
ordering. Add boundary coverage for exact capacity, partial-tail
repair, marker recovery, and failure precedence.
Keep filename-to-kind pairing in DailyFileKind and expose one
tolerant canonical-file scan for archive inspection. The high-water
lookup remains strict because overlooking a later day could reopen
closed storage.
@gmemuriuki
gmemuriuki force-pushed the telemetry/event-storage-limits branch from e73d304 to 8d31feb Compare October 20, 2026 13:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant