improve: clarify EventProcessor logging and contract for events received before start#3382
Merged
csviri merged 2 commits intoMay 27, 2026
Conversation
…ved before start Signed-off-by: Dennis-Mircea Ciupitu <dennis.mircea.ciupitu@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves clarity around how the EventProcessor behaves when receiving events before it has been started, by documenting the deferral mechanism and updating the associated debug log message.
Changes:
- Added Javadoc to
handleEventdescribing deferral/replay behavior during the startup window - Updated debug logging from “Skipping” to “Deferring” to better reflect actual behavior
Collaborator
|
@Dennis-Mircea please format the code (it is enough if you run |
Signed-off-by: Dennis-Mircea Ciupitu <dennis.mircea.ciupitu@gmail.com>
Contributor
Author
Done! |
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.
Summary
When the SDK starts up, there is a short window (observed at ~140 ms on Flink Kubernetes Operator startup) between when
EventSourceManagerstarts the informers and whenEventProcessor.start()is actually called. During that window, the initial informer LIST emits ADDED events for every existing resource, andEventProcessor.handleEvent(...)receives them whilerunning == false.The events are not lost.
handleEventcallsresourceStateManager.getOrCreateOnResourceEvent(...), records the metric, and then callshandleEventMarking(event, state)before checkingrunning. WhenEventProcessor.start()is eventually invoked, it setsrunning = trueand callshandleAlreadyMarkedEvents(), which replays every state witheventPresent(). Delete events are also short-circuited tocleanupForDeletedEvent(...)even when not running.The problem is that the log message in this branch is alarming and reads exactly like dropped work:
…and there is no JavaDoc on
handleEventexplaining the marking-then-replay contract, so the only way to confirm "events are not lost" is to read the code.This PR clarifies both:
handleEvent. One short paragraph that documents the deferral-and-replay contract and points at#start()and#handleAlreadyMarkedEvents()so future readers don't have to reverse-engineer the flow.No behavior change. Strictly an observability + documentation improvement.
Why this came up
While debugging an unrelated issue on Flink Kubernetes Operator, I noticed the following sequence in DEBUG logs at startup:
The "Skipping event ... not started" message is misleading as it looks like silently dropped initial state. The code is correct (the events are marked and replayed via
handleAlreadyMarkedEvents), but the log line and the missing JavaDoc made it hard to tell from operator logs alone.