Skip to content

plugin/decision: new "immediate" trigger mode #7516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sspaink
Copy link
Contributor

@sspaink sspaink commented Apr 14, 2025

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 the decision_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 the chunkEncoder which returns a result when a chunk is ready. The difference is that the size buffer adds the event to the encoder on log while the event buffer adds the event to the encoder on upload.

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.

Copy link

netlify bot commented Apr 14, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 813f807
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/680bb2d620ebd20008a10845
😎 Deploy Preview https://deploy-preview-7516--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sspaink sspaink force-pushed the decisionplugin_uploadtrigger branch 3 times, most recently from dd83df9 to ec256d9 Compare April 18, 2025 23:02
If reporting.trigger="immediate" chunks of events will be uploaded as soon as they are ready.

Signed-off-by: sspaink <[email protected]>
@sspaink sspaink force-pushed the decisionplugin_uploadtrigger branch from ec256d9 to c0bfd4c Compare April 21, 2025 15:46
@sspaink sspaink marked this pull request as ready for review April 21, 2025 15:58
@sspaink sspaink changed the title feat: new "immediate" trigger mode for decision log plugin plugin/decision: new "immediate" trigger mode Apr 30, 2025
@sspaink sspaink added the monitoring Issues related to decision log and status plugins label Apr 30, 2025
@sspaink sspaink marked this pull request as draft May 20, 2025 16:01
@sspaink
Copy link
Contributor Author

sspaink commented May 23, 2025

Keeping this in draft until #7521 is merged, some overlap so rather fix any merge conflicts before this is reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monitoring Issues related to decision log and status plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decision log plugin: trigger upload as soon as upload_size_limit_bytes is reached
2 participants