perf(streams): Debounce noisy MessageRejected backpressure logs#330
Merged
Conversation
Under backpressure, submit is retried in a tight loop, so the per-attempt debug logs for MessageRejected outcomes flooded the logs. In BatchStep, the rejected drain-submit log and a new streams.pipeline.batch.submit_rejected counter metric are now emitted at most once per 3s, carrying the accumulated occurrence count and the timestamp of the first rejection. Ok and InvalidMessage outcomes still log every time. In PythonAdapter, a DebouncedLogger (5s) wraps the two per-submit debug logs and is applied only to the MessageRejected outcome; Ok and InvalidMessage log unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
untitaker
approved these changes
Jun 8, 2026
3 tasks
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.
Under backpressure,
submitis retried in a tight loop, so the per-attempt debug logs forMessageRejectedoutcomes flooded the logs. These logs are now debounced, while theOkandInvalidMessagepaths keep logging on every attempt.BatchStep drain submit
The rejected drain-submit log and a new
streams.pipeline.batch.submit_rejectedcounter metric are emitted at most once per 3s, carrying the accumulated occurrence count and the wall-clock time of the first rejection in the window. The log keeps the originalduration_msandoutbound_lenattributes.PythonAdapter per-submit logs
A small
DebouncedLogger(5s, message built lazily, suppressed-occurrence count appended automatically) wraps the two per-submit debug logs — insubmitand when forwarding to the next step inpoll. Debouncing applies only to theMessageRejectedoutcome;OkandInvalidMessagelog on every call as before.The debounce flushes on the next occurrence, so if rejections stop entirely the final accumulated count waits for the next event — acceptable for the tight-loop scenario these guards target.