Batcher refactor and performance observability#2310
Conversation
Batcher loop is now easier to navigate. Time waits replaced with ticker. Metrics for performance monitoring are now included. Different batchers can be run in parallel with name attribute used to distinguish.
PR SummaryMedium Risk Overview It adds OpenTelemetry instrumentation: batcher-level metrics (queue length, dropped items, flush sizes and timings) with a configurable Reviewed by Cursor Bugbot for commit 376a09a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Guard Start, Stop, and Push with a sync.RWMutex to prevent a send-on-closed-channel panic that could occur when Stop closed b.ch between Push's started check and the channel send. Also update the QueueSize doc comment to reflect that Push now returns ErrBatcherQueueFull instead of the old (false, nil).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6ce9a7a1b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Without reset, a size-triggered flush near a tick boundary would give the next batch less than MaxDelay to accumulate. Now each batch always gets a full MaxDelay window after the previous flush.
Uh oh!
There was an error while loading. Please reload this page.