Rewrite log streaming with io.Pipe#291
Closed
jasonopslevel wants to merge 2 commits into
Closed
Conversation
Replace the SafeBuffer + ticker-polling LogStreamer with reader goroutines that drain io.Pipe endpoints via a manual []byte buffer and bytes.IndexByte line extraction. Exec writes directly to the PipeWriter; readers emit lines as they arrive and force-flush once the buffer reaches 64 KiB with no newline, retaining a 1 KiB tail so patterns straddling the cut still match on the next emission. BoundarySafeProcessor lets the sanitizer redact across that cut. Flush closes the pipes and waits on a WaitGroup, which naturally delivers any trailing partial line via EOF. This removes the polling loop, the 50 ms latency floor, the 200 ms Flush sleep, the Run↔Flush processor race, and the SafeBuffer type entirely.
f04be9d to
c7beda7
Compare
Contributor
Author
|
We can save this larger refactor for later |
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.
Replace the SafeBuffer + ticker-polling LogStreamer with reader goroutines that drain io.Pipe endpoints via a manual []byte buffer and bytes.IndexByte line extraction. Exec writes directly to the PipeWriter; readers emit lines as they arrive and force-flush once the buffer reaches 64 KiB with no newline, retaining a 1 KiB tail so patterns straddling the cut still match on the next emission. BoundarySafeProcessor lets the sanitizer redact across that cut. Flush closes the pipes and waits on a WaitGroup, which naturally delivers any trailing partial line via EOF.
This removes the polling loop, the 50 ms latency floor, the 200 ms Flush sleep, the Run↔Flush processor race, and the SafeBuffer type entirely.
Issues
Changelog
changieentryTophatting