feat: new "immediate" trigger mode for decision log plugin #7516
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.
Why the changes in this PR are needed?
resolve: #7455
What are the changes in this PR?
This introduced a new trigger mode:
decision_logs.reporting.trigger=immediate
This trigger mode will upload events either if the upload size limit is reached or after the maximum delay.
Using this trigger mode disables configuring the
decision_logs.reporting.min_delay_seconds
and only thedecision_logs.reporting.max_delay_seconds
can be changed.Notes to assist PR review:
The
(p *Plugin) loop()
method can now spin up a separate routine when using this new trigger mode that waits for a message from a buffer. Both the size and event buffer use thechunkEncoder
which returns a result when a chunk is ready. The difference is that the size buffer adds the event to the encoder onlog
while the event buffer adds the event to the encoder onupload
.For the size buffer to support this mode I added a new channel (
immediateResult
) to notify there is a chunk ready. While the event buffer already uses a buffered channel it behaves the same reading from it until a chunk is ready.