Skip to content

ref(logs): use RingBuffer for logs when not using log_flush_threshold#2058

Open
Litarnus wants to merge 1 commit intomasterfrom
ringbuffer-for-logs
Open

ref(logs): use RingBuffer for logs when not using log_flush_threshold#2058
Litarnus wants to merge 1 commit intomasterfrom
ringbuffer-for-logs

Conversation

@Litarnus
Copy link
Copy Markdown
Contributor

@Litarnus Litarnus commented Apr 2, 2026

This PR changes the storage for logs to a RingBuffer when log_flush_threshold is not set. This prevents unbounded memory growth and will rather drop old logs instead of adding potential to trigger OOM. It has a hard cap of 1000, which is reasonably high because envelopes with more than 1000 logs are likely to be above the envelope limit of 1MB which would be dropped by ingestion anyway.

The PR also introduces a TelemetryStorage class, which wraps the regular array and RingBuffer into a single storage class so that it can be reused by metrics and also to provide a simpler interface in the aggregators.

closes PHP-76

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 2, 2026

@Litarnus Litarnus linked an issue Apr 2, 2026 that may be closed by this pull request
@Litarnus Litarnus marked this pull request as ready for review April 2, 2026 15:48
@Litarnus Litarnus self-assigned this Apr 2, 2026
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.

RingBuffer for Logs

1 participant