Skip to content

perf(streams): Debounce noisy MessageRejected backpressure logs#330

Merged
fpacifici merged 1 commit into
mainfrom
fpacifici/less-verbose
Jun 8, 2026
Merged

perf(streams): Debounce noisy MessageRejected backpressure logs#330
fpacifici merged 1 commit into
mainfrom
fpacifici/less-verbose

Conversation

@fpacifici

Copy link
Copy Markdown
Collaborator

Under backpressure, submit is retried in a tight loop, so the per-attempt debug logs for MessageRejected outcomes flooded the logs. These logs are now debounced, while the Ok and InvalidMessage paths keep logging on every attempt.

BatchStep drain submit

The rejected drain-submit log and a new streams.pipeline.batch.submit_rejected counter 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 original duration_ms and outbound_len attributes.

PythonAdapter per-submit logs

A small DebouncedLogger (5s, message built lazily, suppressed-occurrence count appended automatically) wraps the two per-submit debug logs — in submit and when forwarding to the next step in poll. Debouncing applies only to the MessageRejected outcome; Ok and InvalidMessage log 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.

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>
@fpacifici fpacifici marked this pull request as ready for review June 8, 2026 15:44
@fpacifici fpacifici requested a review from a team as a code owner June 8, 2026 15:44
@fpacifici fpacifici merged commit 41c4f2c into main Jun 8, 2026
25 checks passed
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.

2 participants